-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoxlint.config.ts
More file actions
177 lines (165 loc) · 6.29 KB
/
Copy pathoxlint.config.ts
File metadata and controls
177 lines (165 loc) · 6.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
import { defineConfig } from "oxlint"
export default defineConfig({
options: {
typeAware: true,
typeCheck: true,
reportUnusedDisableDirectives: "error"
},
plugins: [
"eslint",
"typescript",
"unicorn",
"oxc",
"node",
"import",
"nextjs",
"react",
"react-perf",
"jsx-a11y",
"vitest",
"jest",
"promise"
],
jsPlugins: [{ name: "local", specifier: "./tools/oxlint-rules/index.ts" }],
categories: {
correctness: "error"
},
ignorePatterns: ["**/next-env.d.ts", "**/migrations/**", "**/generated/**"],
overrides: [
{
// Test files & mocks: async mock factories must keep the async
// signature, and conditional expect is fine in helpers. biome
// tolerated these (no findings on its side).
files: [
"**/*.test.ts",
"**/*.test.tsx",
"**/__tests__/**",
"src/test/**"
],
rules: {
"typescript/no-unsafe-type-assertion": "off",
"require-await": "off",
"vitest/no-conditional-expect": "off",
"jest/no-conditional-expect": "off",
"typescript/require-array-sort-compare": "off"
}
},
{
files: ["src/env.ts", "src/instrumentation.ts"],
rules: { "node/no-process-env": "off" }
},
{
// biome useFilenamingConvention used strictCase:false to allow
// embedded acronyms (CDP, HTML). oxlint's unicorn/filename-case
// has no strictCase / working `ignore`, so scope it off for the
// acronym-bearing files the project intentionally uses.
files: ["**/CDP/**", "**/contentHTML.tsx"],
rules: { "unicorn/filename-case": "off" }
},
{
// locationPicker is a hand-rolled ARIA 1.2 combobox: the
// combobox/listbox/option roles are required by the pattern and
// have no plain-tag equivalent, so prefer-tag-over-role is a
// false positive here.
files: ["**/location/locationPicker.tsx"],
rules: { "jsx-a11y/prefer-tag-over-role": "off" }
}
],
rules: {
// a11y
"jsx-a11y/no-noninteractive-element-interactions": "error",
"jsx-a11y/no-static-element-interactions": "warn",
// correctness
// biome's noUnusedVariables ignores leading-underscore names; mirror
// that so `catch (_error)` / unused `_args` are not flagged.
"no-unused-vars": [
"error",
{
caughtErrorsIgnorePattern: "^_",
argsIgnorePattern: "^_",
varsIgnorePattern: "^_"
}
],
"react/jsx-key": "error",
"react/no-children-prop": "off",
// correctness-category rules with no biome counterpart — silenced so
// the result mirrors biome's clean output instead of adding noise.
"vitest/require-mock-type-parameters": "off",
"typescript/no-base-to-string": "off",
"jsx-a11y/control-has-associated-label": "off",
"jsx-a11y/prefer-tag-over-role": "warn",
"jsx-a11y/interactive-supports-focus": "warn",
"jsx-a11y/role-has-required-aria-props": "warn",
"jsx-a11y/no-autofocus": "warn",
"react-hooks/exhaustive-deps": "warn",
// complexity
"unicorn/no-array-for-each": "error",
"no-useless-concat": "error",
// nursery
"typescript/no-floating-promises": "off",
// performance
"oxc/no-barrel-file": ["error", { threshold: 10 }],
"nextjs/no-img-element": "warn",
"nextjs/no-unwanted-polyfillio": "warn",
"nextjs/google-font-preconnect": "warn",
"no-await-in-loop": "warn",
// style
"typescript/no-require-imports": "error",
"typescript/no-inferrable-types": "error",
"typescript/no-namespace": "error",
"no-negated-condition": "error",
"node/no-process-env": "error",
"typescript/prefer-as-const": "error",
"unicorn/prefer-at": "error",
"no-lonely-if": "error",
"typescript/array-type": "error",
"react/jsx-curly-brace-presence": "error",
"prefer-const": "error",
"default-param-last": "error",
"unicorn/explicit-length-check": "error",
"typescript/consistent-type-exports": "error",
"typescript/consistent-type-imports": "error",
"unicorn/filename-case": [
"error",
{
cases: {
camelCase: true,
pascalCase: true,
kebabCase: true
}
}
],
"react/jsx-fragments": "error",
"nextjs/no-head-element": "warn",
"unicorn/prefer-node-protocol": "error",
"unicorn/prefer-number-properties": "error",
"operator-assignment": "error",
"typescript/prefer-function-type": "error",
"unicorn/throw-new-error": "error",
"typescript/only-throw-error": "error",
"local/no-try-catch": "error",
"local/require-server-action-wrapper": "error",
// Flags non-discriminated action results (optional `success?`/`error?`).
// Kept "off" until the actions are migrated to discriminated unions
// (TODO.md #3); the follow-up PR flips this to "error" to enforce it.
"local/no-optional-result": "off",
// Further CLAUDE.md conventions kept "off" until opted in.
"local/no-console-in-actions": "off",
"local/require-action-name-matches": "error",
"local/prefer-safe-parse": "error",
"local/no-unwrapped-throwing-builtin": "off",
// suspicious
"vitest/no-duplicate-hooks": "error",
"no-empty": "error",
"jest/no-export": "error",
"no-var": "error",
"require-await": "error",
"guard-for-in": "error",
"nextjs/no-document-import-in-page": "error",
"nextjs/no-head-import-in-document": "error",
"nextjs/google-font-display": "warn",
"array-callback-return": "error",
"typescript/ban-ts-comment": "error",
"unicorn/no-document-cookie": "error"
}
})