-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy path.oxlintrc.jsonc
More file actions
181 lines (181 loc) · 5.25 KB
/
Copy path.oxlintrc.jsonc
File metadata and controls
181 lines (181 loc) · 5.25 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
178
179
180
181
{
"$schema": "https://raw.githubusercontent.com/oxc-project/oxc/main/npm/oxlint/configuration_schema.json",
// Enable TypeScript, Unicorn, Oxc, Node, JSDoc, and Import plugins
"plugins": ["typescript", "unicorn", "oxc", "node", "jsdoc", "import"],
// Environment settings
"env": {
"builtin": true,
"es2024": true,
"node": true,
},
// Ignore patterns
"ignorePatterns": [
"dist",
"node_modules",
".claude",
"tmp",
"*.log",
"/nix/store/**",
"CHANGELOG.md",
],
// Rule categories - strict base configuration
// - correctness (196 rules): Catch definite bugs and errors
// - suspicious (47 rules): Flag potentially problematic patterns
// - pedantic (106 rules): Stricter code quality checks (includes no-throw-literal, require-await, ban-ts-comment, etc.)
// - perf (11 rules): Performance-related issues
// - style (168 rules): Code style rules
// Note: restriction category should be enabled per-rule basis
"categories": {
"correctness": "error",
"suspicious": "error",
"pedantic": "error",
"perf": "error",
"style": "error",
},
"rules": {
// ===================
// Restriction Rules (not in categories, must be explicit)
// ===================
// Disallow console usage in production code
"no-console": "error",
// Disallow empty blocks
"no-empty": "error",
// Disallow empty functions
"no-empty-function": "error",
// Disallow reassigning function parameters
"no-param-reassign": "error",
// ===================
// Override category defaults with custom options
// ===================
// Unused variables - allow underscore prefix for intentional unused
"no-unused-vars": [
"error",
{
"vars": "all",
"varsIgnorePattern": "^_",
"args": "after-used",
"argsIgnorePattern": "^_",
},
],
// Limit cyclomatic complexity (not in any category)
"complexity": [
"error",
{
"max": 7,
},
],
// ===================
// TypeScript Rules
// ===================
// Unused variables (TypeScript version) - allow underscore prefix
"typescript/no-unused-vars": [
"error",
{
"vars": "all",
"varsIgnorePattern": "^_",
"args": "after-used",
"argsIgnorePattern": "^_",
},
],
// Disallow explicit `any` usage (restriction category)
"typescript/no-explicit-any": "error",
// Disallow floating promises - must handle or void
"typescript/no-floating-promises": "error",
// Error on awaiting non-thenable values
"typescript/await-thenable": "error",
// Enforce `import type` with inline style
"typescript/consistent-type-imports": [
"error",
{
"prefer": "type-imports",
"disallowTypeAnnotations": false,
"fixStyle": "inline-type-imports",
},
],
// Disallow unnecessary type arguments
"typescript/no-unnecessary-type-arguments": "error",
// Enforce strict boolean expressions - no implicit coercion
// Requires --type-aware flag
"typescript/strict-boolean-expressions": [
"error",
{
"allowNullableBoolean": false,
"allowNullableObject": false,
"allowString": false,
"allowNumber": false,
},
],
// Disallow classes with only static members
"typescript/no-extraneous-class": "error",
// Ban @ts-ignore, allow @ts-expect-error with description (override pedantic default)
"typescript/ban-ts-comment": [
"error",
{
"ts-ignore": true,
"ts-expect-error": "allow-with-description",
},
],
// ===================
// Node.js Rules
// ===================
// Disallow direct assignment to exports
"node/no-exports-assign": "error",
// Disallow new require calls
"node/no-new-require": "error",
// ===================
// JSDoc Rules
// ===================
"jsdoc/check-access": "warn",
"jsdoc/check-property-names": "warn",
"jsdoc/empty-tags": "warn",
"jsdoc/implements-on-classes": "warn",
"jsdoc/no-defaults": "warn",
"jsdoc/require-param-name": "warn",
"jsdoc/require-property": "warn",
"jsdoc/require-property-description": "warn",
"jsdoc/require-property-name": "warn",
"jsdoc/require-returns-description": "warn",
// ===================
// Import Rules
// ===================
// Enforce top-level type specifier style
"import/consistent-type-specifier-style": ["error", "top-level"],
// ===================
// Unicorn Rules
// ===================
// Disable top-level await in src (library code should not use top-level await)
"unicorn/prefer-top-level-await": "off",
// Ensure imports are at the top
"import/first": "error",
// Disallow duplicate imports
"import/no-duplicates": "error",
// Disallow mutable exports
"import/no-mutable-exports": "error",
// Disallow named default exports
"import/no-named-default": "error",
// ===================
// Style Rules
// ===================
// Enforce consistent brace style for all control statements
"curly": ["error", "all"],
},
"overrides": [
{
// Relaxed rules for test files
"files": ["**/*.test.ts", "**/*.spec.ts", "tests/**/*.ts", "src/tests/**/*.ts"],
"rules": {
"no-console": "off",
"typescript/no-explicit-any": "warn",
"typescript/no-floating-promises": "warn",
},
},
{
// Examples should use top-level await for cleaner code
"files": ["examples/**/*.ts"],
"rules": {
"no-console": "off",
"unicorn/prefer-top-level-await": "error",
},
},
],
}