Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/docs/guide/usage/linter/generated-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -434,3 +434,22 @@ Example:
```

##### settings.react.linkComponents[n]

### settings.vitest

type: `object`

Configure Vitest plugin rules.

See [eslint-plugin-vitest](https://github.com/veritem/eslint-plugin-vitest)'s
configuration for a full reference.

#### settings.vitest.typecheck

type: `boolean`

default: `false`

Whether to enable typecheck mode for Vitest rules.
When enabled, some rules will skip certain checks for describe blocks
to accommodate TypeScript type checking scenarios.
5 changes: 3 additions & 2 deletions src/docs/guide/usage/linter/generated-rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

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

- Total number of rules: 610
- Total number of rules: 611
- Rules turned on by default: 103

**Legend for 'Fixable?' column:**
Expand Down Expand Up @@ -374,7 +374,7 @@ code that is most likely wrong or useless.
| [no-required-prop-with-default](/docs/guide/usage/linter/rules/vue/no-required-prop-with-default.html) | vue | | 🚧 |
| [require-default-export](/docs/guide/usage/linter/rules/vue/require-default-export.html) | vue | | |

## Pedantic (102):
## Pedantic (103):

Lints which are rather strict or have occasional false positives.

Expand Down Expand Up @@ -438,6 +438,7 @@ Lints which are rather strict or have occasional false positives.
| [require-await](/docs/guide/usage/linter/rules/typescript/require-await.html) | typescript | | 🚧 |
| [restrict-plus-operands](/docs/guide/usage/linter/rules/typescript/restrict-plus-operands.html) | typescript | | 🚧 |
| [return-await](/docs/guide/usage/linter/rules/typescript/return-await.html) | typescript | | 🚧 |
| [strict-boolean-expressions](/docs/guide/usage/linter/rules/typescript/strict-boolean-expressions.html) | typescript | | 🚧 |
| [switch-exhaustiveness-check](/docs/guide/usage/linter/rules/typescript/switch-exhaustiveness-check.html) | typescript | | 🚧 |
| [consistent-assert](/docs/guide/usage/linter/rules/unicorn/consistent-assert.html) | unicorn | | 🛠️ |
| [consistent-empty-array-spread](/docs/guide/usage/linter/rules/unicorn/consistent-empty-array-spread.html) | unicorn | | 💡 |
Expand Down
12 changes: 12 additions & 0 deletions src/docs/guide/usage/linter/rules/eslint/getter-return.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,18 @@ class Person {
}
```

## Configuration

This rule accepts a configuration object with the following properties:

### allowImplicit

type: `boolean`

default: `false`

When set to `true`, allows getters to implicitly return `undefined` with a `return` statement containing no expression.

## How to use

To **enable** this rule in the CLI or using the config file, you can use:
Expand Down
44 changes: 44 additions & 0 deletions src/docs/guide/usage/linter/rules/eslint/id-length.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,50 @@ const data = { "x": 1 }; // excused because of quotes
data["y"] = 3; // excused because of calculated property access
```

## Configuration

This rule accepts a configuration object with the following properties:

### exceptionPatterns

type: `string[]`

An array of regex patterns for identifiers to exclude from the rule.
For example, `["^x.*"]` would exclude all identifiers starting with "x".

### exceptions

type: `string[]`

default: `[]`

An array of identifier names that are excluded from the rule.
For example, `["x", "y", "z"]` would allow single-letter identifiers "x", "y", and "z".

### max

type: `integer`

default: `18446744073709551615`

The maximum number of graphemes allowed in an identifier.
Defaults to no maximum (effectively unlimited).

### min

type: `integer`

default: `2`

The minimum number of graphemes required in an identifier.

### properties

type: `"always" | "never"`

When set to `"never"`, property names are not checked for length.
When set to `"always"` (default), property names are checked just like other identifiers.

## How to use

To **enable** this rule in the CLI or using the config file, you can use:
Expand Down
20 changes: 20 additions & 0 deletions src/docs/guide/usage/linter/rules/eslint/init-declarations.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,26 @@ Examples of correct code for the "never", { "ignoreForLoopInit": true } options:
for (var i = 0; i < 1; i++) {}
```

## Configuration

This rule accepts a configuration object with the following properties:

### ignoreForLoopInit

type: `boolean`

default: `false`

When set to `true`, allows uninitialized variables in the init expression of `for`, `for-in`, and `for-of` loops.
Only applies when mode is set to `"never"`.

### mode

type: `"always" | "never"`

When set to `"always"` (default), requires that variables be initialized on declaration.
When set to `"never"`, disallows initialization during declaration.

## How to use

To **enable** this rule in the CLI or using the config file, you can use:
Expand Down
20 changes: 20 additions & 0 deletions src/docs/guide/usage/linter/rules/eslint/max-classes-per-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,26 @@ function foo() {
}
```

## Configuration

This rule accepts a configuration object with the following properties:

### ignoreExpressions

type: `boolean`

default: `false`

Whether to ignore class expressions when counting classes.

### max

type: `integer`

default: `1`

The maximum number of classes allowed per file.

## How to use

To **enable** this rule in the CLI or using the config file, you can use:
Expand Down
21 changes: 6 additions & 15 deletions src/docs/guide/usage/linter/rules/eslint/max-nested-callbacks.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,26 +61,17 @@ function handleFoo4() {
}
```

### Options
## Configuration

#### max
This rule accepts a configuration object with the following properties:

`{ type: number, default: 10 }`
### max

The `max` enforces a maximum depth that callbacks can be nested.

Example:
type: `integer`

```json
"eslint/max-nested-callbacks": ["error", 10]
default: `10`

"eslint/max-nested-callbacks": [
"error",
{
max: 10
}
]
```
The `max` enforces a maximum depth that callbacks can be nested.

## How to use

Expand Down
12 changes: 12 additions & 0 deletions src/docs/guide/usage/linter/rules/eslint/no-empty.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,18 @@ if (condition) {
}
```

## Configuration

This rule accepts a configuration object with the following properties:

### allowEmptyCatch

type: `boolean`

default: `false`

If set to `true`, allows an empty `catch` block without triggering the linter.

## How to use

To **enable** this rule in the CLI or using the config file, you can use:
Expand Down
19 changes: 7 additions & 12 deletions src/docs/guide/usage/linter/rules/eslint/no-eval.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,15 @@ class A {
}
```

### Options
## Configuration

#### allowIndirect
This rule accepts a configuration object with the following properties:

`{ type: boolean, default: true }`
### allowIndirect

type: `boolean`

default: `true`

This `allowIndirect` option allows indirect `eval()` calls.

Expand All @@ -79,15 +83,6 @@ than direct calls because they cannot dynamically change the scope.
Indirect `eval()` calls also typically have less impact on performance
compared to direct calls, as they do not invoke JavaScript's scope chain.

Example:

```json
"eslint/no-eval": [
"error",
{ "allowIndirect": true }
]
```

## How to use

To **enable** this rule in the CLI or using the config file, you can use:
Expand Down
12 changes: 12 additions & 0 deletions src/docs/guide/usage/linter/rules/eslint/no-extend-native.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,18 @@ x.prototype.p = 0;
Object.defineProperty(x.prototype, "p", { value: 0 });
```

## Configuration

This rule accepts a configuration object with the following properties:

### exceptions

type: `string[]`

default: `[]`

A list of objects which are allowed to be exceptions to the rule.

## How to use

To **enable** this rule in the CLI or using the config file, you can use:
Expand Down
16 changes: 16 additions & 0 deletions src/docs/guide/usage/linter/rules/eslint/no-extra-boolean-cast.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,22 @@ if (foo) {}
if (foo || bar) {}
```

## Configuration

This rule accepts a configuration object with the following properties:

### enforceForInnerExpressions

type: `boolean`

default: `false`

when set to `true`, in addition to checking default contexts, checks
whether extra boolean casts are present in expressions whose result is
used in a boolean context. See examples below. Default is `false`,
meaning that this rule by default does not warn about extra booleans
cast inside inner expressions.

## How to use

To **enable** this rule in the CLI or using the config file, you can use:
Expand Down
24 changes: 14 additions & 10 deletions src/docs/guide/usage/linter/rules/eslint/no-labels.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,18 @@ while (true) {
}
```

### Options
## Configuration

The options allow labels with loop or switch statements:
This rule accepts a configuration object with the following properties:

- `"allowLoop"` (`boolean`, default is `false`) - If this option was set `true`, this rule ignores labels which are sticking to loop statements.
- `"allowSwitch"` (`boolean`, default is `false`) - If this option was set `true`, this rule ignores labels which are sticking to switch statements.
### allowLoop

Actually labeled statements in JavaScript can be used with other than loop and switch statements.
However, this way is ultra rare, not well-known, so this would be confusing developers.
type: `boolean`

#### allowLoop
default: `false`

Examples of **correct** code for the `{ "allowLoop": true }` option:
If set to `true`, this rule ignores labels which are sticking to loop statements.
Examples of **correct** code with this option set to `true`:

```js
label:
Expand All @@ -104,9 +103,14 @@ while (true) {
}
```

#### allowSwitch
### allowSwitch

Examples of **correct** code for the `{ "allowSwitch": true }` option:
type: `boolean`

default: `false`

If set to `true`, this rule ignores labels which are sticking to switch statements.
Examples of **correct** code with this option set to `true`:

```js
label:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,18 @@ Examples of **correct** code for this rule:
new RegExp("^[\u{1F1EF}\u{1F1F5}]", "u");
```

#### Options
## Configuration

This rule has an object option:
This rule accepts a configuration object with the following properties:

- `allowEscape`: When set to `true`, the rule allows any grouping of code points
inside a character class as long as they are written using escape sequences.
### allowEscape

type: `boolean`

default: `false`

When set to `true`, the rule allows any grouping of code points
inside a character class as long as they are written using escape sequences.

Examples of **incorrect** code for this rule with `{ "allowEscape": true }`:

Expand Down
Loading