|
| 1 | +import { defineConfig } from "oxlint"; |
| 2 | + |
| 3 | +const disabledRules = [ |
| 4 | + "eslint/arrow-body-style", |
| 5 | + "eslint/capitalized-comments", |
| 6 | + "eslint/complexity", |
| 7 | + "eslint/id-length", |
| 8 | + "eslint/init-declarations", |
| 9 | + "eslint/max-classes-per-file", |
| 10 | + "eslint/max-lines-per-function", |
| 11 | + "eslint/max-lines", |
| 12 | + "eslint/max-params", |
| 13 | + "eslint/max-statements", |
| 14 | + "eslint/no-console", |
| 15 | + "eslint/no-continue", |
| 16 | + "eslint/no-eq-null", |
| 17 | + "eslint/no-magic-numbers", |
| 18 | + "eslint/no-negated-condition", |
| 19 | + "eslint/no-plusplus", |
| 20 | + "eslint/no-ternary", |
| 21 | + "eslint/no-undefined", |
| 22 | + "eslint/no-use-before-define", |
| 23 | + "eslint/no-void", |
| 24 | + "eslint/prefer-destructuring", |
| 25 | + "eslint/sort-imports", |
| 26 | + "eslint/sort-keys", |
| 27 | + "func-style", |
| 28 | + "import/exports-last", |
| 29 | + "import/group-exports", |
| 30 | + "import/max-dependencies", |
| 31 | + "import/no-named-export", |
| 32 | + "import/no-namespace", |
| 33 | + "import/no-nodejs-modules", |
| 34 | + "import/no-relative-parent-imports", |
| 35 | + "import/prefer-default-export", |
| 36 | + "oxc/no-async-await", |
| 37 | + "oxc/no-optional-chaining", |
| 38 | + "oxc/no-rest-spread-properties", |
| 39 | + "promise/prefer-await-to-callbacks", |
| 40 | + "typescript/explicit-function-return-type", |
| 41 | + "typescript/parameter-properties", |
| 42 | + "typescript/prefer-readonly-parameter-types", |
| 43 | + "typescript/promise-function-async", |
| 44 | + "typescript/strict-void-return", |
| 45 | + "unicorn/filename-case", |
| 46 | + "unicorn/no-array-for-each", |
| 47 | + "unicorn/no-lonely-if", |
| 48 | + "unicorn/no-null", |
| 49 | + "unicorn/prefer-at", |
| 50 | + "unicorn/prefer-spread", |
| 51 | + "unicorn/switch-case-braces", |
| 52 | +]; |
| 53 | + |
| 54 | +// oxlint-disable-next-line import/no-default-export |
| 55 | +export default defineConfig({ |
| 56 | + ignorePatterns: ["src/typings"], |
| 57 | + options: { |
| 58 | + typeAware: true, |
| 59 | + typeCheck: true, |
| 60 | + }, |
| 61 | + env: { |
| 62 | + node: true, |
| 63 | + }, |
| 64 | + plugins: [ |
| 65 | + "eslint", |
| 66 | + "typescript", |
| 67 | + "unicorn", |
| 68 | + "oxc", |
| 69 | + "import", |
| 70 | + "node", |
| 71 | + "promise", |
| 72 | + ], |
| 73 | + categories: { |
| 74 | + correctness: "warn", |
| 75 | + suspicious: "warn", |
| 76 | + pedantic: "warn", |
| 77 | + perf: "warn", |
| 78 | + style: "warn", |
| 79 | + restriction: "warn", |
| 80 | + nursery: "warn", |
| 81 | + }, |
| 82 | + |
| 83 | + rules: { |
| 84 | + ...Object.fromEntries(disabledRules.map((r) => [r, "off"])), |
| 85 | + "eslint/no-duplicate-imports": [ |
| 86 | + "warn", |
| 87 | + { |
| 88 | + allowSeparateTypeImports: true, |
| 89 | + }, |
| 90 | + ], |
| 91 | + "eslint/no-restricted-imports": [ |
| 92 | + "warn", |
| 93 | + { |
| 94 | + paths: [ |
| 95 | + { |
| 96 | + name: "node:assert", |
| 97 | + message: "Use node:assert/strict instead", |
| 98 | + }, |
| 99 | + ], |
| 100 | + }, |
| 101 | + ], |
| 102 | + "eslint/no-unused-vars": [ |
| 103 | + "warn", |
| 104 | + { |
| 105 | + argsIgnorePattern: "^_", |
| 106 | + destructuredArrayIgnorePattern: "^_", |
| 107 | + }, |
| 108 | + ], |
| 109 | + "typescript/strict-boolean-expressions": [ |
| 110 | + "warn", |
| 111 | + { |
| 112 | + allowNullableBoolean: true, |
| 113 | + }, |
| 114 | + ], |
| 115 | + eqeqeq: [ |
| 116 | + "warn", |
| 117 | + "always", |
| 118 | + { |
| 119 | + null: "never", |
| 120 | + }, |
| 121 | + ], |
| 122 | + }, |
| 123 | +}); |
0 commit comments