Skip to content

Commit d4a8e61

Browse files
authored
Release 0.10.0 (#227)
Co-authored-by: oxc-bot <176400334+oxc-bot@users.noreply.github.com>
1 parent 7386ad5 commit d4a8e61

10 files changed

+239
-24
lines changed

src/docs/guide/usage/linter/generated-config.md

+65-8
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ Only the `.json` format is supported. You can use comments in configuration file
1212

1313
Example
1414

15-
```json [.oxlintrc.json]
15+
`.oxlintrc.json`
16+
17+
```json
1618
{
1719
"env": {
1820
"browser": true
@@ -28,17 +30,52 @@ Example
2830
}
2931
```
3032

31-
## env
33+
## categories
3234

3335
type: `object`
3436

37+
Configure an entire category of rules all at once.
38+
39+
Rules enabled or disabled this way will be overwritten by individual rules in the `rules` field.
40+
41+
# Example
42+
43+
```json
44+
{
45+
"categories": {
46+
"correctness": "warn"
47+
},
48+
"rules": {
49+
"eslint/no-unused-vars": "error"
50+
}
51+
}
52+
```
53+
54+
### categories.correctness
55+
56+
### categories.nursery
57+
58+
### categories.pedantic
59+
60+
### categories.perf
61+
62+
### categories.restriction
63+
64+
### categories.style
65+
66+
### categories.suspicious
67+
68+
## env
69+
70+
type: `Record<string, boolean>`
71+
3572
Predefine global variables.
3673

3774
Environments specify what global variables are predefined. See [ESLint's list of environments](https://eslint.org/docs/v8.x/use/configure/language-options#specifying-environments) for what environments are available and what each one provides.
3875

3976
## globals
4077

41-
type: `object`
78+
type: `Record<string, string>`
4279

4380
Add or remove global variables.
4481

@@ -61,11 +98,9 @@ You may also use `"readable"` or `false` to represent `"readonly"`, and `"writea
6198

6299
## plugins
63100

64-
type: `array`
65-
66-
### plugins[n]
101+
type: `string[]`
67102

68-
type: `string`
103+
default: `["react", "unicorn", "typescript", "oxc"]`
69104

70105
## rules
71106

@@ -87,55 +122,73 @@ type: `object`
87122

88123
type: `boolean`
89124

125+
default: `false`
126+
90127
Only for `require-(yields|returns|description|example|param|throws)` rule
91128

92129
#### settings.jsdoc.exemptDestructuredRootsFromChecks
93130

94131
type: `boolean`
95132

133+
default: `false`
134+
96135
Only for `require-param-type` and `require-param-description` rule
97136

98137
#### settings.jsdoc.ignoreInternal
99138

100139
type: `boolean`
101140

141+
default: `false`
142+
102143
For all rules but NOT apply to `empty-tags` rule
103144

104145
#### settings.jsdoc.ignorePrivate
105146

106147
type: `boolean`
107148

149+
default: `false`
150+
108151
For all rules but NOT apply to `check-access` and `empty-tags` rule
109152

110153
#### settings.jsdoc.ignoreReplacesDocs
111154

112155
type: `boolean`
113156

157+
default: `true`
158+
114159
Only for `require-(yields|returns|description|example|param|throws)` rule
115160

116161
#### settings.jsdoc.implementsReplacesDocs
117162

118163
type: `boolean`
119164

165+
default: `false`
166+
120167
Only for `require-(yields|returns|description|example|param|throws)` rule
121168

122169
#### settings.jsdoc.overrideReplacesDocs
123170

124171
type: `boolean`
125172

173+
default: `true`
174+
126175
Only for `require-(yields|returns|description|example|param|throws)` rule
127176

128177
#### settings.jsdoc.tagNamePreference
129178

130179
type: `object`
131180

181+
default: `{}`
182+
132183
### settings.jsx-a11y
133184

134185
type: `object`
135186

136187
#### settings.jsx-a11y.components
137188

138-
type: `object`
189+
type: `Record<string, string>`
190+
191+
default: `{}`
139192

140193
#### settings.jsx-a11y.polymorphicPropName
141194

@@ -158,10 +211,14 @@ type: `object`
158211

159212
type: `array`
160213

214+
default: `[]`
215+
161216
##### settings.react.formComponents[n]
162217

163218
#### settings.react.linkComponents
164219

165220
type: `array`
166221

222+
default: `[]`
223+
167224
##### settings.react.linkComponents[n]

src/docs/guide/usage/linter/generated-rules.md

+11-8
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
The progress of all rule implementations is tracked [here](https://github.com/oxc-project/oxc/issues/481).
44

5-
- Total number of rules: 436
6-
- Rules turned on by default: 96
5+
- Total number of rules: 439
6+
- Rules turned on by default: 98
77

8-
## Correctness (170):
8+
## Correctness (173):
99

1010
Code that is outright wrong or useless.
1111
| Rule name | Source | Default | Fixable? |
@@ -47,6 +47,7 @@ Code that is outright wrong or useless.
4747
| [no-this-before-super](/docs/guide/usage/linter/rules/eslint/no-this-before-super.html) | eslint || |
4848
| [no-unsafe-finally](/docs/guide/usage/linter/rules/eslint/no-unsafe-finally.html) | eslint || |
4949
| [no-unsafe-negation](/docs/guide/usage/linter/rules/eslint/no-unsafe-negation.html) | eslint || 🛠️ |
50+
| [no-unsafe-optional-chaining](/docs/guide/usage/linter/rules/eslint/no-unsafe-optional-chaining.html) | eslint || |
5051
| [no-unused-labels](/docs/guide/usage/linter/rules/eslint/no-unused-labels.html) | eslint || 🛠️ |
5152
| [no-unused-private-class-members](/docs/guide/usage/linter/rules/eslint/no-unused-private-class-members.html) | eslint || |
5253
| [no-unused-vars](/docs/guide/usage/linter/rules/eslint/no-unused-vars.html) | eslint || ⚠️💡 |
@@ -139,8 +140,10 @@ Code that is outright wrong or useless.
139140
| [number-arg-out-of-range](/docs/guide/usage/linter/rules/oxc/number-arg-out-of-range.html) | oxc || |
140141
| [only-used-in-recursion](/docs/guide/usage/linter/rules/oxc/only-used-in-recursion.html) | oxc || ⚠️🛠️️ |
141142
| [uninvoked-array-callback](/docs/guide/usage/linter/rules/oxc/uninvoked-array-callback.html) | oxc || |
143+
| [no-callback-in-promise](/docs/guide/usage/linter/rules/promise/no-callback-in-promise.html) | promise | | |
142144
| [no-new-statics](/docs/guide/usage/linter/rules/promise/no-new-statics.html) | promise | | 🛠️ |
143145
| [valid-params](/docs/guide/usage/linter/rules/promise/valid-params.html) | promise | | |
146+
| [iframe-missing-sandbox](/docs/guide/usage/linter/rules/react/iframe-missing-sandbox.html) | react || 🚧 |
144147
| [jsx-key](/docs/guide/usage/linter/rules/react/jsx-key.html) | react || |
145148
| [jsx-no-duplicate-props](/docs/guide/usage/linter/rules/react/jsx-no-duplicate-props.html) | react || |
146149
| [jsx-no-target-blank](/docs/guide/usage/linter/rules/react/jsx-no-target-blank.html) | react || |
@@ -208,12 +211,11 @@ Lints which prevent the use of language and library features. Must not be enable
208211
| [no-eq-null](/docs/guide/usage/linter/rules/eslint/no-eq-null.html) | eslint | | ⚠️🛠️️ |
209212
| [no-eval](/docs/guide/usage/linter/rules/eslint/no-eval.html) | eslint | | |
210213
| [no-iterator](/docs/guide/usage/linter/rules/eslint/no-iterator.html) | eslint | | 🚧 |
211-
| [no-plusplus](/docs/guide/usage/linter/rules/eslint/no-plusplus.html) | eslint | | 🚧 |
214+
| [no-plusplus](/docs/guide/usage/linter/rules/eslint/no-plusplus.html) | eslint | | 💡 |
212215
| [no-proto](/docs/guide/usage/linter/rules/eslint/no-proto.html) | eslint | | 🚧 |
213216
| [no-regex-spaces](/docs/guide/usage/linter/rules/eslint/no-regex-spaces.html) | eslint | | 🚧 |
214217
| [no-restricted-globals](/docs/guide/usage/linter/rules/eslint/no-restricted-globals.html) | eslint | | |
215218
| [no-undefined](/docs/guide/usage/linter/rules/eslint/no-undefined.html) | eslint | | |
216-
| [no-unsafe-optional-chaining](/docs/guide/usage/linter/rules/eslint/no-unsafe-optional-chaining.html) | eslint | | |
217219
| [no-var](/docs/guide/usage/linter/rules/eslint/no-var.html) | eslint | | 🛠️ |
218220
| [no-void](/docs/guide/usage/linter/rules/eslint/no-void.html) | eslint | | 🚧 |
219221
| [unicode-bom](/docs/guide/usage/linter/rules/eslint/unicode-bom.html) | eslint | | 🛠️ |
@@ -224,6 +226,7 @@ Lints which prevent the use of language and library features. Must not be enable
224226
| [no-webpack-loader-syntax](/docs/guide/usage/linter/rules/import/no-webpack-loader-syntax.html) | import | | |
225227
| [check-access](/docs/guide/usage/linter/rules/jsdoc/check-access.html) | jsdoc | | |
226228
| [empty-tags](/docs/guide/usage/linter/rules/jsdoc/empty-tags.html) | jsdoc | | |
229+
| [no-new-require](/docs/guide/usage/linter/rules/node/no-new-require.html) | node | | |
227230
| [bad-bitwise-operator](/docs/guide/usage/linter/rules/oxc/bad-bitwise-operator.html) | oxc | | |
228231
| [no-async-await](/docs/guide/usage/linter/rules/oxc/no-async-await.html) | oxc | | |
229232
| [no-barrel-file](/docs/guide/usage/linter/rules/oxc/no-barrel-file.html) | oxc | | |
@@ -282,7 +285,7 @@ code that is most likely wrong or useless.
282285
| [consistent-function-scoping](/docs/guide/usage/linter/rules/unicorn/consistent-function-scoping.html) | unicorn | | 🚧 |
283286
| [prefer-add-event-listener](/docs/guide/usage/linter/rules/unicorn/prefer-add-event-listener.html) | unicorn | | 🚧 |
284287

285-
## Pedantic (71):
288+
## Pedantic (70):
286289

287290
Lints which are rather strict or have occasional false positives.
288291
| Rule name | Source | Default | Fixable? |
@@ -304,7 +307,6 @@ Lints which are rather strict or have occasional false positives.
304307
| [no-throw-literal](/docs/guide/usage/linter/rules/eslint/no-throw-literal.html) | eslint | | 💡 |
305308
| [radix](/docs/guide/usage/linter/rules/eslint/radix.html) | eslint | | |
306309
| [require-await](/docs/guide/usage/linter/rules/eslint/require-await.html) | eslint | | |
307-
| [sort-keys](/docs/guide/usage/linter/rules/eslint/sort-keys.html) | eslint | | 🚧 |
308310
| [sort-vars](/docs/guide/usage/linter/rules/eslint/sort-vars.html) | eslint | | 🚧 |
309311
| [symbol-description](/docs/guide/usage/linter/rules/eslint/symbol-description.html) | eslint | | |
310312
| [max-dependencies](/docs/guide/usage/linter/rules/import/max-dependencies.html) | import | | |
@@ -359,7 +361,7 @@ Lints which are rather strict or have occasional false positives.
359361
| [prefer-type-error](/docs/guide/usage/linter/rules/unicorn/prefer-type-error.html) | unicorn | | 🛠️ |
360362
| [require-number-to-fixed-digits-argument](/docs/guide/usage/linter/rules/unicorn/require-number-to-fixed-digits-argument.html) | unicorn | | 🛠️ |
361363

362-
## Style (102):
364+
## Style (103):
363365

364366
Code that should be written in a more idiomatic way.
365367
| Rule name | Source | Default | Fixable? |
@@ -381,6 +383,7 @@ Code that should be written in a more idiomatic way.
381383
| [prefer-exponentiation-operator](/docs/guide/usage/linter/rules/eslint/prefer-exponentiation-operator.html) | eslint | | |
382384
| [prefer-numeric-literals](/docs/guide/usage/linter/rules/eslint/prefer-numeric-literals.html) | eslint | | 🛠️ |
383385
| [sort-imports](/docs/guide/usage/linter/rules/eslint/sort-imports.html) | eslint | | 🛠️ |
386+
| [sort-keys](/docs/guide/usage/linter/rules/eslint/sort-keys.html) | eslint | | 🚧 |
384387
| [consistent-test-it](/docs/guide/usage/linter/rules/jest/consistent-test-it.html) | jest | | 🛠️ |
385388
| [max-expects](/docs/guide/usage/linter/rules/jest/max-expects.html) | jest | | |
386389
| [max-nested-describe](/docs/guide/usage/linter/rules/jest/max-nested-describe.html) | jest | | |

src/docs/guide/usage/linter/rules/eslint/no-else-return.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<div class="rule-meta">
66
<Alert class="fix" type="info">
7-
<span class="emoji">🛠️</span> An auto-fix is available for this rule.
7+
<span class="emoji">🛠️</span> An auto-fix is available for this rule for some violations.
88
</Alert>
99
</div>
1010

src/docs/guide/usage/linter/rules/eslint/no-plusplus.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<div class="rule-meta">
66
<Alert class="fix" type="info">
7-
<span class="emoji">🚧</span> An auto-fix is still under development.
7+
<span class="emoji">💡</span> A suggestion is available for this rule for some violations.
88
</Alert>
99
</div>
1010

src/docs/guide/usage/linter/rules/eslint/no-unsafe-optional-chaining.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
<!-- This file is auto-generated by tasks/website/src/linter/rules/doc_page.rs. Do not edit it manually. -->
22

3-
# eslint/no-unsafe-optional-chaining <Badge type="info" text="Restriction" />
3+
# eslint/no-unsafe-optional-chaining <Badge type="info" text="Correctness" />
44

55
<div class="rule-meta">
6+
<Alert class="default-on" type="success">
7+
<span class="emoji">✅</span> This rule is turned on by default.
8+
</Alert>
69
</div>
710

811
### What it does

src/docs/guide/usage/linter/rules/eslint/sort-keys.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!-- This file is auto-generated by tasks/website/src/linter/rules/doc_page.rs. Do not edit it manually. -->
22

3-
# eslint/sort-keys <Badge type="info" text="Pedantic" />
3+
# eslint/sort-keys <Badge type="info" text="Style" />
44

55
<div class="rule-meta">
66
<Alert class="fix" type="info">
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<!-- This file is auto-generated by tasks/website/src/linter/rules/doc_page.rs. Do not edit it manually. -->
2+
3+
# node/no-new-require <Badge type="info" text="Restriction" />
4+
5+
<div class="rule-meta">
6+
</div>
7+
8+
### What it does
9+
10+
Warn about calling `new` on `require`.
11+
12+
### Why is this bad?
13+
14+
The `require` function is used to include modules and might return a constructor. As this
15+
is not always the case this can be confusing.
16+
17+
### Examples
18+
19+
Examples of **incorrect** code for this rule:
20+
21+
```js
22+
var appHeader = new require("app-header");
23+
```
24+
25+
Examples of **correct** code for this rule:
26+
27+
```js
28+
var AppHeader = require("app-header");
29+
var appHeader = new AppHeader();
30+
```
31+
32+
## References
33+
34+
- [Rule Source](https://github.com/oxc-project/oxc/blob/main/crates/oxc_linter/src/rules/node/no_new_require.rs)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<!-- This file is auto-generated by tasks/website/src/linter/rules/doc_page.rs. Do not edit it manually. -->
2+
3+
# promise/no-callback-in-promise <Badge type="info" text="Correctness" />
4+
5+
<div class="rule-meta">
6+
</div>
7+
8+
### What it does
9+
10+
Disallows calling a callback function (`cb()`) inside a `Promise.prototype.then()`
11+
or `Promise.prototype.catch()`.
12+
13+
### Why is this bad?
14+
15+
Directly invoking a callback inside a `then()` or `catch()` method can lead to
16+
unexpected behavior, such as the callback being called multiple times. Additionally,
17+
mixing the callback and promise paradigms in this way can make the code confusing
18+
and harder to maintain.
19+
20+
### Examples
21+
22+
Examples of **incorrect** code for this rule:
23+
24+
```js
25+
function callback(err, data) {
26+
console.log("Callback got called with:", err, data);
27+
throw new Error("My error");
28+
}
29+
30+
Promise.resolve()
31+
.then(() => callback(null, "data"))
32+
.catch((err) => callback(err.message, null));
33+
```
34+
35+
Examples of **correct** code for this rule:
36+
37+
```js
38+
Promise.resolve()
39+
.then((data) => {
40+
console.log(data);
41+
})
42+
.catch((err) => {
43+
console.error(err);
44+
});
45+
```
46+
47+
## References
48+
49+
- [Rule Source](https://github.com/oxc-project/oxc/blob/main/crates/oxc_linter/src/rules/promise/no_callback_in_promise.rs)

0 commit comments

Comments
 (0)