Skip to content

Commit 241b503

Browse files
committed
fix: fill in some documented gaps with rules that exist
1 parent b4b0fed commit 241b503

8 files changed

Lines changed: 99 additions & 49 deletions

File tree

README.md

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,16 @@ This config intentionally omits all formatting/style rules (spacing, semicolons,
5959

6060
## Rules not covered by oxlint
6161

62-
The following rules from `eslint-config-universe` do not have oxlint equivalents. If you need them, you'll need to keep ESLint running alongside oxlint for these specific rules, or accept the gap.
62+
The following rules from `eslint-config-universe` do not have `oxlint-config-universe` coverage. If you need them, you'll need to keep ESLint running alongside oxlint for these specific rules, or accept the gap.
6363

6464
### Core ESLint rules
6565

66-
| Rule | Notes |
67-
| ----------------- | ---------------------------------------------------------------- |
68-
| `no-dupe-args` | Not implemented in oxlint |
69-
| `no-implied-eval` | Only available as `typescript/no-implied-eval`, not for plain JS |
70-
| `no-new-symbol` | oxlint has `no-new-native-nonconstructor` as a successor |
71-
| `no-octal` | Not implemented |
72-
| `no-octal-escape` | Not implemented |
66+
| Rule | Notes |
67+
| ----------------- | --------------------------------------------------------------------------------------- |
68+
| `no-dupe-args` | Not implemented in oxlint |
69+
| `no-implied-eval` | Only available with type-aware, present in `oxlint-config-universe/typescript-analysis` |
70+
| `no-octal` | Not implemented |
71+
| `no-octal-escape` | Not implemented |
7372

7473
### Import rules
7574

@@ -91,18 +90,6 @@ Recommended oxfmt config to match eslint-config-universe import/order configurat
9190
}
9291
```
9392

94-
### TypeScript rules
95-
96-
These ESLint rules have TypeScript-specific overrides that don't exist in oxlint. The base ESLint versions are included in core and may work adequately for TypeScript files, but lack TypeScript-aware handling (e.g., understanding type-only imports):
97-
98-
| Rule | Notes |
99-
| ------------------------------------------- | ----------------------------------------- |
100-
| `@typescript-eslint/no-dupe-class-members` | Core `no-dupe-class-members` is included |
101-
| `@typescript-eslint/no-redeclare` | Core `no-redeclare` is included |
102-
| `@typescript-eslint/no-unused-expressions` | Core `no-unused-expressions` is included |
103-
| `@typescript-eslint/no-unused-vars` | Core `no-unused-vars` is included |
104-
| `@typescript-eslint/no-useless-constructor` | Core `no-useless-constructor` is included |
105-
10693
### React rules
10794

10895
| Rule | Notes |

__tests__/__snapshots__/default-test.js.snap

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,21 @@ exports[`lints with the default config: ../fixtures/all-00.js 1`] = `
2929
},
3030
},
3131
],
32-
"message": "Catch parameter 'e' is caught but never used. Unused caught errors should start with a '_'.",
32+
"message": "Catch parameter 'e' is caught but never used.",
33+
"severity": "warning",
34+
},
35+
{
36+
"code": "eslint(no-unused-vars)",
37+
"help": "Consider handling this error.",
38+
"labels": [
39+
{
40+
"span": {
41+
"column": 14,
42+
"line": 36,
43+
},
44+
},
45+
],
46+
"message": "Catch parameter '_ignored' is caught but never used.",
3347
"severity": "warning",
3448
},
3549
{
@@ -47,7 +61,7 @@ exports[`lints with the default config: ../fixtures/all-00.js 1`] = `
4761
"severity": "warning",
4862
},
4963
],
50-
"warningCount": 3,
64+
"warningCount": 4,
5165
}
5266
`;
5367

@@ -95,7 +109,7 @@ exports[`lints with the default config: ../fixtures/all-02.js 1`] = `
95109
},
96110
},
97111
],
98-
"message": "Variable 'unused1' is declared but never used.",
112+
"message": "Variable 'unused1' is declared but never used. Unused variables should start with a '_'.",
99113
"severity": "warning",
100114
},
101115
{
@@ -123,7 +137,7 @@ exports[`lints with the default config: ../fixtures/all-02.js 1`] = `
123137
},
124138
},
125139
],
126-
"message": "Variable 'unused3' is declared but never used.",
140+
"message": "Variable 'unused3' is declared but never used. Unused variables should start with a '_'.",
127141
"severity": "warning",
128142
},
129143
],
@@ -146,7 +160,7 @@ exports[`lints with the default config: ../fixtures/all-03.ts 1`] = `
146160
},
147161
},
148162
],
149-
"message": "Variable 'tsUnused1' is declared but never used.",
163+
"message": "Variable 'tsUnused1' is declared but never used. Unused variables should start with a '_'.",
150164
"severity": "warning",
151165
},
152166
{
@@ -174,7 +188,7 @@ exports[`lints with the default config: ../fixtures/all-03.ts 1`] = `
174188
},
175189
},
176190
],
177-
"message": "Variable 'asCast' is declared but never used.",
191+
"message": "Variable 'asCast' is declared but never used. Unused variables should start with a '_'.",
178192
"severity": "warning",
179193
},
180194
{
@@ -188,7 +202,7 @@ exports[`lints with the default config: ../fixtures/all-03.ts 1`] = `
188202
},
189203
},
190204
],
191-
"message": "Variable 'angleBracketCast' is declared but never used.",
205+
"message": "Variable 'angleBracketCast' is declared but never used. Unused variables should start with a '_'.",
192206
"severity": "warning",
193207
},
194208
{

__tests__/__snapshots__/native-test.js.snap

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,21 @@ exports[`lints with the React Native config: ../fixtures/all-00.js 1`] = `
2929
},
3030
},
3131
],
32-
"message": "Catch parameter 'e' is caught but never used. Unused caught errors should start with a '_'.",
32+
"message": "Catch parameter 'e' is caught but never used.",
33+
"severity": "warning",
34+
},
35+
{
36+
"code": "eslint(no-unused-vars)",
37+
"help": "Consider handling this error.",
38+
"labels": [
39+
{
40+
"span": {
41+
"column": 14,
42+
"line": 36,
43+
},
44+
},
45+
],
46+
"message": "Catch parameter '_ignored' is caught but never used.",
3347
"severity": "warning",
3448
},
3549
{
@@ -47,7 +61,7 @@ exports[`lints with the React Native config: ../fixtures/all-00.js 1`] = `
4761
"severity": "warning",
4862
},
4963
],
50-
"warningCount": 3,
64+
"warningCount": 4,
5165
}
5266
`;
5367

@@ -95,7 +109,7 @@ exports[`lints with the React Native config: ../fixtures/all-02.js 1`] = `
95109
},
96110
},
97111
],
98-
"message": "Variable 'unused1' is declared but never used.",
112+
"message": "Variable 'unused1' is declared but never used. Unused variables should start with a '_'.",
99113
"severity": "warning",
100114
},
101115
{
@@ -123,7 +137,7 @@ exports[`lints with the React Native config: ../fixtures/all-02.js 1`] = `
123137
},
124138
},
125139
],
126-
"message": "Variable 'unused3' is declared but never used.",
140+
"message": "Variable 'unused3' is declared but never used. Unused variables should start with a '_'.",
127141
"severity": "warning",
128142
},
129143
],
@@ -146,7 +160,7 @@ exports[`lints with the React Native config: ../fixtures/all-03.ts 1`] = `
146160
},
147161
},
148162
],
149-
"message": "Variable 'tsUnused1' is declared but never used.",
163+
"message": "Variable 'tsUnused1' is declared but never used. Unused variables should start with a '_'.",
150164
"severity": "warning",
151165
},
152166
{
@@ -174,7 +188,7 @@ exports[`lints with the React Native config: ../fixtures/all-03.ts 1`] = `
174188
},
175189
},
176190
],
177-
"message": "Variable 'asCast' is declared but never used.",
191+
"message": "Variable 'asCast' is declared but never used. Unused variables should start with a '_'.",
178192
"severity": "warning",
179193
},
180194
{
@@ -188,7 +202,7 @@ exports[`lints with the React Native config: ../fixtures/all-03.ts 1`] = `
188202
},
189203
},
190204
],
191-
"message": "Variable 'angleBracketCast' is declared but never used.",
205+
"message": "Variable 'angleBracketCast' is declared but never used. Unused variables should start with a '_'.",
192206
"severity": "warning",
193207
},
194208
{

__tests__/__snapshots__/node-test.js.snap

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,21 @@ exports[`lints with the Node config: ../fixtures/all-00.js 1`] = `
2929
},
3030
},
3131
],
32-
"message": "Catch parameter 'e' is caught but never used. Unused caught errors should start with a '_'.",
32+
"message": "Catch parameter 'e' is caught but never used.",
33+
"severity": "warning",
34+
},
35+
{
36+
"code": "eslint(no-unused-vars)",
37+
"help": "Consider handling this error.",
38+
"labels": [
39+
{
40+
"span": {
41+
"column": 14,
42+
"line": 36,
43+
},
44+
},
45+
],
46+
"message": "Catch parameter '_ignored' is caught but never used.",
3347
"severity": "warning",
3448
},
3549
{
@@ -47,7 +61,7 @@ exports[`lints with the Node config: ../fixtures/all-00.js 1`] = `
4761
"severity": "warning",
4862
},
4963
],
50-
"warningCount": 3,
64+
"warningCount": 4,
5165
}
5266
`;
5367

@@ -95,7 +109,7 @@ exports[`lints with the Node config: ../fixtures/all-02.js 1`] = `
95109
},
96110
},
97111
],
98-
"message": "Variable 'unused1' is declared but never used.",
112+
"message": "Variable 'unused1' is declared but never used. Unused variables should start with a '_'.",
99113
"severity": "warning",
100114
},
101115
{
@@ -123,7 +137,7 @@ exports[`lints with the Node config: ../fixtures/all-02.js 1`] = `
123137
},
124138
},
125139
],
126-
"message": "Variable 'unused3' is declared but never used.",
140+
"message": "Variable 'unused3' is declared but never used. Unused variables should start with a '_'.",
127141
"severity": "warning",
128142
},
129143
],
@@ -146,7 +160,7 @@ exports[`lints with the Node config: ../fixtures/all-03.ts 1`] = `
146160
},
147161
},
148162
],
149-
"message": "Variable 'tsUnused1' is declared but never used.",
163+
"message": "Variable 'tsUnused1' is declared but never used. Unused variables should start with a '_'.",
150164
"severity": "warning",
151165
},
152166
{
@@ -174,7 +188,7 @@ exports[`lints with the Node config: ../fixtures/all-03.ts 1`] = `
174188
},
175189
},
176190
],
177-
"message": "Variable 'asCast' is declared but never used.",
191+
"message": "Variable 'asCast' is declared but never used. Unused variables should start with a '_'.",
178192
"severity": "warning",
179193
},
180194
{
@@ -188,7 +202,7 @@ exports[`lints with the Node config: ../fixtures/all-03.ts 1`] = `
188202
},
189203
},
190204
],
191-
"message": "Variable 'angleBracketCast' is declared but never used.",
205+
"message": "Variable 'angleBracketCast' is declared but never used. Unused variables should start with a '_'.",
192206
"severity": "warning",
193207
},
194208
{
@@ -415,7 +429,7 @@ exports[`lints with the Node config: ../fixtures/node-00.js 1`] = `
415429
},
416430
},
417431
],
418-
"message": "Variable 'data' is declared but never used.",
432+
"message": "Variable 'data' is declared but never used. Unused variables should start with a '_'.",
419433
"severity": "warning",
420434
},
421435
],

__tests__/__snapshots__/web-test.js.snap

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,21 @@ exports[`lints with the web config: ../fixtures/all-00.js 1`] = `
2929
},
3030
},
3131
],
32-
"message": "Catch parameter 'e' is caught but never used. Unused caught errors should start with a '_'.",
32+
"message": "Catch parameter 'e' is caught but never used.",
33+
"severity": "warning",
34+
},
35+
{
36+
"code": "eslint(no-unused-vars)",
37+
"help": "Consider handling this error.",
38+
"labels": [
39+
{
40+
"span": {
41+
"column": 14,
42+
"line": 36,
43+
},
44+
},
45+
],
46+
"message": "Catch parameter '_ignored' is caught but never used.",
3347
"severity": "warning",
3448
},
3549
{
@@ -47,7 +61,7 @@ exports[`lints with the web config: ../fixtures/all-00.js 1`] = `
4761
"severity": "warning",
4862
},
4963
],
50-
"warningCount": 3,
64+
"warningCount": 4,
5165
}
5266
`;
5367

@@ -95,7 +109,7 @@ exports[`lints with the web config: ../fixtures/all-02.js 1`] = `
95109
},
96110
},
97111
],
98-
"message": "Variable 'unused1' is declared but never used.",
112+
"message": "Variable 'unused1' is declared but never used. Unused variables should start with a '_'.",
99113
"severity": "warning",
100114
},
101115
{
@@ -123,7 +137,7 @@ exports[`lints with the web config: ../fixtures/all-02.js 1`] = `
123137
},
124138
},
125139
],
126-
"message": "Variable 'unused3' is declared but never used.",
140+
"message": "Variable 'unused3' is declared but never used. Unused variables should start with a '_'.",
127141
"severity": "warning",
128142
},
129143
],
@@ -146,7 +160,7 @@ exports[`lints with the web config: ../fixtures/all-03.ts 1`] = `
146160
},
147161
},
148162
],
149-
"message": "Variable 'tsUnused1' is declared but never used.",
163+
"message": "Variable 'tsUnused1' is declared but never used. Unused variables should start with a '_'.",
150164
"severity": "warning",
151165
},
152166
{
@@ -174,7 +188,7 @@ exports[`lints with the web config: ../fixtures/all-03.ts 1`] = `
174188
},
175189
},
176190
],
177-
"message": "Variable 'asCast' is declared but never used.",
191+
"message": "Variable 'asCast' is declared but never used. Unused variables should start with a '_'.",
178192
"severity": "warning",
179193
},
180194
{
@@ -188,7 +202,7 @@ exports[`lints with the web config: ../fixtures/all-03.ts 1`] = `
188202
},
189203
},
190204
],
191-
"message": "Variable 'angleBracketCast' is declared but never used.",
205+
"message": "Variable 'angleBracketCast' is declared but never used. Unused variables should start with a '_'.",
192206
"severity": "warning",
193207
},
194208
{

shared/core.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ export default defineConfig({
5858
'no-multi-assign': 'warn',
5959
'no-new': 'warn',
6060
'no-new-func': 'warn',
61+
'no-new-native-nonconstructor': 'warn',
6162
'no-object-constructor': 'warn',
6263
'no-obj-calls': 'warn',
6364
'no-proto': 'warn',

shared/typescript-analysis.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export default defineConfig({
1919
'typescript/no-confusing-void-expression': 'warn',
2020
'typescript/no-extra-non-null-assertion': 'warn',
2121
'typescript/no-floating-promises': 'warn',
22+
'typescript/no-implied-eval': 'warn',
2223
'typescript/no-for-in-array': 'error',
2324
'typescript/no-misused-promises': ['error', { checksVoidReturn: false }],
2425
'typescript/no-unnecessary-type-assertion': 'warn',

shared/typescript.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ import { defineConfig } from 'oxlint';
66
export default defineConfig({
77
plugins: ['typescript'],
88
rules: {
9+
'typescript/no-dupe-class-members': 'warn',
10+
'typescript/no-redeclare': 'warn',
11+
'typescript/no-unused-expressions': ['warn', { allowShortCircuit: true, enforceForJSX: true }],
12+
'typescript/no-unused-vars': 'warn',
13+
'typescript/no-useless-constructor': 'warn',
914
'typescript/array-type': ['warn', { default: 'array' }],
1015
'typescript/no-empty-object-type': ['warn', { allowInterfaces: 'with-single-extends' }],
1116
'typescript/no-wrapper-object-types': 'warn',

0 commit comments

Comments
 (0)