Skip to content
Closed
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
2 changes: 2 additions & 0 deletions src/docs/guide/usage/linter/generated-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ Arguments:
Disable the automatic loading of nested configuration files
- **`--type-aware`** —
Enable rules that require type information
- **`--type-check`** —
Enable experimental type checking (includes TypeScript compiler diagnostics)
- **`-h`**, **`--help`** —
Prints help information
- **`-V`**, **`--version`** —
Expand Down
10 changes: 6 additions & 4 deletions src/docs/guide/usage/linter/generated-rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ search: false

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

- Total number of rules: 615
- Total number of rules: 617
- Rules turned on by default: 103

**Legend for 'Fixable?' column:**
Expand Down Expand Up @@ -345,7 +345,7 @@ code that is most likely wrong or useless.
| [no-self-import](/docs/guide/usage/linter/rules/import/no-self-import.html) | import | | |
| [no-unassigned-import](/docs/guide/usage/linter/rules/import/no-unassigned-import.html) | import | | |
| [no-commented-out-tests](/docs/guide/usage/linter/rules/jest/no-commented-out-tests.html) | jest | | |
| [approx-constant](/docs/guide/usage/linter/rules/oxc/approx-constant.html) | oxc | | |
| [approx-constant](/docs/guide/usage/linter/rules/oxc/approx-constant.html) | oxc | | 🚧 |
| [misrefactored-assign-op](/docs/guide/usage/linter/rules/oxc/misrefactored-assign-op.html) | oxc | | 🚧 |
| [no-async-endpoint-handlers](/docs/guide/usage/linter/rules/oxc/no-async-endpoint-handlers.html) | oxc | | |
| [always-return](/docs/guide/usage/linter/rules/promise/always-return.html) | promise | | |
Expand Down Expand Up @@ -377,7 +377,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 (105):
## Pedantic (106):

Lints which are rather strict or have occasional false positives.

Expand Down Expand Up @@ -437,6 +437,7 @@ Lints which are rather strict or have occasional false positives.
| [no-unsafe-return](/docs/guide/usage/linter/rules/typescript/no-unsafe-return.html) | typescript | | 🚧 |
| [only-throw-error](/docs/guide/usage/linter/rules/typescript/only-throw-error.html) | typescript | | 🚧 |
| [prefer-enum-initializers](/docs/guide/usage/linter/rules/typescript/prefer-enum-initializers.html) | typescript | | 🚧 |
| [prefer-includes](/docs/guide/usage/linter/rules/typescript/prefer-includes.html) | typescript | | 🚧 |
| [prefer-promise-reject-errors](/docs/guide/usage/linter/rules/typescript/prefer-promise-reject-errors.html) | typescript | | 🚧 |
| [prefer-ts-expect-error](/docs/guide/usage/linter/rules/typescript/prefer-ts-expect-error.html) | typescript | | 🛠️ |
| [related-getter-setter-pairs](/docs/guide/usage/linter/rules/typescript/related-getter-setter-pairs.html) | typescript | | 🚧 |
Expand Down Expand Up @@ -489,7 +490,7 @@ Lints which are rather strict or have occasional false positives.
| [prefer-type-error](/docs/guide/usage/linter/rules/unicorn/prefer-type-error.html) | unicorn | | 🛠️ |
| [require-number-to-fixed-digits-argument](/docs/guide/usage/linter/rules/unicorn/require-number-to-fixed-digits-argument.html) | unicorn | | 🛠️ |

## Style (167):
## Style (168):

Code that should be written in a more idiomatic way.

Expand Down Expand Up @@ -634,6 +635,7 @@ Code that should be written in a more idiomatic way.
| [number-literal-case](/docs/guide/usage/linter/rules/unicorn/number-literal-case.html) | unicorn | | 🛠️ |
| [numeric-separators-style](/docs/guide/usage/linter/rules/unicorn/numeric-separators-style.html) | unicorn | | 🛠️ |
| [prefer-array-index-of](/docs/guide/usage/linter/rules/unicorn/prefer-array-index-of.html) | unicorn | | 🚧 |
| [prefer-bigint-literals](/docs/guide/usage/linter/rules/unicorn/prefer-bigint-literals.html) | unicorn | | 🛠️ |
| [prefer-class-fields](/docs/guide/usage/linter/rules/unicorn/prefer-class-fields.html) | unicorn | | 🛠️💡 |
| [prefer-classlist-toggle](/docs/guide/usage/linter/rules/unicorn/prefer-classlist-toggle.html) | unicorn | | 🛠️ |
| [prefer-dom-node-text-content](/docs/guide/usage/linter/rules/unicorn/prefer-dom-node-text-content.html) | unicorn | | 🛠️ |
Expand Down
8 changes: 6 additions & 2 deletions src/docs/guide/usage/linter/rules/eslint/curly.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,12 @@ Examples of **correct** code for this rule:
```js
/* curly: ["error", "all"] */

if (foo) foo++;
while (bar) bar--;
if (foo) {
foo++;
}
while (bar) {
bar--;
}
do {
foo();
} while (bar);
Expand Down
7 changes: 5 additions & 2 deletions src/docs/guide/usage/linter/rules/eslint/no-const-assign.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ Disallow reassigning `const` variables.

### Why is this bad?

We cannot modify variables that are declared using const keyword.
It will raise a runtime error.
We cannot modify variables that are declared using the `const` keyword,
as it will raise a runtime error.

Note that this rule is not necessary for TypeScript
code, as TypeScript will already catch this as an error.

### Examples

Expand Down
20 changes: 20 additions & 0 deletions src/docs/guide/usage/linter/rules/eslint/no-inner-declarations.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,36 @@ This rule accepts a configuration object with the following properties:

### blockScopedFunctions

type: `"allow" | "disallow"`

default: `null`

Controls whether function declarations in nested blocks are allowed in strict mode (ES6+ behavior).

#### `"allow"`

Allow function declarations in nested blocks in strict mode (ES6+ behavior).

#### `"disallow"`

Disallow function declarations in nested blocks regardless of strict mode.

### config

type: `"functions" | "both"`

default: `"functions"`

Determines what type of declarations to check.

#### `"functions"`

Disallows function declarations in nested blocks.

#### `"both"`

Disallows function and var declarations in nested blocks.

## How to use

To **enable** this rule in the CLI or using the config file, you can use:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const source = `https://github.com/oxc-project/oxc/blob/${ data }/crates/oxc_lin

### What it does

Disallow control flow statements in finally blocks
Disallow control flow statements in `finally` blocks.

### Why is this bad?

Expand Down
27 changes: 27 additions & 0 deletions src/docs/guide/usage/linter/rules/eslint/no-unused-vars.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ This rule accepts a configuration object with the following properties:

### args

type: `"afterUsed" | "all" | "none"`

Controls how unused arguments are checked.

This option has three settings:
Expand All @@ -198,6 +200,20 @@ This option has three settings:
2. `all` - All named arguments must be used.
3. `none` - Do not check arguments.

#### `"afterUsed"`

Unused positional arguments that occur before the last used argument
will not be checked, but all named arguments and all positional
arguments after the last used argument will be checked.

#### `"all"`

All named arguments must be used

#### `"none"`

Do not check arguments

### caughtErrors

type: `boolean`
Expand Down Expand Up @@ -366,6 +382,8 @@ function foo(): typeof foo {}

### vars

type: `"all" | "local"`

Controls how usage of a variable in the global scope is checked.

This option has two settings:
Expand All @@ -375,6 +393,15 @@ This option has two settings:
2. `local` checks only that locally-declared variables are used but will
allow global variables to be unused.

#### `"all"`

All variables are checked for usage, including those in the global scope.

#### `"local"`

Checks only that locally-declared variables are used but will allow
global variables to be unused.

## How to use

To **enable** this rule in the CLI or using the config file, you can use:
Expand Down
20 changes: 5 additions & 15 deletions src/docs/guide/usage/linter/rules/eslint/operator-assignment.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,25 +64,15 @@ x.y = x.y / a.b;

## Configuration

This rule accepts a configuration object with the following properties:
This rule accepts one of the following string values:

### mode
### `"always"`

type: `"always" | "never"`
Requires assignment operator shorthand where possible.

default: `"always"`
### `"never"`

This rule has a single string option:

- `always` requires assignment operator shorthand where possible
- `never` disallows assignment operator shorthand

Example:

```json
"eslint/operator-assignment": ["error", "always"]
"eslint/operator-assignment": ["error", "never"]
```
Disallows assignment operator shorthand.

## How to use

Expand Down
26 changes: 13 additions & 13 deletions src/docs/guide/usage/linter/rules/eslint/sort-keys.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,48 +44,48 @@ let myObj = {

## Configuration

This rule accepts a configuration object with the following properties:
### The 1st option

### allowLineSeparatedGroups
type: `"desc" | "asc"`

Sorting order for keys. Accepts "asc" for ascending or "desc" for descending.

### The 2nd option

This option is an object with the following properties:

#### allowLineSeparatedGroups

type: `boolean`

default: `false`

When true, groups of properties separated by a blank line are sorted independently.

### caseSensitive
#### caseSensitive

type: `boolean`

default: `true`

Whether the sort comparison is case-sensitive (A < a when true).

### minKeys
#### minKeys

type: `integer`

default: `2`

Minimum number of properties required in an object before sorting is enforced.

### natural
#### natural

type: `boolean`

default: `false`

Use natural sort order so that, for example, "a2" comes before "a10".

### sortOrder

type: `"desc" | "asc"`

default: `"asc"`

Sorting order for keys. Accepts "asc" for ascending or "desc" for descending.

## How to use

To **enable** this rule in the CLI or using the config file, you can use:
Expand Down
74 changes: 73 additions & 1 deletion src/docs/guide/usage/linter/rules/jsdoc/require-param.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ Requires that all function parameters are documented with JSDoc `@param` tags.

### Why is this bad?

The rule is aimed at enforcing code quality and maintainability by requiring that all function parameters are documented.
The rule is aimed at enforcing code quality and maintainability by requiring
that all function parameters are documented.

### Examples

Expand All @@ -34,6 +35,77 @@ Examples of **correct** code for this rule:
function quux(foo) {}
```

## Configuration

This rule accepts a configuration object with the following properties:

### checkConstructors

type: `boolean`

default: `false`

Whether to check constructor methods.

### checkDestructured

type: `boolean`

default: `true`

Whether to check destructured parameters.

### checkDestructuredRoots

type: `boolean`

default: `true`

Whether to check destructured parameters when you have code like
`function doSomething({ a, b }) { ... }`. Because there is no named
parameter in this example, when this option is `true` you must
have a `@param` tag that corresponds to `{a, b}`.

### checkGetters

type: `boolean`

default: `true`

Whether to check getter methods.

### checkRestProperty

type: `boolean`

default: `false`

Whether to check rest properties.

### checkSetters

type: `boolean`

default: `true`

Whether to check setter methods.

### checkTypesPattern

type: `string`

default: `"^(?:[oO]bject|[aA]rray|PlainObject|Generic(?:Object|Array))$"`

Regex pattern to match types that exempt parameters from checking.

### exemptedBy

type: `string[]`

default: `["inheritdoc"]`

List of JSDoc tags that exempt functions from `@param` checking.

## How to use

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