|
| 1 | +// @ts-check |
| 2 | + |
| 3 | +import eslint from "@eslint/js"; |
| 4 | +import tsEslint from "typescript-eslint"; |
| 5 | +import unusedImports from "eslint-plugin-unused-imports"; |
| 6 | + |
| 7 | +export default tsEslint.config( |
| 8 | + { |
| 9 | + ignores: [ |
| 10 | + "build/", |
| 11 | + "dist/", |
| 12 | + ".vscode/", |
| 13 | + "node_modules/", |
| 14 | + "templates/", |
| 15 | + "public/", |
| 16 | + ".circleci/", |
| 17 | + ], |
| 18 | + }, |
| 19 | + { |
| 20 | + files: ["src/**/*.ts", "test/**/*.ts"], |
| 21 | + extends: [ |
| 22 | + eslint.configs.recommended, |
| 23 | + ...tsEslint.configs.recommendedTypeChecked, |
| 24 | + ], |
| 25 | + plugins: { |
| 26 | + "unused-imports": unusedImports, |
| 27 | + }, |
| 28 | + rules: { |
| 29 | + // Additional rules: |
| 30 | + ...{ |
| 31 | + eqeqeq: "error", |
| 32 | + "no-console": "error", |
| 33 | + "prefer-template": "error", |
| 34 | + "@typescript-eslint/no-shadow": "error", |
| 35 | + "no-unreachable": "error", |
| 36 | + "unused-imports/no-unused-imports": "warn", |
| 37 | + }, |
| 38 | + |
| 39 | + // Additional config for rules: |
| 40 | + ...{ |
| 41 | + "@typescript-eslint/explicit-module-boundary-types": [ |
| 42 | + "error", |
| 43 | + { allowArgumentsExplicitlyTypedAsAny: true }, |
| 44 | + ], |
| 45 | + "@typescript-eslint/no-unused-vars": [ |
| 46 | + "warn", |
| 47 | + { args: "none", caughtErrors: "none" }, |
| 48 | + ], |
| 49 | + }, |
| 50 | + |
| 51 | + // Disabled rules: |
| 52 | + ...{ |
| 53 | + "prefer-const": "off", |
| 54 | + "no-shadow": "off", // Replaced with "@typescript-eslint/no-shadow". |
| 55 | + "no-unused-vars": "off", // Replaced with "@typescript-eslint/no-unused-vars". |
| 56 | + "@typescript-eslint/no-non-null-assertion": "off", |
| 57 | + "@typescript-eslint/no-explicit-any": "off", |
| 58 | + "@typescript-eslint/no-unsafe-member-access": "off", |
| 59 | + "@typescript-eslint/unbound-method": "off", |
| 60 | + "@typescript-eslint/ban-ts-comment": "off", |
| 61 | + "@typescript-eslint/no-unsafe-argument": "off", |
| 62 | + "@typescript-eslint/no-empty-object-type": "off", |
| 63 | + }, |
| 64 | + |
| 65 | + // Rules to be enabled: |
| 66 | + ...{ |
| 67 | + "@typescript-eslint/ban-types": "off", |
| 68 | + "@typescript-eslint/no-unsafe-assignment": "off", |
| 69 | + "@typescript-eslint/no-unsafe-return": "off", |
| 70 | + "@typescript-eslint/no-unsafe-call": "off", |
| 71 | + "@typescript-eslint/restrict-template-expressions": "off", |
| 72 | + "@typescript-eslint/no-non-null-asserted-optional-chain": "off", |
| 73 | + }, |
| 74 | + |
| 75 | + // Rules to be discussed: |
| 76 | + ...{ |
| 77 | + "prefer-spread": "off", |
| 78 | + "no-async-promise-executor": "off", |
| 79 | + "no-case-declarations": "off", |
| 80 | + "no-fallthrough": "off", |
| 81 | + "no-inner-declarations": "off", |
| 82 | + "@typescript-eslint/require-await": "off", |
| 83 | + "@typescript-eslint/prefer-regexp-exec": "off", |
| 84 | + }, |
| 85 | + }, |
| 86 | + languageOptions: { |
| 87 | + parserOptions: { |
| 88 | + projectService: true, |
| 89 | + tsconfigRootDir: import.meta.dirname, |
| 90 | + warnOnUnsupportedTypeScriptVersion: false, |
| 91 | + }, |
| 92 | + }, |
| 93 | + }, |
| 94 | + { |
| 95 | + files: ["test/**/*.ts"], |
| 96 | + rules: { |
| 97 | + "@typescript-eslint/no-unused-expressions": "off", |
| 98 | + }, |
| 99 | + } |
| 100 | +); |
0 commit comments