|
| 1 | +module.exports = { |
| 2 | + env: { |
| 3 | + browser: true, |
| 4 | + es2021: true, |
| 5 | + node: true, |
| 6 | + }, |
| 7 | + ignorePatterns: ["rollup.config.js"], |
| 8 | + overrides: [ |
| 9 | + { |
| 10 | + files: ["*.ts", "*.tsx"], |
| 11 | + extends: [ |
| 12 | + "eslint:recommended", |
| 13 | + "plugin:@typescript-eslint/recommended", |
| 14 | + "plugin:react/recommended", |
| 15 | + "plugin:react-hooks/recommended", |
| 16 | + "plugin:prettier/recommended", |
| 17 | + ], |
| 18 | + parser: "@typescript-eslint/parser", |
| 19 | + parserOptions: { |
| 20 | + ecmaFeatures: { |
| 21 | + jsx: true, |
| 22 | + }, |
| 23 | + ecmaVersion: 12, |
| 24 | + sourceType: "module", |
| 25 | + project: "./tsconfig.json", |
| 26 | + }, |
| 27 | + plugins: [ |
| 28 | + "react", |
| 29 | + "@typescript-eslint", |
| 30 | + "prettier", |
| 31 | + "simple-import-sort", |
| 32 | + "unused-imports", |
| 33 | + ], |
| 34 | + rules: { |
| 35 | + "react/react-in-jsx-scope": "off", |
| 36 | + "@typescript-eslint/explicit-module-boundary-types": "off", |
| 37 | + "@typescript-eslint/no-unused-vars": "off", // Replaced by unused-imports/no-unused-vars |
| 38 | + "@typescript-eslint/no-explicit-any": "off", |
| 39 | + "prettier/prettier": "error", |
| 40 | + |
| 41 | + // Import organization rules |
| 42 | + "simple-import-sort/imports": [ |
| 43 | + "error", |
| 44 | + { |
| 45 | + groups: [ |
| 46 | + // React first |
| 47 | + ["^react$", "^react/"], |
| 48 | + // External packages |
| 49 | + ["^@?\\w"], |
| 50 | + // Internal packages (relative imports starting with . or ..) |
| 51 | + ["^\\u0000"], |
| 52 | + ["^\\.\\.(?!/?$)", "^\\.\\./?$"], |
| 53 | + ["^\\./(?=.*/)(?!/?$)", "^\\.(?!/?$)", "^\\./?$"], |
| 54 | + // Style imports last |
| 55 | + ["^.+\\.s?css$"], |
| 56 | + ], |
| 57 | + }, |
| 58 | + ], |
| 59 | + "simple-import-sort/exports": "error", |
| 60 | + "unused-imports/no-unused-imports": "error", |
| 61 | + "unused-imports/no-unused-vars": [ |
| 62 | + "warn", |
| 63 | + { |
| 64 | + vars: "all", |
| 65 | + varsIgnorePattern: "^_", |
| 66 | + args: "after-used", |
| 67 | + argsIgnorePattern: "^_", |
| 68 | + }, |
| 69 | + ], |
| 70 | + }, |
| 71 | + settings: { |
| 72 | + react: { |
| 73 | + version: "detect", |
| 74 | + }, |
| 75 | + }, |
| 76 | + }, |
| 77 | + { |
| 78 | + files: ["*.js"], |
| 79 | + extends: ["eslint:recommended", "plugin:prettier/recommended"], |
| 80 | + parserOptions: { |
| 81 | + ecmaVersion: 12, |
| 82 | + sourceType: "module", |
| 83 | + }, |
| 84 | + }, |
| 85 | + ], |
| 86 | +}; |
0 commit comments