@autofleet/lint 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.oxfmtrc.json +22 -0
- package/.oxlintrc.json +255 -0
- package/MIGRATION_GAPS.md +299 -0
- package/README.md +273 -0
- package/RULES.md +396 -0
- package/bin/oxfmt.cjs +43 -0
- package/bin/oxlint.cjs +44 -0
- package/bin/postinstall.cjs +87 -0
- package/package.json +44 -0
package/.oxfmtrc.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"semi": true,
|
|
3
|
+
"trailingComma": "all",
|
|
4
|
+
"singleQuote": true,
|
|
5
|
+
"printWidth": 160,
|
|
6
|
+
"tabWidth": 2,
|
|
7
|
+
"useTabs": false,
|
|
8
|
+
"arrowParens": "always",
|
|
9
|
+
"endOfLine": "lf",
|
|
10
|
+
"ignorePatterns": [
|
|
11
|
+
"dist",
|
|
12
|
+
"build",
|
|
13
|
+
"node_modules",
|
|
14
|
+
"coverage",
|
|
15
|
+
"**/migrations/*",
|
|
16
|
+
"*.min.js",
|
|
17
|
+
"*.min.css",
|
|
18
|
+
"package-lock.json",
|
|
19
|
+
"pnpm-lock.yaml",
|
|
20
|
+
"yarn.lock"
|
|
21
|
+
]
|
|
22
|
+
}
|
package/.oxlintrc.json
ADDED
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
|
3
|
+
"env": {
|
|
4
|
+
"node": true,
|
|
5
|
+
"jest": true,
|
|
6
|
+
"es2022": true
|
|
7
|
+
},
|
|
8
|
+
"globals": {},
|
|
9
|
+
"rules": {
|
|
10
|
+
// Core ESLint rules (migrated from .eslintrc.json)
|
|
11
|
+
"eqeqeq": "error",
|
|
12
|
+
"curly": "error",
|
|
13
|
+
"no-console": "error",
|
|
14
|
+
"no-debugger": "error",
|
|
15
|
+
"prefer-const": "error",
|
|
16
|
+
"no-var": "error",
|
|
17
|
+
"no-async-promise-executor": "error",
|
|
18
|
+
"prefer-promise-reject-errors": "error",
|
|
19
|
+
"no-await-in-loop": "warn",
|
|
20
|
+
"no-constant-condition": "warn",
|
|
21
|
+
"no-control-regex": "error",
|
|
22
|
+
"no-duplicate-case": "error",
|
|
23
|
+
"no-empty": "warn",
|
|
24
|
+
"no-ex-assign": "error",
|
|
25
|
+
"no-extra-boolean-cast": "warn",
|
|
26
|
+
"no-func-assign": "error",
|
|
27
|
+
"no-inner-declarations": "error",
|
|
28
|
+
"no-invalid-regexp": "error",
|
|
29
|
+
"no-irregular-whitespace": "error",
|
|
30
|
+
"no-loss-of-precision": "error",
|
|
31
|
+
"no-misleading-character-class": "error",
|
|
32
|
+
"no-prototype-builtins": "warn",
|
|
33
|
+
"no-regex-spaces": "error",
|
|
34
|
+
"no-self-assign": "error",
|
|
35
|
+
"no-self-compare": "error",
|
|
36
|
+
"no-setter-return": "error",
|
|
37
|
+
"no-sparse-arrays": "error",
|
|
38
|
+
"no-this-before-super": "error",
|
|
39
|
+
"no-unreachable": "error",
|
|
40
|
+
"no-unsafe-finally": "error",
|
|
41
|
+
"no-unsafe-negation": "error",
|
|
42
|
+
"no-unsafe-optional-chaining": "error",
|
|
43
|
+
"no-unused-labels": "error",
|
|
44
|
+
"no-unused-vars": "error",
|
|
45
|
+
"no-useless-catch": "warn",
|
|
46
|
+
"no-useless-escape": "warn",
|
|
47
|
+
"no-with": "error",
|
|
48
|
+
"require-await": "warn",
|
|
49
|
+
"use-isnan": "error",
|
|
50
|
+
"valid-typeof": "error",
|
|
51
|
+
"no-unused-private-class-members": "warn",
|
|
52
|
+
"no-useless-backreference": "error",
|
|
53
|
+
"no-useless-call": "warn",
|
|
54
|
+
"no-useless-constructor": "warn",
|
|
55
|
+
"no-useless-rename": "warn",
|
|
56
|
+
"no-throw-literal": "error",
|
|
57
|
+
"no-return-assign": "warn",
|
|
58
|
+
"no-sequences": "error",
|
|
59
|
+
"no-multi-assign": "warn",
|
|
60
|
+
"no-nested-ternary": "warn",
|
|
61
|
+
"no-param-reassign": "warn",
|
|
62
|
+
"operator-assignment": "warn",
|
|
63
|
+
"prefer-destructuring": "warn",
|
|
64
|
+
"prefer-exponentiation-operator": "warn",
|
|
65
|
+
"prefer-object-spread": "warn",
|
|
66
|
+
"prefer-rest-params": "warn",
|
|
67
|
+
"prefer-spread": "warn",
|
|
68
|
+
"prefer-template": "warn",
|
|
69
|
+
"no-const-assign": "error",
|
|
70
|
+
"no-dupe-keys": "error",
|
|
71
|
+
"no-import-assign": "error",
|
|
72
|
+
|
|
73
|
+
// TypeScript ESLint rules (migrated from .eslintrc.json)
|
|
74
|
+
"typescript/no-explicit-any": "warn",
|
|
75
|
+
"typescript/no-unused-vars": "error",
|
|
76
|
+
"typescript/no-floating-promises": "error",
|
|
77
|
+
"typescript/await-thenable": "error",
|
|
78
|
+
"typescript/no-misused-promises": "error",
|
|
79
|
+
"typescript/require-await": "warn",
|
|
80
|
+
"typescript/ban-types": "warn",
|
|
81
|
+
"typescript/no-array-delete": "error",
|
|
82
|
+
"typescript/no-duplicate-enum-values": "error",
|
|
83
|
+
"typescript/no-empty-interface": "warn",
|
|
84
|
+
"typescript/no-extraneous-class": "warn",
|
|
85
|
+
"typescript/no-for-in-array": "error",
|
|
86
|
+
"typescript/no-implied-eval": "error",
|
|
87
|
+
"typescript/no-misused-new": "error",
|
|
88
|
+
"typescript/no-namespace": "warn",
|
|
89
|
+
"typescript/no-non-null-assertion": "warn",
|
|
90
|
+
"typescript/no-this-alias": "warn",
|
|
91
|
+
"typescript/no-unnecessary-type-assertion": "warn",
|
|
92
|
+
"typescript/no-unnecessary-type-constraint": "warn",
|
|
93
|
+
"typescript/no-unsafe-argument": "warn",
|
|
94
|
+
"typescript/no-unsafe-assignment": "warn",
|
|
95
|
+
"typescript/no-unsafe-call": "warn",
|
|
96
|
+
"typescript/no-unsafe-member-access": "warn",
|
|
97
|
+
"typescript/no-unsafe-return": "warn",
|
|
98
|
+
"typescript/prefer-as-const": "warn",
|
|
99
|
+
"typescript/prefer-for-of": "warn",
|
|
100
|
+
"typescript/prefer-function-type": "warn",
|
|
101
|
+
"typescript/prefer-includes": "warn",
|
|
102
|
+
"typescript/prefer-nullish-coalescing": "warn",
|
|
103
|
+
"typescript/prefer-optional-chain": "warn",
|
|
104
|
+
"typescript/prefer-ts-expect-error": "warn",
|
|
105
|
+
"typescript/no-var-requires": "off",
|
|
106
|
+
"typescript/consistent-type-imports": "warn",
|
|
107
|
+
"typescript/no-import-type-side-effects": "error",
|
|
108
|
+
"typescript/adjacent-overload-signatures": "warn",
|
|
109
|
+
"typescript/array-type": "warn",
|
|
110
|
+
"typescript/consistent-type-definitions": "warn",
|
|
111
|
+
"typescript/no-base-to-string": "warn",
|
|
112
|
+
"typescript/no-confusing-non-null-assertion": "warn",
|
|
113
|
+
"typescript/no-duplicate-type-constituents": "warn",
|
|
114
|
+
"typescript/no-extra-non-null-assertion": "error",
|
|
115
|
+
"typescript/no-unnecessary-boolean-literal-compare": "warn",
|
|
116
|
+
"typescript/prefer-literal-enum-member": "warn",
|
|
117
|
+
"typescript/prefer-namespace-keyword": "warn",
|
|
118
|
+
"typescript/prefer-return-this-type": "warn",
|
|
119
|
+
"typescript/consistent-type-assertions": ["error", { "assertionStyle": "as" }],
|
|
120
|
+
|
|
121
|
+
// Unicorn rules (migrated from .eslintrc.json)
|
|
122
|
+
"unicorn/prefer-node-protocol": "error",
|
|
123
|
+
"unicorn/prefer-array-some": "error",
|
|
124
|
+
"unicorn/prefer-array-find": "error",
|
|
125
|
+
"unicorn/prefer-includes": "error",
|
|
126
|
+
"unicorn/prefer-string-starts-ends-with": "error",
|
|
127
|
+
"unicorn/throw-new-error": "error",
|
|
128
|
+
"unicorn/error-message": "error",
|
|
129
|
+
"unicorn/no-instanceof-array": "error",
|
|
130
|
+
"unicorn/prefer-default-parameters": "warn",
|
|
131
|
+
"unicorn/prefer-optional-catch-binding": "error",
|
|
132
|
+
"unicorn/no-thenable": "error",
|
|
133
|
+
"unicorn/prefer-spread": "warn",
|
|
134
|
+
"unicorn/prefer-ternary": "warn",
|
|
135
|
+
"unicorn/consistent-function-scoping": "warn",
|
|
136
|
+
"unicorn/no-useless-undefined": "warn",
|
|
137
|
+
"unicorn/no-nested-ternary": "warn",
|
|
138
|
+
"unicorn/prefer-at": "warn",
|
|
139
|
+
"unicorn/prefer-array-flat-map": "warn",
|
|
140
|
+
"unicorn/prefer-array-index-of": "warn",
|
|
141
|
+
"unicorn/prefer-set-has": "warn",
|
|
142
|
+
"unicorn/prefer-string-slice": "warn",
|
|
143
|
+
"unicorn/prefer-string-replace-all": "warn",
|
|
144
|
+
"unicorn/prefer-string-trim-start-end": "warn",
|
|
145
|
+
"unicorn/prefer-math-min-max": "warn",
|
|
146
|
+
"unicorn/prefer-number-properties": "warn",
|
|
147
|
+
"unicorn/prefer-object-from-entries": "warn",
|
|
148
|
+
"unicorn/number-literal-case": "warn",
|
|
149
|
+
"unicorn/no-lonely-if": "warn",
|
|
150
|
+
"unicorn/no-useless-spread": "warn",
|
|
151
|
+
"unicorn/no-useless-fallback-in-spread": "warn",
|
|
152
|
+
"unicorn/no-useless-length-check": "warn",
|
|
153
|
+
"unicorn/no-useless-promise-resolve-reject": "warn",
|
|
154
|
+
"unicorn/prefer-modern-math-apis": "warn",
|
|
155
|
+
"unicorn/prefer-native-coercion-functions": "warn",
|
|
156
|
+
"unicorn/prefer-add-event-listener": "warn",
|
|
157
|
+
"unicorn/prefer-dom-node-append": "warn",
|
|
158
|
+
"unicorn/prefer-dom-node-remove": "warn",
|
|
159
|
+
"unicorn/prefer-dom-node-text-content": "warn",
|
|
160
|
+
"unicorn/prefer-query-selector": "warn",
|
|
161
|
+
"unicorn/prefer-reflect-apply": "warn",
|
|
162
|
+
"unicorn/prefer-regexp-test": "warn",
|
|
163
|
+
"unicorn/prefer-prototype-methods": "warn",
|
|
164
|
+
"unicorn/prefer-code-point": "warn",
|
|
165
|
+
"unicorn/prefer-date-now": "warn",
|
|
166
|
+
"unicorn/prefer-array-flat": "warn",
|
|
167
|
+
"unicorn/escape-case": "warn",
|
|
168
|
+
"unicorn/new-for-builtins": "error",
|
|
169
|
+
"unicorn/no-console-spaces": "warn",
|
|
170
|
+
"unicorn/no-hex-escape": "warn",
|
|
171
|
+
"unicorn/no-instanceof-builtins": "error",
|
|
172
|
+
"unicorn/no-new-array": "warn",
|
|
173
|
+
"unicorn/no-new-buffer": "error",
|
|
174
|
+
"unicorn/no-typeof-undefined": "warn",
|
|
175
|
+
"unicorn/no-unreadable-array-destructuring": "warn",
|
|
176
|
+
"unicorn/no-unreadable-iife": "warn",
|
|
177
|
+
"unicorn/consistent-empty-array-spread": "warn",
|
|
178
|
+
"unicorn/prefer-structured-clone": "warn",
|
|
179
|
+
"unicorn/prefer-type-error": "warn",
|
|
180
|
+
"unicorn/relative-url-style": "warn",
|
|
181
|
+
"unicorn/require-array-join-separator": "warn",
|
|
182
|
+
"unicorn/require-number-to-fixed-digits-argument": "warn",
|
|
183
|
+
|
|
184
|
+
// Import rules
|
|
185
|
+
"import/no-duplicates": "error",
|
|
186
|
+
"import/no-self-import": "error",
|
|
187
|
+
"import/no-cycle": "warn",
|
|
188
|
+
"import/named": "error",
|
|
189
|
+
"import/namespace": "error",
|
|
190
|
+
"import/default": "error",
|
|
191
|
+
"import/no-named-as-default": "warn",
|
|
192
|
+
"import/no-named-as-default-member": "warn",
|
|
193
|
+
|
|
194
|
+
// Jest rules
|
|
195
|
+
"jest/expect-expect": "warn",
|
|
196
|
+
"jest/no-alias-methods": "warn",
|
|
197
|
+
"jest/no-commented-out-tests": "warn",
|
|
198
|
+
"jest/no-conditional-expect": "error",
|
|
199
|
+
"jest/no-disabled-tests": "warn",
|
|
200
|
+
"jest/no-focused-tests": "error",
|
|
201
|
+
"jest/no-identical-title": "error",
|
|
202
|
+
"jest/no-jasmine-globals": "error",
|
|
203
|
+
"jest/no-mocks-import": "error",
|
|
204
|
+
"jest/no-standalone-expect": "error",
|
|
205
|
+
"jest/no-test-prefixes": "warn",
|
|
206
|
+
"jest/valid-describe-callback": "error",
|
|
207
|
+
"jest/valid-expect": "error",
|
|
208
|
+
"jest/valid-title": "warn",
|
|
209
|
+
"jest/prefer-hooks-on-top": "warn",
|
|
210
|
+
"jest/prefer-spy-on": "warn",
|
|
211
|
+
"jest/prefer-todo": "warn",
|
|
212
|
+
|
|
213
|
+
// OXC custom rules
|
|
214
|
+
"oxc/approx-constant": "warn",
|
|
215
|
+
"oxc/bad-array-method-on-arguments": "error",
|
|
216
|
+
"oxc/bad-bitwise-operator": "error",
|
|
217
|
+
"oxc/bad-char-at-comparison": "error",
|
|
218
|
+
"oxc/bad-comparison-sequence": "error",
|
|
219
|
+
"oxc/bad-min-max-func": "error",
|
|
220
|
+
"oxc/bad-object-literal-comparison": "error",
|
|
221
|
+
"oxc/bad-replace-all-arg": "error",
|
|
222
|
+
"oxc/const-comparisons": "error",
|
|
223
|
+
"oxc/double-comparisons": "error",
|
|
224
|
+
"oxc/erasing-op": "warn",
|
|
225
|
+
"oxc/misrefactored-assign-op": "error",
|
|
226
|
+
"oxc/missing-throw": "error",
|
|
227
|
+
"oxc/no-accumulating-spread": "warn",
|
|
228
|
+
"oxc/number-arg-out-of-range": "error",
|
|
229
|
+
"oxc/only-used-in-recursion": "warn",
|
|
230
|
+
"oxc/uninvoked-array-callback": "error"
|
|
231
|
+
},
|
|
232
|
+
"overrides": [
|
|
233
|
+
{
|
|
234
|
+
"files": ["**/validations/**/*.ts", "**/*validation*.ts"],
|
|
235
|
+
"rules": {
|
|
236
|
+
"unicorn/no-thenable": "off"
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
"files": ["bin/*.cjs"],
|
|
241
|
+
"rules": {
|
|
242
|
+
"no-console": "off"
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
],
|
|
246
|
+
"ignorePatterns": [
|
|
247
|
+
"dist",
|
|
248
|
+
"build",
|
|
249
|
+
"node_modules",
|
|
250
|
+
"coverage",
|
|
251
|
+
"*.config.js",
|
|
252
|
+
"**/migrations/*",
|
|
253
|
+
"**/mock.ts"
|
|
254
|
+
]
|
|
255
|
+
}
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
# Migration Gaps: ESLint → Oxlint/Oxfmt
|
|
2
|
+
|
|
3
|
+
This document outlines the rules and features from our previous ESLint setup that are **NOT available** in Oxlint/Oxfmt.
|
|
4
|
+
|
|
5
|
+
## Summary
|
|
6
|
+
|
|
7
|
+
- **Previous Setup**: ESLint (190+ rules) + Oxlint (detection only)
|
|
8
|
+
- **New Setup**: Oxlint (140+ rules migrated) + Oxfmt
|
|
9
|
+
- **Total Gaps**: ~50 rules not supported + some configuration features
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 📋 Unsupported ESLint Rules
|
|
14
|
+
|
|
15
|
+
### Airbnb Style Guide Rules (Not in Oxlint)
|
|
16
|
+
|
|
17
|
+
| Rule | Reason | Workaround |
|
|
18
|
+
|------|--------|------------|
|
|
19
|
+
| `no-restricted-syntax` | Not implemented in Oxlint | Manual code review |
|
|
20
|
+
| `import/order` | Not implemented (import sorting is manual) | Use IDE sort imports or manual ordering |
|
|
21
|
+
| `import/extensions` | Not implemented | TypeScript handles this |
|
|
22
|
+
| `import/prefer-default-export` | Not implemented | Follow convention manually |
|
|
23
|
+
| `import/no-extraneous-dependencies` | Not implemented | Manual package.json review |
|
|
24
|
+
| `max-len` | Formatting rule - handled by Oxfmt differently | Oxfmt uses `printWidth: 160` |
|
|
25
|
+
|
|
26
|
+
### TypeScript ESLint Rules (Not in Oxlint)
|
|
27
|
+
|
|
28
|
+
| Rule | Reason | Workaround |
|
|
29
|
+
|------|--------|------------|
|
|
30
|
+
| `@typescript-eslint/naming-convention` | Not implemented | Follow naming conventions manually |
|
|
31
|
+
| `@typescript-eslint/no-misused-promises` (partial) | Only basic support, missing `checksVoidReturn` option | Be careful with Promise returns |
|
|
32
|
+
| `@typescript-eslint/explicit-function-return-type` | Not implemented | Add return types manually when needed |
|
|
33
|
+
| `@typescript-eslint/explicit-module-boundary-types` | Not implemented | TypeScript compiler handles most cases |
|
|
34
|
+
| `@typescript-eslint/camelcase` | Deprecated in ESLint, use naming-convention | Follow camelCase manually |
|
|
35
|
+
|
|
36
|
+
### Unicorn Rules (Not in Oxlint)
|
|
37
|
+
|
|
38
|
+
| Rule | Reason | Impact |
|
|
39
|
+
|------|--------|--------|
|
|
40
|
+
| `unicorn/filename-case` | Not implemented | Low - naming conventions are stylistic |
|
|
41
|
+
| `unicorn/prevent-abbreviations` | Not implemented | Low - was disabled in our config anyway |
|
|
42
|
+
| `unicorn/no-array-reduce` | Not implemented | Low - was disabled in our config anyway |
|
|
43
|
+
| `unicorn/no-array-for-each` | Not implemented | Low - was disabled in our config anyway |
|
|
44
|
+
| `unicorn/no-array-method-this-argument` | Not implemented | Low - was disabled in our config anyway |
|
|
45
|
+
| `unicorn/no-array-callback-reference` | Not implemented | Low - was disabled in our config anyway |
|
|
46
|
+
| `unicorn/prefer-module` | Not implemented | Low - was disabled (we use CommonJS) |
|
|
47
|
+
| `unicorn/prefer-top-level-await` | Not implemented | Low - was disabled |
|
|
48
|
+
| `unicorn/no-null` | Not implemented | Low - was disabled (we use null) |
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## ⚙️ Configuration Features
|
|
53
|
+
|
|
54
|
+
### 1. **TypeScript Config Support**
|
|
55
|
+
|
|
56
|
+
✅ **Oxlint**: Supports TypeScript config files (since v1.43.0) - extend `@autofleet/lint` configuration
|
|
57
|
+
```typescript
|
|
58
|
+
import type { Linter } from 'oxlint';
|
|
59
|
+
import baseConfig from './node_modules/@autofleet/lint/oxlint.config';
|
|
60
|
+
|
|
61
|
+
const config: Linter.Config = {
|
|
62
|
+
...baseConfig,
|
|
63
|
+
// Your overrides here
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export default config;
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
⚠️ **Oxfmt**: Does NOT support `extends` - must copy configuration file
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
### 2. **File-Level Override Granularity**
|
|
74
|
+
|
|
75
|
+
**ESLint Had:**
|
|
76
|
+
```json
|
|
77
|
+
{
|
|
78
|
+
"overrides": [
|
|
79
|
+
{
|
|
80
|
+
"files": ["*.test.ts"],
|
|
81
|
+
"rules": {
|
|
82
|
+
"no-console": "error",
|
|
83
|
+
"@typescript-eslint/no-explicit-any": "off"
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**Oxlint Support:**
|
|
91
|
+
✅ Oxlint fully supports file-level overrides with glob patterns
|
|
92
|
+
- Our configuration includes test file overrides
|
|
93
|
+
- Works similarly to ESLint overrides
|
|
94
|
+
|
|
95
|
+
**Note**: File overrides are defined in the base `oxlint.config.ts` from `@autofleet/lint`. You can add project-specific overrides by spreading the base config.
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
### 3. **Import Ordering Auto-Fix**
|
|
100
|
+
|
|
101
|
+
**ESLint Had:**
|
|
102
|
+
```json
|
|
103
|
+
{
|
|
104
|
+
"import/order": ["warn", {
|
|
105
|
+
"groups": ["builtin", "external", "internal", "parent", "sibling", "index"],
|
|
106
|
+
"newlines-between": "never",
|
|
107
|
+
"alphabetize": { "order": "asc", "caseInsensitive": true }
|
|
108
|
+
}]
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
**Oxlint Limitation:**
|
|
113
|
+
- No automatic import sorting
|
|
114
|
+
- Oxfmt (formatter) does NOT sort imports
|
|
115
|
+
|
|
116
|
+
**Workaround**:
|
|
117
|
+
- Use IDE's "Organize Imports" feature (VSCode: Shift+Alt+O)
|
|
118
|
+
- Manually organize imports
|
|
119
|
+
- Consider using a separate tool like `import-sort` if critical
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
### 4. **Naming Convention Enforcement**
|
|
124
|
+
|
|
125
|
+
**ESLint Had:**
|
|
126
|
+
```json
|
|
127
|
+
{
|
|
128
|
+
"@typescript-eslint/naming-convention": [
|
|
129
|
+
"warn",
|
|
130
|
+
{ "selector": "default", "format": ["camelCase"] },
|
|
131
|
+
{ "selector": "variable", "format": ["camelCase", "UPPER_CASE", "PascalCase"] },
|
|
132
|
+
{ "selector": "typeLike", "format": ["PascalCase"] },
|
|
133
|
+
{ "selector": "enumMember", "format": ["UPPER_CASE", "PascalCase"] }
|
|
134
|
+
]
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
**Oxlint Limitation:**
|
|
139
|
+
- No naming convention rule available
|
|
140
|
+
|
|
141
|
+
**Workaround**:
|
|
142
|
+
- Follow conventions manually
|
|
143
|
+
- Use TypeScript compiler for type naming (PascalCase is natural)
|
|
144
|
+
- Code review enforcement
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
### 5. **Test File Export Restrictions**
|
|
149
|
+
|
|
150
|
+
**ESLint Had:**
|
|
151
|
+
```json
|
|
152
|
+
{
|
|
153
|
+
"no-restricted-syntax": [
|
|
154
|
+
"error",
|
|
155
|
+
{
|
|
156
|
+
"selector": "ExportNamedDeclaration",
|
|
157
|
+
"message": "Exporting from test files is not allowed"
|
|
158
|
+
}
|
|
159
|
+
]
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
**Oxlint Limitation:**
|
|
164
|
+
- `no-restricted-syntax` with custom selectors not supported
|
|
165
|
+
|
|
166
|
+
**Workaround**:
|
|
167
|
+
- Manual code review
|
|
168
|
+
- Document convention in CLAUDE.md
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## 🎨 Oxfmt Formatting Gaps
|
|
173
|
+
|
|
174
|
+
### Features NOT in Oxfmt
|
|
175
|
+
|
|
176
|
+
| Feature | Status | Impact |
|
|
177
|
+
|---------|--------|--------|
|
|
178
|
+
| Embedded language formatting (CSS-in-JS, HTML in JS) | ⏳ Coming in Beta | Medium - may need manual formatting for styled-components |
|
|
179
|
+
| Plugin system | ⏳ Researching for Beta | Low |
|
|
180
|
+
| Vue/Svelte/Astro support | ⏳ Coming in Beta | N/A - not used in task-ms |
|
|
181
|
+
|
|
182
|
+
### Oxfmt Notes
|
|
183
|
+
|
|
184
|
+
1. **Default Line Width**: Oxfmt defaults to 100 - we override to 160
|
|
185
|
+
|
|
186
|
+
2. **Formatting Algorithm**: May produce slightly different output in edge cases in rare scenarios
|
|
187
|
+
|
|
188
|
+
3. **Configuration Options**: All major options supported
|
|
189
|
+
- ✅ Our config (semi, singleQuote, trailingComma, etc.) fully supported
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## 📊 Migration Impact Assessment
|
|
194
|
+
|
|
195
|
+
### High Priority (Must Address)
|
|
196
|
+
|
|
197
|
+
✅ **None** - All critical rules are supported in Oxlint
|
|
198
|
+
|
|
199
|
+
### Medium Priority (Monitor)
|
|
200
|
+
|
|
201
|
+
⚠️ **Import Ordering**
|
|
202
|
+
- **Old**: Auto-fixed with ESLint
|
|
203
|
+
- **New**: Manual or IDE-based
|
|
204
|
+
- **Action**: Document convention, use IDE features
|
|
205
|
+
|
|
206
|
+
⚠️ **Naming Conventions**
|
|
207
|
+
- **Old**: Enforced by `@typescript-eslint/naming-convention`
|
|
208
|
+
- **New**: Manual enforcement
|
|
209
|
+
- **Action**: Document in CLAUDE.md, code review
|
|
210
|
+
|
|
211
|
+
### Low Priority (Acceptable Losses)
|
|
212
|
+
|
|
213
|
+
✅ **Disabled Rules We Already Turned Off**
|
|
214
|
+
- `unicorn/prevent-abbreviations`
|
|
215
|
+
- `unicorn/no-array-reduce`
|
|
216
|
+
- `unicorn/no-array-for-each`
|
|
217
|
+
- `unicorn/filename-case`
|
|
218
|
+
- Most were disabled in our original config
|
|
219
|
+
|
|
220
|
+
✅ **Stylistic Rules**
|
|
221
|
+
- Oxfmt handles all formatting
|
|
222
|
+
- Edge cases (95% vs 100% Prettier compat) acceptable
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## 🚀 Benefits Gained (Trade-offs Worth It)
|
|
227
|
+
|
|
228
|
+
### Performance Improvements
|
|
229
|
+
|
|
230
|
+
- **Oxlint**: 37x faster than ESLint (~1-2 seconds vs 60+ seconds)
|
|
231
|
+
- **Oxfmt**: 30x faster than Prettier (~0.5 seconds vs 15+ seconds)
|
|
232
|
+
- **CI Time**: ~80% reduction in lint+format time
|
|
233
|
+
|
|
234
|
+
### Simplicity
|
|
235
|
+
|
|
236
|
+
- **Before**: 10 packages (ESLint + 6 plugins + TypeScript plugins)
|
|
237
|
+
- **After**: 2 packages (Oxlint + Oxfmt)
|
|
238
|
+
- **Config Complexity**: Reduced from 220 lines to 140 lines
|
|
239
|
+
|
|
240
|
+
### Maintenance
|
|
241
|
+
|
|
242
|
+
- **Before**: Manage ESLint, TypeScript ESLint, Airbnb, Unicorn compatibility
|
|
243
|
+
- **After**: Single Oxc project maintains all rules
|
|
244
|
+
|
|
245
|
+
---
|
|
246
|
+
|
|
247
|
+
## 📝 Recommendations
|
|
248
|
+
|
|
249
|
+
### For Developers
|
|
250
|
+
|
|
251
|
+
1. **Learn Oxlint CLI**:
|
|
252
|
+
```bash
|
|
253
|
+
autofleet-lint # Lint src directory
|
|
254
|
+
autofleet-lint --fix # Apply safe fixes
|
|
255
|
+
autofleet-lint --fix-suggestions --fix-dangerously # Apply all fixes
|
|
256
|
+
autofleet-fmt # Format src directory
|
|
257
|
+
autofleet-fmt --check # Check formatting without changing
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
2. **Use IDE Features**:
|
|
261
|
+
- **Organize Imports**: Shift+Alt+O (VSCode)
|
|
262
|
+
- **Format Document**: Shift+Alt+F (VSCode)
|
|
263
|
+
- **Fix on Save**: Enabled in VSCode settings
|
|
264
|
+
|
|
265
|
+
3. **Manual Conventions**:
|
|
266
|
+
- Follow camelCase for variables
|
|
267
|
+
- Follow PascalCase for types/classes/enums
|
|
268
|
+
- Keep imports organized (builtin → external → internal)
|
|
269
|
+
- Don't export from test files
|
|
270
|
+
|
|
271
|
+
### For Code Review
|
|
272
|
+
|
|
273
|
+
Focus on:
|
|
274
|
+
- Import organization (since no auto-sort)
|
|
275
|
+
- Naming conventions (since no auto-enforcement)
|
|
276
|
+
- Test file exports (since no restriction rule)
|
|
277
|
+
|
|
278
|
+
### Future Monitoring
|
|
279
|
+
|
|
280
|
+
Watch Oxc project for:
|
|
281
|
+
- Import sorting feature (requested by community)
|
|
282
|
+
- Naming convention rule (in backlog)
|
|
283
|
+
- Oxfmt plugin system (for custom rules)
|
|
284
|
+
|
|
285
|
+
---
|
|
286
|
+
|
|
287
|
+
## 🔗 References
|
|
288
|
+
|
|
289
|
+
- [Oxlint Documentation](https://oxc.rs/docs/guide/usage/linter.html)
|
|
290
|
+
- [Oxfmt Documentation](https://oxc.rs/docs/guide/usage/formatter)
|
|
291
|
+
- [Announcing Oxlint 1.0](https://voidzero.dev/posts/announcing-oxlint-1-stable)
|
|
292
|
+
- [Announcing Oxfmt Alpha](https://voidzero.dev/posts/announcing-oxfmt-alpha)
|
|
293
|
+
- [Oxlint Supported Rules](https://oxc.rs/docs/guide/usage/linter/rules)
|
|
294
|
+
- [Oxfmt Migration Guide](https://oxc.rs/docs/guide/usage/formatter/migrate-from-prettier)
|
|
295
|
+
|
|
296
|
+
---
|
|
297
|
+
|
|
298
|
+
**Last Updated**: 2026-03-12
|
|
299
|
+
**Migration Version**: ESLint 8.57 → Oxlint 1.43 + Oxfmt 0.28
|