|
| 1 | +// @ts-check |
| 2 | + |
| 3 | +import jsEslint from "@eslint/js"; |
| 4 | +import eslintConfigPrettier from "eslint-config-prettier"; |
| 5 | +import eslintPluginImportX from "eslint-plugin-import-x"; |
| 6 | +import * as tsEslint from "typescript-eslint"; |
| 7 | + |
| 8 | +export default tsEslint.config( |
| 9 | + jsEslint.configs.recommended, |
| 10 | + eslintPluginImportX.flatConfigs.recommended, |
| 11 | + eslintPluginImportX.flatConfigs.typescript, |
| 12 | + ...tsEslint.configs.strictTypeChecked, |
| 13 | + ...tsEslint.configs.stylisticTypeChecked, |
| 14 | + { |
| 15 | + languageOptions: { |
| 16 | + parserOptions: { |
| 17 | + projectService: { |
| 18 | + allowDefaultProject: ["*.js", "*.mjs"], |
| 19 | + }, |
| 20 | + tsconfigRootDir: import.meta.dirname, |
| 21 | + }, |
| 22 | + }, |
| 23 | + }, |
| 24 | + { |
| 25 | + ignores: [ |
| 26 | + "**/coverage", |
| 27 | + "**/dist", |
| 28 | + "**/esbuild.config.mjs", |
| 29 | + "**/lib/__fixtures__/**/*.ts", |
| 30 | + "**/jest.config.mjs", |
| 31 | + "**/smoke-tests", |
| 32 | + ], |
| 33 | + }, |
| 34 | + { |
| 35 | + rules: { |
| 36 | + "@typescript-eslint/await-thenable": "warn", |
| 37 | + "@typescript-eslint/explicit-function-return-type": "warn", |
| 38 | + "@typescript-eslint/no-floating-promises": [ |
| 39 | + "warn", |
| 40 | + { ignoreIIFE: true, ignoreVoid: false }, |
| 41 | + ], |
| 42 | + "@typescript-eslint/no-unused-vars": [ |
| 43 | + "warn", |
| 44 | + { argsIgnorePattern: "^_" }, |
| 45 | + ], |
| 46 | + "@typescript-eslint/restrict-template-expressions": [ |
| 47 | + "error", |
| 48 | + { |
| 49 | + allowNever: true, |
| 50 | + allowNumber: true, |
| 51 | + }, |
| 52 | + ], |
| 53 | + "import-x/no-named-as-default-member": "off", |
| 54 | + "import-x/no-unresolved": "off", |
| 55 | + "import-x/order": [ |
| 56 | + "warn", |
| 57 | + { "newlines-between": "always", alphabetize: { order: "asc" } }, |
| 58 | + ], |
| 59 | + "no-console": ["warn"], |
| 60 | + }, |
| 61 | + }, |
| 62 | + { |
| 63 | + files: ["**/*.spec.ts"], |
| 64 | + rules: { |
| 65 | + "@typescript-eslint/explicit-function-return-type": "off", |
| 66 | + "@typescript-eslint/no-non-null-assertion": "off", |
| 67 | + "@typescript-eslint/no-unsafe-argument": "off", |
| 68 | + "@typescript-eslint/no-unsafe-assignment": "off", |
| 69 | + "@typescript-eslint/no-unsafe-member-access": "off", |
| 70 | + }, |
| 71 | + }, |
| 72 | + { |
| 73 | + files: ["**/*.js", "**/*.mjs"], |
| 74 | + ...tsEslint.configs.disableTypeChecked, |
| 75 | + }, |
| 76 | + eslintConfigPrettier, |
| 77 | +); |
0 commit comments