|
| 1 | +import typescriptEslint from "@typescript-eslint/eslint-plugin"; |
| 2 | +import typescriptEslintRecommended from "@typescript-eslint/eslint-plugin/configs/recommended"; // Import the recommended config |
| 3 | +import globals from "globals"; |
| 4 | +import tsParser from "@typescript-eslint/parser"; |
| 5 | +import promise from 'eslint-plugin-promise'; |
| 6 | +import promiseRecommended from 'eslint-plugin-promise/recommended'; // Import promise config |
| 7 | +import n from 'eslint-plugin-n'; |
| 8 | +import nRecommendedTs from 'eslint-plugin-n/configs/recommended-typescript'; |
| 9 | +import importPlugin from 'eslint-plugin-import'; // Import import plugin |
| 10 | +import importRecommended from 'eslint-plugin-import/config/recommended'; // Import import config |
| 11 | + |
| 12 | +export default [ |
| 13 | + { |
| 14 | + ignores: ["**/dist"], |
| 15 | + }, |
| 16 | + { |
| 17 | + plugins: { |
| 18 | + "@typescript-eslint": typescriptEslint, |
| 19 | + promise: promise, |
| 20 | + n: n, |
| 21 | + import: importPlugin, // Add import plugin |
| 22 | + }, |
| 23 | + languageOptions: { |
| 24 | + globals: { |
| 25 | + ...globals.browser, |
| 26 | + ...globals.node, |
| 27 | + Atomics: "readonly", |
| 28 | + SharedArrayBuffer: "readonly", |
| 29 | + }, |
| 30 | + parser: tsParser, |
| 31 | + }, |
| 32 | + files: ["src/**/*", "test/**/*"], |
| 33 | + }, |
| 34 | + // spread the configuration files into the final config |
| 35 | + typescriptEslintRecommended, |
| 36 | + promiseRecommended, |
| 37 | + nRecommendedTs, |
| 38 | + importRecommended, // Add import config |
| 39 | + { |
| 40 | + rules: { |
| 41 | + "no-unused-vars": ["warn", { |
| 42 | + argsIgnorePattern: "^_", |
| 43 | + varsIgnorePattern: "^_", |
| 44 | + }], |
| 45 | + "@typescript-eslint/no-unused-vars": ["warn", { |
| 46 | + argsIgnorePattern: "^_", |
| 47 | + varsIgnorePattern: "^_", |
| 48 | + }], |
| 49 | + "promise/param-names": "error", |
| 50 | + "n/no-callback-literal": "error", |
| 51 | + // Remove rules added by the extends and not needed |
| 52 | + "@typescript-eslint/no-explicit-any": "off", |
| 53 | + "@typescript-eslint/explicit-module-boundary-types": "off", |
| 54 | + "no-var": "warn", |
| 55 | + "n/no-unsupported-features/es-syntax": "off", |
| 56 | + // import rules |
| 57 | + 'import/no-unresolved': 'off', // Because of the types conflict |
| 58 | + 'import/named': 'warn', |
| 59 | + 'import/default': 'warn', |
| 60 | + 'import/namespace': 'warn', |
| 61 | + 'import/no-absolute-path': 'warn', |
| 62 | + 'import/no-dynamic-require': 'warn', |
| 63 | + 'import/no-webpack-loader-syntax': 'warn', |
| 64 | + 'import/no-self-import': 'warn', |
| 65 | + 'import/no-useless-path-segments': 'warn', |
| 66 | + 'import/export': 'warn', |
| 67 | + 'import/no-named-as-default': 'warn', |
| 68 | + 'import/no-named-as-default-member': 'warn', |
| 69 | + 'import/no-deprecated': 'warn', |
| 70 | + 'import/no-extraneous-dependencies': 'warn', |
| 71 | + 'import/no-mutable-exports': 'warn' |
| 72 | + }, |
| 73 | + } |
| 74 | +]; |
0 commit comments