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
2 changes: 0 additions & 2 deletions src/docs/guide/usage/linter/generated-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,6 @@ Globs to ignore during linting. These are resolved from the configuration file p

type: `string[]`

default: `null`

JS plugins.

Note: JS plugins are experimental and not subject to semver.
Expand Down
13 changes: 8 additions & 5 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: 607
- Total number of rules: 610
- Rules turned on by default: 103

**Legend for 'Fixable?' column:**
Expand Down Expand Up @@ -235,7 +235,7 @@ Code that can be written to run faster.
| [prefer-array-flat-map](/docs/guide/usage/linter/rules/unicorn/prefer-array-flat-map.html) | unicorn | | 🛠️ |
| [prefer-set-has](/docs/guide/usage/linter/rules/unicorn/prefer-set-has.html) | unicorn | | ⚠️🛠️️ |

## Restriction (77):
## Restriction (78):

Lints which prevent the use of language and library features. Must not be enabled as a whole, should be considered on a case-by-case basis before enabling.

Expand Down Expand Up @@ -274,7 +274,7 @@ Lints which prevent the use of language and library features. Must not be enable
| [anchor-ambiguous-text](/docs/guide/usage/linter/rules/jsx_a11y/anchor-ambiguous-text.html) | jsx_a11y | | |
| [no-new-require](/docs/guide/usage/linter/rules/node/no-new-require.html) | node | | |
| [no-process-env](/docs/guide/usage/linter/rules/node/no-process-env.html) | node | | |
| [bad-bitwise-operator](/docs/guide/usage/linter/rules/oxc/bad-bitwise-operator.html) | oxc | | |
| [bad-bitwise-operator](/docs/guide/usage/linter/rules/oxc/bad-bitwise-operator.html) | oxc | | 🚧 |
| [no-async-await](/docs/guide/usage/linter/rules/oxc/no-async-await.html) | oxc | | |
| [no-barrel-file](/docs/guide/usage/linter/rules/oxc/no-barrel-file.html) | oxc | | |
| [no-const-enum](/docs/guide/usage/linter/rules/oxc/no-const-enum.html) | oxc | | 🛠️ |
Expand All @@ -283,6 +283,7 @@ Lints which prevent the use of language and library features. Must not be enable
| [catch-or-return](/docs/guide/usage/linter/rules/promise/catch-or-return.html) | promise | | |
| [spec-only](/docs/guide/usage/linter/rules/promise/spec-only.html) | promise | | |
| [button-has-type](/docs/guide/usage/linter/rules/react/button-has-type.html) | react | | |
| [forbid-dom-props](/docs/guide/usage/linter/rules/react/forbid-dom-props.html) | react | | |
| [forbid-elements](/docs/guide/usage/linter/rules/react/forbid-elements.html) | react | | |
| [jsx-filename-extension](/docs/guide/usage/linter/rules/react/jsx-filename-extension.html) | react | | 🚧 |
| [no-danger](/docs/guide/usage/linter/rules/react/no-danger.html) | react | | |
Expand Down Expand Up @@ -373,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 (101):
## Pedantic (102):

Lints which are rather strict or have occasional false positives.

Expand All @@ -400,6 +401,7 @@ Lints which are rather strict or have occasional false positives.
| [no-redeclare](/docs/guide/usage/linter/rules/eslint/no-redeclare.html) | eslint | | |
| [no-self-compare](/docs/guide/usage/linter/rules/eslint/no-self-compare.html) | eslint | | |
| [no-throw-literal](/docs/guide/usage/linter/rules/eslint/no-throw-literal.html) | eslint | | 💡 |
| [no-warning-comments](/docs/guide/usage/linter/rules/eslint/no-warning-comments.html) | eslint | | |
| [radix](/docs/guide/usage/linter/rules/eslint/radix.html) | eslint | | ⚠️🛠️️ |
| [require-await](/docs/guide/usage/linter/rules/eslint/require-await.html) | eslint | | ⚠️🛠️️ |
| [sort-vars](/docs/guide/usage/linter/rules/eslint/sort-vars.html) | eslint | | 🚧 |
Expand Down Expand Up @@ -652,12 +654,13 @@ Code that should be written in a more idiomatic way.
| [define-props-destructuring](/docs/guide/usage/linter/rules/vue/define-props-destructuring.html) | vue | | |
| [require-typed-ref](/docs/guide/usage/linter/rules/vue/require-typed-ref.html) | vue | | |

## Nursery (10):
## Nursery (11):

New lints that are still under development.

| Rule name | Source | Default | Fixable? |
| --------------------------------------------------------------------------------------------------------- | ------- | ------- | -------- |
| [constructor-super](/docs/guide/usage/linter/rules/eslint/constructor-super.html) | eslint | | |
| [getter-return](/docs/guide/usage/linter/rules/eslint/getter-return.html) | eslint | | |
| [no-misleading-character-class](/docs/guide/usage/linter/rules/eslint/no-misleading-character-class.html) | eslint | | |
| [no-undef](/docs/guide/usage/linter/rules/eslint/no-undef.html) | eslint | | |
Expand Down
64 changes: 60 additions & 4 deletions src/docs/guide/usage/linter/rules/eslint/constructor-super.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,78 @@
<!-- This file is auto-generated by tasks/website/src/linter/rules/doc_page.rs. Do not edit it manually. -->

<script setup>
import { data } from '../version.data.js';
const source = `https://github.com/oxc-project/oxc/blob/${ data }/crates/oxc_linter/src/rules/eslint/constructor_super.rs`;
</script>

# eslint/constructor-super <Badge type="info" text="Nursery" />

<div class="rule-meta">
</div>

### What it does

Require 'super()' calls in constructors.
Requires `super()` calls in constructors of derived classes and disallows `super()` calls
in constructors of non-derived classes.

### Why is this bad?

### Example
In JavaScript, calling `super()` in the constructor of a derived class (a class that extends
another class) is required. Failing to do so will result in a ReferenceError at runtime.
Conversely, calling `super()` in a non-derived class is a syntax error.

### Examples

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

```javascript
```js
// Missing super() call
class A extends B {
constructor() {}
}

// super() in non-derived class
class A {
constructor() {
super();
}
}

// super() only in some code paths
class C extends D {
constructor() {
if (condition) {
super();
}
}
}
```

Examples of **correct** code for this rule:

```js
// Proper super() call in derived class
class A extends B {
constructor() {
super();
}
}

// No super() in non-derived class
class A {
constructor() {}
}

// super() in all code paths
class C extends D {
constructor() {
if (condition) {
super();
} else {
super();
}
}
}
```

## How to use
Expand All @@ -41,4 +97,4 @@ oxlint --deny constructor-super

## References

- [Rule Source](https://github.com/oxc-project/oxc/blob/c22276e8fbbf443c4293a3cfe7758ac1ceea325c/crates/oxc_linter/src/rules/eslint/constructor_super.rs)
- <a v-bind:href="source" target="_blank" rel="noreferrer">Rule Source</a>
6 changes: 6 additions & 0 deletions src/docs/guide/usage/linter/rules/eslint/func-style.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,18 +154,24 @@ type: `boolean`

default: `false`

When true, arrow functions are allowed regardless of the style setting.

### allowTypeAnnotation

type: `boolean`

default: `false`

When true, functions with type annotations are allowed regardless of the style setting.

### style

type: `"expression" | "declaration"`

default: `"expression"`

The style to enforce. Either "expression" (default) or "declaration".

## How to use

To **enable** this rule in the CLI or using the config file, you can use:
Expand Down
8 changes: 8 additions & 0 deletions src/docs/guide/usage/linter/rules/eslint/max-depth.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@ Example:
]
```

## Configuration

This rule accepts a configuration object with the following properties:

### max

type: `integer`

## How to use

To **enable** this rule in the CLI or using the config file, you can use:
Expand Down
4 changes: 2 additions & 2 deletions src/docs/guide/usage/linter/rules/eslint/max-params.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ let foo = (bar, baz, qux) => {

### Options

### max
#### max

`{ "max": number }`

Expand All @@ -64,7 +64,7 @@ This option is for changing the maximum allowed number of function parameters.
For example `{ "max": 4 }` would mean that having a function take four
parameters is allowed which overrides the default of three.

### countVoidThis
#### countVoidThis

`{ "countVoidThis": boolean }`

Expand Down
20 changes: 13 additions & 7 deletions src/docs/guide/usage/linter/rules/eslint/no-empty-function.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,23 @@ Disallows the usages of empty functions
Empty functions can reduce readability because readers need to guess whether it's
intentional or not. So writing a clear comment for empty functions is a good practice.

### Configuration
### Options

You may pass an object containing a list of `allow`ed function kinds.
For example:
#### allow

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

You may pass a list of allowed function kinds, which will allow functions of
these kinds to be empty.

Example:

```json
// oxlint.json
{
"rules": {
"no-empty-function": ["error", { "allow": ["functions"] }]
}
"no-empty-function": [
"error",
{ "allow": ["functions"] }
]
}
```

Expand Down
12 changes: 12 additions & 0 deletions src/docs/guide/usage/linter/rules/eslint/no-invalid-regexp.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,18 @@ new RegExp();
this.RegExp("[");
```

## Configuration

This rule accepts a configuration object with the following properties:

### allowConstructorFlags

type: `string[]`

default: `[]`

Case-sensitive array of flags that will be allowed.

## 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 @@ -36,11 +36,11 @@ function example() {

Examples of **correct** code for this rule:

````javascript
```javascript
function example() {
var foo = 'bar'; // regular spaces only
var foo = "bar"; // regular spaces only
}

```

## How to use

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

```bash [CLI]
oxlint --deny no-irregular-whitespace
````
```

```json [Config (.oxlintrc.json)]
{
Expand Down
28 changes: 28 additions & 0 deletions src/docs/guide/usage/linter/rules/eslint/no-param-reassign.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,34 @@ function baz(qux) {
}
```

## Configuration

This rule accepts a configuration object with the following properties:

### ignorePropertyModificationsFor

type: `string[]`

default: `[]`

An array of parameter names whose property modifications should be ignored.

### ignorePropertyModificationsForRegex

type: `string[]`

An array of regex patterns (as strings) for parameter names whose property modifications should be ignored.
Note that this uses [Rust regex syntax](https://docs.rs/regex/latest/regex/) and so may not have all features
available to JavaScript regexes.

### props

type: `boolean`

default: `false`

When true, also check for modifications to properties of parameters.

## How to use

To **enable** this rule in the CLI or using the config file, you can use:
Expand Down
29 changes: 14 additions & 15 deletions src/docs/guide/usage/linter/rules/eslint/no-plusplus.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,28 +56,27 @@ for (let i = 0; i < l; i++) {

Examples of **correct** code for this rule:

````js
var x = 0; x += 1;
var y = 0; y -= 1;
```js
var x = 0;
x += 1;
var y = 0;
y -= 1;
for (let i = 0; i < l; i += 1) {
doSomething(i);
doSomething(i);
}
```

## Configuration

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

#### allowForLoopAfterthoughts
### allowForLoopAfterthoughts

`{ type: boolean, default: false }`
type: `boolean`

Pass `"allowForLoopAfterthoughts": true` to allow `++` and `--` in for loop afterthoughts.
default: `false`

Example:
```json
"no-plusplus": [
"error",
{ "allowForLoopAfterthoughts": true }
]
````
Whether to allow `++` and `--` in for loop afterthoughts.

## How to use

Expand Down
Loading