|
| 1 | +{ |
| 2 | + "$schema": "./node_modules/oxlint/configuration_schema.json", |
| 3 | + "plugins": [ |
| 4 | + "oxc", |
| 5 | + "typescript", |
| 6 | + "promise", |
| 7 | + "unicorn", |
| 8 | + "import", |
| 9 | + "jsdoc", |
| 10 | + "vitest" |
| 11 | + ], |
| 12 | + "categories": { |
| 13 | + "correctness": "error", |
| 14 | + "suspicious": "error", |
| 15 | + "pedantic": "error", |
| 16 | + "perf": "error", |
| 17 | + "style": "warn" |
| 18 | + }, |
| 19 | + "env": { |
| 20 | + "builtin": true |
| 21 | + }, |
| 22 | + // 有 bug,只能使用 .eslintignore 来禁用,暂时注释 |
| 23 | + // "ignorePatterns": [ |
| 24 | + // "**/dist/**", |
| 25 | + // "**/public/**", |
| 26 | + // "**/dev-dist/**", |
| 27 | + // "*.user.js" |
| 28 | + // ], |
| 29 | + "rules": { |
| 30 | + // 目前不支持跳过 return new Promise 的,只能暂时关掉 |
| 31 | + "require-await": "off", |
| 32 | + |
| 33 | + // 和 eslint 冲突的 |
| 34 | + "no-duplicate-imports": "off", |
| 35 | + |
| 36 | + // 新增的 |
| 37 | + "curly": "off", |
| 38 | + "id-length": "off", |
| 39 | + "promise/avoid-new": "off", |
| 40 | + "init-declarations": "off", |
| 41 | + "func-names": ["error", "as-needed"], |
| 42 | + "yoda": ["error", { "always": true }], |
| 43 | + "new-cap": ["error", { "capIsNew": false }], |
| 44 | + |
| 45 | + "max-lines": "off", |
| 46 | + "max-depth": "off", |
| 47 | + "max-params": "off", |
| 48 | + "max-classes-per-file": "off", |
| 49 | + "max-lines-per-function": "off", |
| 50 | + |
| 51 | + "no-ternary": "off", |
| 52 | + "no-debugger": "off", |
| 53 | + "no-continue": "off", |
| 54 | + "no-script-url": "off", |
| 55 | + "no-magic-numbers": "off", |
| 56 | + "no-await-in-loop": "off", |
| 57 | + "no-console": ["warn", { "allow": ["warn", "error"] }], |
| 58 | + "no-unused-vars": ["warn", { "args": "all", "argsIgnorePattern": "^_" }], |
| 59 | + |
| 60 | + "sort-keys": "off", |
| 61 | + "sort-vars": "off", |
| 62 | + "sort-imports": "off", |
| 63 | + |
| 64 | + "import/extensions": "off", |
| 65 | + "import/consistent-type-specifier-style": "off", |
| 66 | + "import/exports-last": "off", |
| 67 | + "import/group-exports": "off", |
| 68 | + "import/prefer-default-export": "off", |
| 69 | + "import/max-dependencies": "off", |
| 70 | + "import/no-namespace": "off", |
| 71 | + "import/no-unassigned-import": "off", |
| 72 | + "import/no-anonymous-default-export": "off", |
| 73 | + "import/no-named-as-default": "off", |
| 74 | + |
| 75 | + "jsdoc/require-param": "off", |
| 76 | + "jsdoc/require-returns": "off", |
| 77 | + "jsdoc/require-param-type": "off", |
| 78 | + "jsdoc/require-returns-type": "off", |
| 79 | + "jsdoc/check-tag-names": "off", |
| 80 | + |
| 81 | + "unicorn/consistent-function-scoping": "off", |
| 82 | + "unicorn/filename-case": "off", |
| 83 | + "unicorn/switch-case-braces": "off", |
| 84 | + "unicorn/prefer-query-selector": "off", |
| 85 | + "unicorn/prefer-global-this": "off", |
| 86 | + "unicorn/prefer-add-event-listener": "off", |
| 87 | + "unicorn/no-null": "off", |
| 88 | + "unicorn/no-useless-undefined": "off", |
| 89 | + "unicorn/no-anonymous-default-export": "off", |
| 90 | + "unicorn/no-unreadable-array-destructuring": "off", |
| 91 | + "unicorn/no-negation-in-equality-check": "off", |
| 92 | + |
| 93 | + "typescript/consistent-indexed-object-style": "error", |
| 94 | + "typescript/prefer-as-const": "error", |
| 95 | + "typescript/consistent-type-definitions": ["warn", "type"], |
| 96 | + "typescript/consistent-type-imports": [ |
| 97 | + "error", |
| 98 | + { "disallowTypeAnnotations": false } |
| 99 | + ], |
| 100 | + |
| 101 | + "promise/prefer-await-to-callbacks": "off", |
| 102 | + "promise/prefer-await-to-then": "off", |
| 103 | + |
| 104 | + "jest/require-hook": "off", |
| 105 | + "jest/prefer-lowercase-title": "off", |
| 106 | + "jest/require-top-level-describe": "off", |
| 107 | + "jest/no-hooks": "off", |
| 108 | + "jest/no-standalone-expect": "off", |
| 109 | + "jest/no-conditional-in-test": "off", |
| 110 | + "jest/consistent-test-it": [ |
| 111 | + "error", |
| 112 | + { "fn": "it", "withinDescribe": "it" } |
| 113 | + ], |
| 114 | + |
| 115 | + "no-restricted-imports": [ |
| 116 | + "warn", |
| 117 | + { |
| 118 | + "patterns": [ |
| 119 | + { |
| 120 | + "group": ["helper/**/*", "!helper/languages"], |
| 121 | + "message": "只能直接通过 helper 导入" |
| 122 | + }, |
| 123 | + { |
| 124 | + "group": ["**/request", "!request"], |
| 125 | + "message": "必须直接导入" |
| 126 | + } |
| 127 | + ] |
| 128 | + } |
| 129 | + ] |
| 130 | + }, |
| 131 | + "overrides": [ |
| 132 | + { |
| 133 | + "files": ["src/site/**/*"], |
| 134 | + "rules": { |
| 135 | + "no-restricted-imports": [ |
| 136 | + "warn", |
| 137 | + { |
| 138 | + "patterns": [ |
| 139 | + { |
| 140 | + "group": [ |
| 141 | + "*/**/*", |
| 142 | + "!solid-js/**/*", |
| 143 | + "!components/**/*", |
| 144 | + "!userscript/**/*", |
| 145 | + "!@material*/**/*", |
| 146 | + "../**/*", |
| 147 | + "!.*/**/*" |
| 148 | + ], |
| 149 | + "message": "只能通过 main 导入" |
| 150 | + } |
| 151 | + ] |
| 152 | + } |
| 153 | + ] |
| 154 | + } |
| 155 | + } |
| 156 | + ] |
| 157 | +} |
0 commit comments