|
| 1 | +const typeScriptExtensions = [".ts", ".cts", ".mts", ".tsx"]; |
| 2 | + |
| 3 | +const allExtensions = [...typeScriptExtensions, ".js", ".jsx"]; |
| 4 | + |
| 5 | +module.exports = { |
| 6 | + root: true, |
| 7 | + extends: [ |
| 8 | + "eslint:recommended", |
| 9 | + "plugin:@typescript-eslint/recommended", |
| 10 | + "react-app", |
| 11 | + "react-app/jest", |
| 12 | + ], |
| 13 | + parser: "@typescript-eslint/parser", |
| 14 | + plugins: ["import", "@typescript-eslint"], |
| 15 | + settings: { |
| 16 | + "import/extensions": allExtensions, |
| 17 | + "import/external-module-folders": ["node_modules", "node_modules/@types"], |
| 18 | + "import/parsers": { |
| 19 | + "@typescript-eslint/parser": typeScriptExtensions, |
| 20 | + }, |
| 21 | + "import/resolver": { |
| 22 | + node: { |
| 23 | + extensions: allExtensions, |
| 24 | + }, |
| 25 | + }, |
| 26 | + }, |
| 27 | + ignorePatterns: ["**/ui/*"], |
| 28 | + rules: { |
| 29 | + "no-console": "error", |
| 30 | + curly: 1, |
| 31 | + "import/extensions": ["error", "always", { ignorePackages: true }], |
| 32 | + "import/no-extraneous-dependencies": [ |
| 33 | + "error", |
| 34 | + { |
| 35 | + devDependencies: true, |
| 36 | + peerDependencies: true, |
| 37 | + optionalDependencies: false, |
| 38 | + bundledDependencies: false, |
| 39 | + }, |
| 40 | + ], |
| 41 | + // would be nice to enable these rules later, but they are too noisy right now |
| 42 | + "@typescript-eslint/no-non-null-assertion": "off", |
| 43 | + "@typescript-eslint/no-explicit-any": "off", |
| 44 | + "@typescript-eslint/ban-ts-comment": "off", |
| 45 | + "import/no-cycle": "error", |
| 46 | + // doesn't work: |
| 47 | + // "import/no-restricted-paths": [ |
| 48 | + // "error", |
| 49 | + // { |
| 50 | + // zones: [ |
| 51 | + // { |
| 52 | + // target: "./src/**/*", |
| 53 | + // from: "./types/**/*", |
| 54 | + // message: "Import from this module to types is not allowed.", |
| 55 | + // }, |
| 56 | + // ], |
| 57 | + // }, |
| 58 | + // ], |
| 59 | + }, |
| 60 | +}; |
0 commit comments