|
| 1 | +{ |
| 2 | + "$schema": "https://json.schemastore.org/eslintrc.json", |
| 3 | + "plugins": ["@typescript-eslint", "import", "eslint-plugin-react-compiler"], |
| 4 | + "parserOptions": { |
| 5 | + "project": "tsconfig.json" |
| 6 | + }, |
| 7 | + "extends": [ |
| 8 | + "plugin:@typescript-eslint/recommended-type-checked", |
| 9 | + "plugin:@typescript-eslint/stylistic-type-checked", |
| 10 | + "plugin:import/recommended", |
| 11 | + "plugin:import/typescript", |
| 12 | + "prettier", |
| 13 | + "next/core-web-vitals" |
| 14 | + ], |
| 15 | + "rules": { |
| 16 | + // these rules are too slow |
| 17 | + "import/no-cycle": "off", |
| 18 | + "react-compiler/react-compiler": "off", |
| 19 | + "@typescript-eslint/no-unsafe-assignment": "off", |
| 20 | + "@typescript-eslint/no-unused-vars": "off", |
| 21 | + |
| 22 | + // this doesn't make any sense |
| 23 | + "@typescript-eslint/prefer-nullish-coalescing": "off", |
| 24 | + |
| 25 | + // no |
| 26 | + "@typescript-eslint/consistent-type-definitions": "off", |
| 27 | + |
| 28 | + // why tho |
| 29 | + "@typescript-eslint/array-type": "off", |
| 30 | + |
| 31 | + // sort imports |
| 32 | + "import/order": "error", |
| 33 | + |
| 34 | + // no let exports |
| 35 | + "import/no-mutable-exports": "error", |
| 36 | + |
| 37 | + "import/no-default-export": "error", |
| 38 | + |
| 39 | + // allow {} even though it's unsafe but comes handy |
| 40 | + "@typescript-eslint/ban-types": [ |
| 41 | + "error", |
| 42 | + { |
| 43 | + "types": { |
| 44 | + "{}": false |
| 45 | + } |
| 46 | + } |
| 47 | + ], |
| 48 | + |
| 49 | + "@typescript-eslint/consistent-type-imports": [ |
| 50 | + "error", |
| 51 | + { |
| 52 | + "prefer": "type-imports", |
| 53 | + "fixStyle": "inline-type-imports", |
| 54 | + "disallowTypeAnnotations": false |
| 55 | + } |
| 56 | + ], |
| 57 | + |
| 58 | + "import/no-duplicates": ["error", { "prefer-inline": true }], |
| 59 | + |
| 60 | + // false negatives |
| 61 | + "import/namespace": ["off"], |
| 62 | + |
| 63 | + // we allow empty interfaces |
| 64 | + "no-empty-pattern": "off", |
| 65 | + "@typescript-eslint/no-empty-interface": "off", |
| 66 | + |
| 67 | + // we allow empty functions |
| 68 | + "@typescript-eslint/no-empty-function": "off", |
| 69 | + |
| 70 | + // we sometimes use async functions that don't await anything |
| 71 | + "@typescript-eslint/require-await": "off", |
| 72 | + |
| 73 | + // make sure to `await` inside try…catch |
| 74 | + "@typescript-eslint/return-await": ["error", "in-try-catch"], |
| 75 | + |
| 76 | + "react/no-unescaped-entities": "off", |
| 77 | + |
| 78 | + // numbers and booleans are fine in template strings |
| 79 | + "@typescript-eslint/restrict-template-expressions": [ |
| 80 | + "error", |
| 81 | + { "allowNumber": true, "allowBoolean": true } |
| 82 | + ], |
| 83 | + |
| 84 | + "@typescript-eslint/no-misused-promises": ["error", { "checksVoidReturn": false }], |
| 85 | + |
| 86 | + "no-restricted-imports": [ |
| 87 | + "error", |
| 88 | + { |
| 89 | + "name": "next/router", |
| 90 | + "message": "Please use next/navigation instead." |
| 91 | + } |
| 92 | + ] |
| 93 | + }, |
| 94 | + "overrides": [ |
| 95 | + { |
| 96 | + "files": [ |
| 97 | + "src/app/**/{page,layout,loading,route,not-found,error,global-error,default,robots,sitemap,opengraph-image}.ts?(x)", |
| 98 | + "src/i18n.ts", |
| 99 | + "*.d.ts", |
| 100 | + "tailwind.config.ts", |
| 101 | + "prettier.config.js", |
| 102 | + "middleware.ts", |
| 103 | + "commitlint.config.ts", |
| 104 | + "vitest.config.ts" |
| 105 | + ], |
| 106 | + "rules": { |
| 107 | + "import/no-default-export": "off" |
| 108 | + } |
| 109 | + } |
| 110 | + ], |
| 111 | + "ignorePatterns": ["*.js", "*.jsx", "*.mjs", "src/script/**/*.ts"] |
| 112 | +} |
0 commit comments