Skip to content

Commit 6732a0d

Browse files
oxc-botBoshenSysix
authored
release: v1.12.0 (#481)
Automated changes by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action --------- Co-authored-by: Boshen <[email protected]> Co-authored-by: Sysix <[email protected]>
1 parent 4837442 commit 6732a0d

File tree

9 files changed

+133
-52
lines changed

9 files changed

+133
-52
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eslint-plugin-oxlint",
3-
"version": "1.11.2",
3+
"version": "1.12.0",
44
"description": "Turn off all rules already supported by oxlint",
55
"type": "module",
66
"types": "./dist/index.d.ts",
@@ -69,7 +69,7 @@
6969
"jiti": "^2.4.2",
7070
"lint-staged": "^16.0.0",
7171
"memfs": "^4.14.0",
72-
"oxlint": "^1.11.2",
72+
"oxlint": "^1.12.0",
7373
"prettier": "^3.3.3",
7474
"scule": "^1.3.0",
7575
"shelljs": "^0.10.0",

pnpm-lock.yaml

Lines changed: 37 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/constants.ts

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,69 @@ export const ignoreScope = new Set(['oxc', 'deepscan', 'security']);
33

44
// these are the rules that are not fully implemented in oxc
55
export const ignoreCategories = new Set(['nursery']);
6+
7+
// we are ignoring typescript type-aware rules for now, until it is stable.
8+
// When support it with a flag, do the same for `ignoreCategories`.
9+
// List copied from:
10+
// https://github.com/typescript-eslint/typescript-eslint/blob/7319bad3a5022be2adfbcb331451cfd85d1d786a/packages/eslint-plugin/src/configs/flat/disable-type-checked.ts
11+
export const typescriptTypeAwareRules = [
12+
'await-thenable',
13+
'consistent-return',
14+
'consistent-type-exports',
15+
'dot-notation',
16+
'naming-convention',
17+
'no-array-delete',
18+
'no-base-to-string',
19+
'no-confusing-void-expression',
20+
'no-deprecated',
21+
'no-duplicate-type-constituents',
22+
'no-floating-promises',
23+
'no-for-in-array',
24+
'no-implied-eval',
25+
'no-meaningless-void-operator',
26+
'no-misused-promises',
27+
'no-misused-spread',
28+
'no-mixed-enums',
29+
'no-redundant-type-constituents',
30+
'no-unnecessary-boolean-literal-compare',
31+
'no-unnecessary-condition',
32+
'no-unnecessary-qualifier',
33+
'no-unnecessary-template-expression',
34+
'no-unnecessary-type-arguments',
35+
'no-unnecessary-type-assertion',
36+
'no-unnecessary-type-conversion',
37+
'no-unnecessary-type-parameters',
38+
'no-unsafe-argument',
39+
'no-unsafe-assignment',
40+
'no-unsafe-call',
41+
'no-unsafe-enum-comparison',
42+
'no-unsafe-member-access',
43+
'no-unsafe-return',
44+
'no-unsafe-type-assertion',
45+
'no-unsafe-unary-minus',
46+
'non-nullable-type-assertion-style',
47+
'only-throw-error',
48+
'prefer-destructuring',
49+
'prefer-find',
50+
'prefer-includes',
51+
'prefer-nullish-coalescing',
52+
'prefer-optional-chain',
53+
'prefer-promise-reject-errors',
54+
'prefer-readonly',
55+
'prefer-readonly-parameter-types',
56+
'prefer-reduce-type-parameter',
57+
'prefer-regexp-exec',
58+
'prefer-return-this-type',
59+
'prefer-string-starts-ends-with',
60+
'promise-function-async',
61+
'related-getter-setter-pairs',
62+
'require-array-sort-compare',
63+
'require-await',
64+
'restrict-plus-operands',
65+
'restrict-template-expressions',
66+
'return-await',
67+
'strict-boolean-expressions',
68+
'switch-exhaustiveness-check',
69+
'unbound-method',
70+
'use-unknown-in-catch-callback-variable',
71+
];

scripts/traverse-rules.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
import { execSync } from 'node:child_process';
2-
import { ignoreCategories, ignoreScope } from './constants.js';
2+
import {
3+
ignoreCategories,
4+
ignoreScope,
5+
typescriptTypeAwareRules,
6+
} from './constants.js';
37
import {
48
aliasPluginNames,
59
reactHookRulesInsideReactScope,
@@ -94,7 +98,13 @@ export function traverseRules(): Rule[] {
9498
// get all rules and filter the ignored one
9599
const rules = readRulesFromCommand().filter(
96100
(rule) =>
97-
!ignoreCategories.has(rule.category) && !ignoreScope.has(rule.scope)
101+
!ignoreCategories.has(rule.category) &&
102+
!ignoreScope.has(rule.scope) &&
103+
// ignore type-aware rules
104+
!(
105+
rule.scope === 'typescript' &&
106+
typescriptTypeAwareRules.includes(rule.value)
107+
)
98108
);
99109

100110
const aliasRules: Rule[] = [];

src/__snapshots__/configs.spec.ts.snap

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,6 @@ exports[`contains all the oxlint rules 1`] = `
140140
"@typescript-eslint/no-extraneous-class": [
141141
0,
142142
],
143-
"@typescript-eslint/no-floating-promises": [
144-
0,
145-
],
146143
"@typescript-eslint/no-import-type-side-effects": [
147144
0,
148145
],
@@ -158,9 +155,6 @@ exports[`contains all the oxlint rules 1`] = `
158155
"@typescript-eslint/no-misused-new": [
159156
0,
160157
],
161-
"@typescript-eslint/no-misused-promises": [
162-
0,
163-
],
164158
"@typescript-eslint/no-namespace": [
165159
0,
166160
],
@@ -1157,6 +1151,9 @@ exports[`contains all the oxlint rules 1`] = `
11571151
"prefer-spread": [
11581152
0,
11591153
],
1154+
"prefer-template": [
1155+
0,
1156+
],
11601157
"promise/avoid-new": [
11611158
0,
11621159
],
@@ -1242,6 +1239,9 @@ exports[`contains all the oxlint rules 1`] = `
12421239
"react/jsx-filename-extension": [
12431240
0,
12441241
],
1242+
"react/jsx-fragments": [
1243+
0,
1244+
],
12451245
"react/jsx-key": [
12461246
0,
12471247
],

src/build-from-oxlint-config.spec.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
unicornRulesExtendEslintRules,
1212
viteTestCompatibleRules,
1313
} from './constants.js';
14+
import { typescriptTypeAwareRules } from '../scripts/constants.js';
1415

1516
describe('buildFromOxlintConfigFile', () => {
1617
it('successfully parse oxlint json config', () => {
@@ -157,6 +158,10 @@ describe('integration test with oxlint', () => {
157158
config.plugins === undefined ||
158159
config.plugins.includes('typescript')
159160
) {
161+
expectedCount += typescriptTypeAwareRules.filter(
162+
(tsRule) => `@typescript-eslint/${tsRule}` in buildConfig.rules!
163+
).length;
164+
160165
expectedCount += typescriptRulesExtendEslintRules.filter(
161166
(aliasRule) => aliasRule in buildConfig.rules!
162167
).length;

src/build-from-oxlint-config/rules.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const getEsLintRuleName = (rule: string): string | undefined => {
5151
const expectedRule =
5252
esPluginName === '' ? ruleName : `${esPluginName}/${ruleName}`;
5353

54-
return allRules.find((rule) => rule == expectedRule);
54+
return allRules.find((rule) => rule === expectedRule);
5555
};
5656

5757
/**

src/generated/rules-by-category.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ const styleRules: Record<string, 'off'> = {
118118
'no-template-curly-in-string': 'off',
119119
'no-ternary': 'off',
120120
'operator-assignment': 'off',
121+
'prefer-template': 'off',
121122
'prefer-destructuring': 'off',
122123
'prefer-promise-reject-errors': 'off',
123124
'prefer-exponentiation-operator': 'off',
@@ -185,6 +186,7 @@ const styleRules: Record<string, 'off'> = {
185186
'promise/prefer-catch': 'off',
186187
'promise/prefer-await-to-callbacks': 'off',
187188
'promise/prefer-await-to-then': 'off',
189+
'react/jsx-fragments': 'off',
188190
'react/jsx-boolean-value': 'off',
189191
'react/jsx-curly-brace-presence': 'off',
190192
'react/no-set-state': 'off',
@@ -292,8 +294,6 @@ const suspiciousRules: Record<string, 'off'> = {
292294
'react/no-namespace': 'off',
293295
'react/react-in-jsx-scope': 'off',
294296
'react/style-prop-object': 'off',
295-
'@typescript-eslint/no-misused-promises': 'off',
296-
'@typescript-eslint/no-floating-promises': 'off',
297297
'@typescript-eslint/no-confusing-non-null-assertion': 'off',
298298
'@typescript-eslint/no-extraneous-class': 'off',
299299
'@typescript-eslint/no-unnecessary-type-constraint': 'off',

src/generated/rules-by-scope.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ const eslintRules: Record<string, 'off'> = {
126126
'no-void': 'off',
127127
'no-with': 'off',
128128
'operator-assignment': 'off',
129+
'prefer-template': 'off',
129130
'prefer-destructuring': 'off',
130131
'prefer-promise-reject-errors': 'off',
131132
'prefer-exponentiation-operator': 'off',
@@ -334,6 +335,7 @@ const reactRules: Record<string, 'off'> = {
334335
'react/forbid-elements': 'off',
335336
'react/forward-ref-uses-ref': 'off',
336337
'react/iframe-missing-sandbox': 'off',
338+
'react/jsx-fragments': 'off',
337339
'react/jsx-filename-extension': 'off',
338340
'react/jsx-boolean-value': 'off',
339341
'react/jsx-curly-brace-presence': 'off',
@@ -389,8 +391,6 @@ const typescriptRules: Record<string, 'off'> = {
389391
'@typescript-eslint/consistent-type-imports': 'off',
390392
'@typescript-eslint/explicit-module-boundary-types': 'off',
391393
'@typescript-eslint/explicit-function-return-type': 'off',
392-
'@typescript-eslint/no-misused-promises': 'off',
393-
'@typescript-eslint/no-floating-promises': 'off',
394394
'@typescript-eslint/no-inferrable-types': 'off',
395395
'@typescript-eslint/no-confusing-non-null-assertion': 'off',
396396
'@typescript-eslint/no-duplicate-enum-values': 'off',

0 commit comments

Comments
 (0)