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
39 changes: 33 additions & 6 deletions .vitepress/data/rules.json
Original file line number Diff line number Diff line change
Expand Up @@ -686,10 +686,10 @@
{
"scope": "eslint",
"value": "no-iterator",
"category": "restriction",
"category": "correctness",
"type_aware": false,
"fix": "fixable_suggestion",
"default": false,
"default": true,
"docs_url": "https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-iterator.html"
},
{
Expand Down Expand Up @@ -758,10 +758,10 @@
{
"scope": "eslint",
"value": "no-misleading-character-class",
"category": "nursery",
"category": "correctness",
"type_aware": false,
"fix": "none",
"default": false,
"default": true,
"docs_url": "https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-misleading-character-class.html"
},
{
Expand Down Expand Up @@ -3887,6 +3887,15 @@
"default": false,
"docs_url": "https://oxc.rs/docs/guide/usage/linter/rules/typescript/consistent-indexed-object-style.html"
},
{
"scope": "typescript",
"value": "consistent-type-assertions",
"category": "style",
"type_aware": false,
"fix": "conditional_safe_fix_or_suggestion",
"default": false,
"docs_url": "https://oxc.rs/docs/guide/usage/linter/rules/typescript/consistent-type-assertions.html"
},
{
"scope": "typescript",
"value": "consistent-type-definitions",
Expand Down Expand Up @@ -5332,7 +5341,7 @@
"value": "prefer-dom-node-dataset",
"category": "pedantic",
"type_aware": false,
"fix": "pending",
"fix": "conditional_fix",
"default": false,
"docs_url": "https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-dom-node-dataset.html"
},
Expand Down Expand Up @@ -5512,7 +5521,7 @@
"value": "prefer-reflect-apply",
"category": "style",
"type_aware": false,
"fix": "pending",
"fix": "fixable_suggestion",
"default": false,
"docs_url": "https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-reflect-apply.html"
},
Expand Down Expand Up @@ -5633,6 +5642,15 @@
"default": false,
"docs_url": "https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-type-error.html"
},
{
"scope": "unicorn",
"value": "relative-url-style",
"category": "style",
"type_aware": false,
"fix": "pending",
"default": false,
"docs_url": "https://oxc.rs/docs/guide/usage/linter/rules/unicorn/relative-url-style.html"
},
{
"scope": "unicorn",
"value": "require-array-join-separator",
Expand Down Expand Up @@ -5786,6 +5804,15 @@
"default": false,
"docs_url": "https://oxc.rs/docs/guide/usage/linter/rules/vitest/prefer-describe-function-title.html"
},
{
"scope": "vitest",
"value": "prefer-expect-type-of",
"category": "style",
"type_aware": false,
"fix": "fixable_fix",
"default": false,
"docs_url": "https://oxc.rs/docs/guide/usage/linter/rules/vitest/prefer-expect-type-of.html"
},
{
"scope": "vitest",
"value": "prefer-to-be-falsy",
Expand Down
2 changes: 1 addition & 1 deletion src/docs/guide/usage/formatter/generated-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ search: false
## Available positional items:

- _`PATH`_ —
Single file, single path or list of paths. If not provided, current working directory is used. Glob is supported only for exclude patterns like `'!**/fixtures/*.js'`.
Single file, path or list of paths. Glob patterns are also supported. (Be sure to quote them, otherwise your shell may expand them before passing.) Exclude patterns with `!` prefix like `'!**/fixtures/*.js'` are also supported. If not provided, current working directory is used.

## Available options:

Expand Down
2 changes: 0 additions & 2 deletions src/docs/guide/usage/formatter/generated-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ type: `"auto" | "off"`
Control whether to format embedded parts (For example, CSS-in-JS, or JS-in-Vue, etc.) in the file.

NOTE: XXX-in-JS support is incomplete.
JS-in-XXX is fully supported but still be handled by Prettier.

- Default: `"auto"`

Expand Down Expand Up @@ -445,7 +444,6 @@ type: `"auto" | "off"`
Control whether to format embedded parts (For example, CSS-in-JS, or JS-in-Vue, etc.) in the file.

NOTE: XXX-in-JS support is incomplete.
JS-in-XXX is fully supported but still be handled by Prettier.

- Default: `"auto"`

Expand Down
38 changes: 35 additions & 3 deletions src/docs/guide/usage/linter/generated-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,14 @@ Example
"globals": {
"foo": "readonly"
},
"settings": {},
"settings": {
"react": {
"version": "18.2.0"
},
"custom": {
"option": true
}
},
"rules": {
"eqeqeq": "warn",
"import/no-cycle": "error",
Expand Down Expand Up @@ -157,7 +164,33 @@ Read more about JS plugins in
[the docs](https://oxc.rs/docs/guide/usage/linter/js-plugins.html).

Note: JS plugins are experimental and not subject to semver.
They are not supported in the language server (and thus editor integrations) at present.

Examples:

Basic usage with a local plugin path.

```json
{
"jsPlugins": ["./custom-plugin.js"],
"rules": {
"custom/rule-name": "warn"
}
}
```

Using a built-in Rust plugin alongside a JS plugin with the same name
by giving the JS plugin an alias.

```json
{
"plugins": ["import"],
"jsPlugins": [{ "name": "import-js", "specifier": "eslint-plugin-import" }],
"rules": {
"import/no-cycle": "error",
"import-js/no-unresolved": "warn"
}
}
```

### jsPlugins[n]

Expand Down Expand Up @@ -231,7 +264,6 @@ Read more about JS plugins in
[the docs](https://oxc.rs/docs/guide/usage/linter/js-plugins.html).

Note: JS plugins are experimental and not subject to semver.
They are not supported in the language server (and thus editor integrations) at present.

##### overrides[n].jsPlugins[n]

Expand Down
6 changes: 3 additions & 3 deletions src/docs/guide/usage/linter/rules/eslint/no-iterator.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "eslint/no-iterator"
category: "Restriction"
default: false
category: "Correctness"
default: true
type_aware: false
fix: "fixable_suggestion"
---
Expand All @@ -17,7 +17,7 @@ const source = `https://github.com/oxc-project/oxc/blob/${ data }/crates/oxc_lin

### What it does

Disallow the use of the `__iterator__` property
Disallow the use of the `__iterator__` property.

### Why is this bad?

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "eslint/no-misleading-character-class"
category: "Nursery"
default: false
category: "Correctness"
default: true
type_aware: false
fix: "none"
---
Expand Down
16 changes: 13 additions & 3 deletions src/docs/guide/usage/linter/rules/import/max-dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,21 @@ const source = `https://github.com/oxc-project/oxc/blob/${ data }/crates/oxc_lin

### What it does

Forbid modules to have too many dependencies (import or require statements).
Forbid modules to have too many dependencies (`import` statements only).

### Why is this bad?

This is a useful rule because a module with too many dependencies is a code smell,
and usually indicates the module is doing too much and/or should be broken up into
smaller modules.

**NOTE**: This rule only counts `import` statements, and does not count dependencies from
CommonJS `require()` statements. This is a difference from the original
eslint-import-plugin rule.

### Examples

Given `{"max": 2}`
Given `{ "max": 2 }`

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

Expand Down Expand Up @@ -56,13 +60,19 @@ default: `false`

Whether to ignore type imports when counting dependencies.

```ts
// Neither of these count as dependencies if `ignoreTypeImports` is true:
import type { Foo } from "./foo";
import { type Foo } from "./foo";
```

### max

type: `integer`

default: `10`

Maximum number of dependencies allowed in a module.
Maximum number of dependencies allowed in a file.

## How to use

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ var _ = require("lodash");
var foo = require("foo");
var foo = require("./foo");

/* eslint import/no-nodejs-modules: ["error", {"allow": ["path"]}] */
/* import/no-nodejs-modules: ["error", {"allow": ["path"]}] */
import path from "path";
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,20 @@ Examples of **correct** code for this rule:
<Blink />
```

## Configuration

This rule accepts a configuration object with the following properties:

### elements

type: `array`

List of distracting elements to check for.

#### elements[n]

type: `"marquee" | "blink"`

## How to use

To **enable** this rule using the config file or in the CLI, you can use:
Expand Down
19 changes: 15 additions & 4 deletions src/docs/guide/usage/linter/rules/jsx_a11y/no-redundant-roles.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,36 @@ const source = `https://github.com/oxc-project/oxc/blob/${ data }/crates/oxc_lin

### What it does

Enforces that the explicit `role` property is not the same as
implicit/default role property on element.
Enforces that code does not include a redundant `role` property, in the
case that it's identical to the implicit `role` property of the
element type.

### Why is this bad?

Redundant roles can lead to confusion and verbosity in the codebase.

### Examples

This rule applies for the following elements and their implicit roles:

- `<nav>`: `navigation`
- `<button>`: `button`
- `<body>`: `document`

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

```jsx
<nav role="navigation" />
<nav role="navigation"></nav>
<button role="button"></button>
<body role="document"></body>
```

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

```jsx
<nav />
<nav></nav>
<button></button>
<body></body>
```

## How to use
Expand Down
Loading