Skip to content

Commit 46fffe7

Browse files
camc314github-actions[bot]
authored andcommitted
Release 1.10.0
1 parent a3ec48c commit 46fffe7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+707
-108
lines changed

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,29 @@ See
275275
[eslint-plugin-jsx-a11y](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y#configurations)'s
276276
configuration for a full reference.
277277

278+
#### settings.jsx-a11y.attributes
279+
280+
type: `Record<string, array>`
281+
282+
default: `{}`
283+
284+
Map of attribute names to their DOM equivalents.
285+
This is useful for non-React frameworks that use different attribute names.
286+
287+
Example:
288+
289+
```json
290+
{
291+
"settings": {
292+
"jsx-a11y": {
293+
"attributes": {
294+
"for": ["htmlFor", "for"]
295+
}
296+
}
297+
}
298+
}
299+
```
300+
278301
#### settings.jsx-a11y.components
279302

280303
type: `Record<string, string>`

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
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: 526
6-
- Rules turned on by default: 87
5+
- Total number of rules: 528
6+
- Rules turned on by default: 88
77

88
**Legend for 'Fixable?' column:**
99

@@ -13,7 +13,7 @@ The progress of all rule implementations is tracked [here](https://github.com/ox
1313
- ⚠️💡: a dangerous suggestion is available for this rule
1414
- 🚧: an auto-fix or suggestion is possible, but currently not implemented
1515

16-
## Correctness (177):
16+
## Correctness (178):
1717

1818
Code that is outright wrong or useless.
1919

@@ -55,6 +55,7 @@ Code that is outright wrong or useless.
5555
| [no-shadow-restricted-names](/docs/guide/usage/linter/rules/eslint/no-shadow-restricted-names.html) | eslint || |
5656
| [no-sparse-arrays](/docs/guide/usage/linter/rules/eslint/no-sparse-arrays.html) | eslint || |
5757
| [no-this-before-super](/docs/guide/usage/linter/rules/eslint/no-this-before-super.html) | eslint || |
58+
| [no-unassigned-vars](/docs/guide/usage/linter/rules/eslint/no-unassigned-vars.html) | eslint || |
5859
| [no-unsafe-finally](/docs/guide/usage/linter/rules/eslint/no-unsafe-finally.html) | eslint || |
5960
| [no-unsafe-negation](/docs/guide/usage/linter/rules/eslint/no-unsafe-negation.html) | eslint || 🛠️ |
6061
| [no-unsafe-optional-chaining](/docs/guide/usage/linter/rules/eslint/no-unsafe-optional-chaining.html) | eslint || |
@@ -418,7 +419,7 @@ Lints which are rather strict or have occasional false positives.
418419
| [prefer-type-error](/docs/guide/usage/linter/rules/unicorn/prefer-type-error.html) | unicorn | | 🛠️ |
419420
| [require-number-to-fixed-digits-argument](/docs/guide/usage/linter/rules/unicorn/require-number-to-fixed-digits-argument.html) | unicorn | | 🛠️ |
420421

421-
## Style (148):
422+
## Style (149):
422423

423424
Code that should be written in a more idiomatic way.
424425

@@ -452,6 +453,7 @@ Code that should be written in a more idiomatic way.
452453
| [no-template-curly-in-string](/docs/guide/usage/linter/rules/eslint/no-template-curly-in-string.html) | eslint | | ⚠️🛠️️ |
453454
| [no-ternary](/docs/guide/usage/linter/rules/eslint/no-ternary.html) | eslint | | |
454455
| [operator-assignment](/docs/guide/usage/linter/rules/eslint/operator-assignment.html) | eslint | | ⚠️🛠️️ |
456+
| [prefer-destructuring](/docs/guide/usage/linter/rules/eslint/prefer-destructuring.html) | eslint | | 🚧 |
455457
| [prefer-exponentiation-operator](/docs/guide/usage/linter/rules/eslint/prefer-exponentiation-operator.html) | eslint | | |
456458
| [prefer-numeric-literals](/docs/guide/usage/linter/rules/eslint/prefer-numeric-literals.html) | eslint | | 🛠️ |
457459
| [prefer-object-has-own](/docs/guide/usage/linter/rules/eslint/prefer-object-has-own.html) | eslint | | 🛠️ |

src/docs/guide/usage/linter/rules/eslint/max-params.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,15 @@ This option is for changing the maximum allowed number of function parameters.
6464
For example `{ "max": 4 }` would mean that having a function take four
6565
parameters is allowed which overrides the default of three.
6666

67+
### countVoidThis
68+
69+
`{ "countVoidThis": boolean }`
70+
71+
This option is for counting the `this` parameter if it is of type `void`.
72+
73+
For example `{ "countVoidThis": true }` would mean that having a function
74+
take a `this` parameter of type `void` is counted towards the maximum number of parameters.
75+
6776
## How to use
6877

6978
To **enable** this rule in the CLI or using the config file, you can use:

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ var x = y > z;
5555

5656
`{ type: string[], default: [] }`
5757

58-
The`allow` option permits the given list of bitwise operators to be used
58+
The `allow` option permits the given list of bitwise operators to be used
5959
as exceptions to this rule.
6060

6161
For example `{ "allow": ["~"] }` would allow the use of the bitwise operator

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

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,30 +15,32 @@ const source = `https://github.com/oxc-project/oxc/blob/${ data }/crates/oxc_lin
1515

1616
### What it does
1717

18-
Disallows the use of irregular whitespaces in the code.
18+
Disallows the use of irregular whitespace characters in the code.
1919

20-
### Why is this bad
20+
### Why is this bad?
2121

22-
The use of irregular whitespaces can hinder code readability and
23-
create inconsistencies, making maintenance and collaboration more challenging.
22+
Irregular whitespace characters are invisible to most editors and can
23+
cause unexpected behavior, making code harder to debug and maintain.
24+
They can also cause issues with code formatting and parsing.
2425

2526
### Examples
2627

2728
Examples of **incorrect** code for this rule:
2829

2930
```javascript
30-
function invalidExample() {
31-
return 42;
31+
// Contains irregular whitespace characters (invisible)
32+
function example() {
33+
var foo = "bar"; // irregular whitespace before 'bar'
3234
}
3335
```
3436

35-
Examples of **incorrect** code for this rule:
37+
Examples of **correct** code for this rule:
3638

37-
```javascript
38-
function invalidExample() {
39-
return 42;
39+
````javascript
40+
function example() {
41+
var foo = 'bar'; // regular spaces only
4042
}
41-
```
43+
4244

4345
## How to use
4446

@@ -48,7 +50,7 @@ To **enable** this rule in the CLI or using the config file, you can use:
4850

4951
```bash [CLI]
5052
oxlint --deny no-irregular-whitespace
51-
```
53+
````
5254
5355
```json [Config (.oxlintrc.json)]
5456
{
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<!-- This file is auto-generated by tasks/website/src/linter/rules/doc_page.rs. Do not edit it manually. -->
2+
3+
<script setup>
4+
import { data } from '../version.data.js';
5+
const source = `https://github.com/oxc-project/oxc/blob/${ data }/crates/oxc_linter/src/rules/eslint/no_unassigned_vars.rs`;
6+
</script>
7+
8+
# eslint/no-unassigned-vars <Badge type="info" text="Correctness" />
9+
10+
<div class="rule-meta">
11+
<Alert class="default-on" type="success">
12+
<span class="emoji">✅</span> This rule is turned on by default.
13+
</Alert>
14+
</div>
15+
16+
### What it does
17+
18+
Disallow let or var variables that are read but never assigned
19+
20+
### Why is this bad?
21+
22+
This rule flags let or var declarations that are never assigned a value but are still read or used in the code.
23+
Since these variables will always be undefined, their usage is likely a programming mistake.
24+
25+
### Examples
26+
27+
Examples of **incorrect** code for this rule:
28+
29+
```js
30+
let status;
31+
if (status === "ready") {
32+
console.log("Ready!");
33+
}
34+
```
35+
36+
Examples of **correct** code for this rule:
37+
38+
```js
39+
let message = "hello";
40+
console.log(message);
41+
42+
let user;
43+
user = getUser();
44+
console.log(user.name);
45+
```
46+
47+
## How to use
48+
49+
To **enable** this rule in the CLI or using the config file, you can use:
50+
51+
::: code-group
52+
53+
```bash [CLI]
54+
oxlint --deny no-unassigned-vars
55+
```
56+
57+
```json [Config (.oxlintrc.json)]
58+
{
59+
"rules": {
60+
"no-unassigned-vars": "error"
61+
}
62+
}
63+
```
64+
65+
:::
66+
67+
## References
68+
69+
- <a v-bind:href="source" target="_blank" rel="noreferrer">Rule Source</a>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ So if the code about thisArg is a dynamic expression, this rule cannot judge cor
2626
Examples of **incorrect** code for this rule:
2727

2828
```js
29-
// These are same as `foo(1, 2, 3);`
29+
// These are the same as `foo(1, 2, 3);`
3030
foo.call(undefined, 1, 2, 3);
3131
foo.apply(undefined, [1, 2, 3]);
3232
foo.call(null, 1, 2, 3);
3333
foo.apply(null, [1, 2, 3]);
3434

35-
// These are same as `obj.foo(1, 2, 3);`
35+
// These are the same as `obj.foo(1, 2, 3);`
3636
obj.foo.call(obj, 1, 2, 3);
3737
obj.foo.apply(obj, [1, 2, 3]);
3838
```

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ const source = `https://github.com/oxc-project/oxc/blob/${ data }/crates/oxc_lin
1717

1818
Disallows the use of the `void` operator.
1919

20-
Why is this bad
20+
### Why is this bad?
2121

22-
The `void` operator is often used to get `undefined`,
23-
but this is unnecessary because `undefined` can be used directly instead.
22+
The `void` operator is often used to get `undefined`, but this is
23+
unnecessary because `undefined` can be used directly instead.
2424

2525
### Examples
2626

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
<!-- This file is auto-generated by tasks/website/src/linter/rules/doc_page.rs. Do not edit it manually. -->
2+
3+
<script setup>
4+
import { data } from '../version.data.js';
5+
const source = `https://github.com/oxc-project/oxc/blob/${ data }/crates/oxc_linter/src/rules/eslint/prefer_destructuring.rs`;
6+
</script>
7+
8+
# eslint/prefer-destructuring <Badge type="info" text="Style" />
9+
10+
<div class="rule-meta">
11+
<Alert class="fix" type="info">
12+
<span class="emoji">🚧</span> An auto-fix is still under development.
13+
</Alert>
14+
</div>
15+
16+
### What it does
17+
18+
Require destructuring from arrays and/or objects
19+
20+
### Why is this bad?
21+
22+
With JavaScript ES6, a new syntax was added for creating variables from an array index or object property,
23+
called destructuring. This rule enforces usage of destructuring
24+
instead of accessing a property through a member expression.
25+
26+
### Examples
27+
28+
Examples of **incorrect** code for this rule:
29+
30+
```js
31+
// With `array` enabled
32+
const foo = array[0];
33+
bar.baz = array[0];
34+
// With `object` enabled
35+
const qux = object.qux;
36+
const quux = object["quux"];
37+
```
38+
39+
Examples of **correct** code for this rule:
40+
41+
```js
42+
// With `array` enabled
43+
const [foo] = array;
44+
const arr = array[someIndex];
45+
[bar.baz] = array;
46+
47+
// With `object` enabled
48+
const { baz } = object;
49+
const obj = object.bar;
50+
```
51+
52+
### Options
53+
54+
This rule takes two arguments, both of which are objects.
55+
The first object parameter determines what types of destructuring the rule applies to.
56+
In the first object, there are two properties, array and object,
57+
that can be used to turn on or off the destructuring requirement for each of those types independently.
58+
By default, both are true.
59+
60+
```json
61+
{
62+
"prefer-destructuring": ["error", { "array": true, "object": true }]
63+
}
64+
```
65+
66+
Alternatively, you can use separate configurations for different assignment types.
67+
The first argument accepts two other keys instead of array and object.
68+
One key is VariableDeclarator and the other is AssignmentExpression,
69+
which can be used to control the destructuring requirement for each of those types independently
70+
71+
```json
72+
{
73+
"prefer-destructuring": [
74+
"error",
75+
{
76+
"VariableDeclarator": { "array": true, "object": true },
77+
"AssignmentExpression": { "array": true, "object": true }
78+
}
79+
]
80+
}
81+
```
82+
83+
#### enforceForRenamedProperties
84+
85+
The rule has a second object argument with a single key,
86+
enforceForRenamedProperties, which determines whether the object destructuring applies to renamed variables.
87+
88+
```json
89+
{
90+
"prefer-destructuring": ["error", { "array": true, "object": true }, { "enforceForRenamedProperties": true }]
91+
}
92+
```
93+
94+
## How to use
95+
96+
To **enable** this rule in the CLI or using the config file, you can use:
97+
98+
::: code-group
99+
100+
```bash [CLI]
101+
oxlint --deny prefer-destructuring
102+
```
103+
104+
```json [Config (.oxlintrc.json)]
105+
{
106+
"rules": {
107+
"prefer-destructuring": "error"
108+
}
109+
}
110+
```
111+
112+
:::
113+
114+
## References
115+
116+
- <a v-bind:href="source" target="_blank" rel="noreferrer">Rule Source</a>

src/docs/guide/usage/linter/rules/jest/no-alias-methods.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ This rule ensures that only the canonical name as used in the Jest documentation
2020
### Why is this bad?
2121

2222
These aliases are going to be removed in the next major version of Jest - see [jestjs/jest#13164](https://github.com/jestjs/jest/issues/13164) for more.
23-
This rule will makes it easier to search for all occurrences of the method within code, and it ensures consistency among the method names used.
23+
This rule will make it easier to search for all occurrences of the method within code, and it ensures consistency among the method names used.
2424

2525
### Examples
2626

0 commit comments

Comments
 (0)