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
5,072 changes: 2,554 additions & 2,518 deletions .vitepress/data/rules.json

Large diffs are not rendered by default.

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 @@ -11,7 +11,7 @@ search: false
- **` --init`** —
Initialize `.oxfmtrc.json` with default values
- **` --migrate`**=_`SOURCE`_ —
Migrate configuration to `.oxfmtrc.json` from specified source Available sources: prettier
Migrate configuration to `.oxfmtrc.json` from specified source Available sources: prettier, biome
- **` --lsp`** —
Start language server protocol (LSP) server
- **` --stdin-filepath`**=_`PATH`_ —
Expand Down
58 changes: 46 additions & 12 deletions src/docs/guide/usage/linter/rules/eslint/capitalized-comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,52 +43,86 @@ Examples of **correct** code for this rule with the default `"always"` option:

## Configuration

This rule accepts a configuration object with the following properties:
Configuration for the capitalized-comments rule.

### block
The first element specifies whether comments should `"always"` or `"never"`
begin with a capital letter. The second element is an optional object
containing additional options.

### The 1st option

type: `"always" | "never"`

### The 2nd option

This option is an object with the following properties:

#### block

type: `object`

#### block.ignoreConsecutiveComments
Configuration options specific to block comments.

##### block.ignoreConsecutiveComments

type: `boolean`

#### block.ignoreInlineComments
If true, consecutive comments will be ignored after the first comment.

##### block.ignoreInlineComments

type: `boolean`

#### block.ignorePattern
If true, inline comments (comments in the middle of code) will be ignored.

##### block.ignorePattern

type: `string`

### ignoreConsecutiveComments
A regex pattern. Comments that match the pattern will not cause violations.

#### ignoreConsecutiveComments

type: `boolean`

### ignoreInlineComments
If true, consecutive comments will be ignored after the first comment.

#### ignoreInlineComments

type: `boolean`

### ignorePattern
If true, inline comments (comments in the middle of code) will be ignored.

#### ignorePattern

type: `string`

### line
A regex pattern. Comments that match the pattern will not cause violations.

#### line

type: `object`

#### line.ignoreConsecutiveComments
Configuration options specific to line comments.

##### line.ignoreConsecutiveComments

type: `boolean`

#### line.ignoreInlineComments
If true, consecutive comments will be ignored after the first comment.

##### line.ignoreInlineComments

type: `boolean`

#### line.ignorePattern
If true, inline comments (comments in the middle of code) will be ignored.

##### line.ignorePattern

type: `string`

A regex pattern. Comments that match the pattern will not cause violations.

## How to use

To **enable** this rule using the config file or in the CLI, you can use:
Expand Down
37 changes: 24 additions & 13 deletions src/docs/guide/usage/linter/rules/eslint/curly.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,28 +224,39 @@ if (foo) {

## Configuration

This rule accepts a configuration object with the following properties:
Configuration for the curly rule, specified as an array of one or two elements.

### consistent
Examples:

type: `boolean`
- `["all"]` - Require braces in all cases (default)
- `["multi"]` - Require braces only for multi-statement blocks
- `["multi-line"]` - Require braces for multi-line blocks
- `["multi-or-nest"]` - Require braces for nested or multi-line blocks
- `["multi", "consistent"]` - Multi mode with consistent braces in if-else chains

default: `false`
### The 1st option

Whether to enforce consistent use of curly braces in if-else chains.
type: `"all" | "multi" | "multi-line" | "multi-or-nest"`

### curlyType
The enforcement type for the curly rule.

type: `"all" | "multi" | "multi-line" | "multi-or-nest"`
#### `"all"`

Require braces in all cases (default)

#### `"multi"`

default: `"all"`
Require braces only when there are multiple statements in the block

#### `"multi-line"`

Require braces when the block spans multiple lines

#### `"multi-or-nest"`

Which type of curly brace enforcement to use.
Require braces when the block is nested or spans multiple lines

- `"all"`: require braces in all cases
- `"multi"`: require braces only for multi-statement blocks
- `"multi-line"`: require braces only for multi-line blocks
- `"multi-or-nest"`: require braces for multi-line blocks or when nested
### The 2nd option

## How to use

Expand Down
54 changes: 27 additions & 27 deletions src/docs/guide/usage/linter/rules/eslint/no-restricted-imports.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ and provide a higher maintenance cost of two dependencies when one would suffice
Examples of **incorrect** code for this rule:

```js
/*eslint no-restricted-imports: ["error", "disallowed-import"]"*/
/* no-restricted-imports: ["error", "disallowed-import"] */

import foo from "disallowed-import";
export * from "disallowed-import";
Expand All @@ -43,7 +43,7 @@ export * from "disallowed-import";
Examples of **correct** code for this rule:

```js
/*eslint no-restricted-imports: ["error", "fs"]*/
/* no-restricted-imports: ["error", "fs"] */

import crypto from "crypto";
export * from "bar";
Expand All @@ -58,10 +58,10 @@ The custom message will be displayed as a help text for the user.
Examples of **incorrect** code for this rule:

```js
/*eslint no-restricted-imports: ["error", {
/* no-restricted-imports: ["error", {
"name": "disallowed-import",
"message": "Please use 'allowed-import' instead"
}]*/
}] */

import foo from "disallowed-import";
```
Expand All @@ -77,7 +77,7 @@ This is an object option whose value is an array containing the names of the mod
Examples of **incorrect** code for `paths`:

```js
/*eslint no-restricted-imports: ["error", { "paths": ["cluster"] }]*/
/* no-restricted-imports: ["error", { "paths": ["cluster"] }] */

import cluster from "cluster";
```
Expand Down Expand Up @@ -107,13 +107,13 @@ Specifying `"default"` string inside the `importNames` array will restrict the d
Examples of **incorrect** code for this rule:

```js
/*eslint no-restricted-imports: ["error", { paths: [{
/* no-restricted-imports: ["error", { paths: [{
"name": "foo",
"importNames": ["default"]
}, {
"name": "bar",
"importNames": ["Baz"]
}]}]*/
}]}] */

import DisallowedObject from "foo";
import { Baz } from "far";
Expand All @@ -129,11 +129,11 @@ Note: `allowImportNames` cannot be used in combination with `importNames`.
Examples of **incorrect** code for this rule:

```js
/*eslint no-restricted-imports: ["error", { paths: [{
/* no-restricted-imports: ["error", { paths: [{
"name": "foo",
"allowImportNames": ["AllowedObject"],
"message": "Please use only 'AllowedObject' from 'foo'."
}]}]*/
}]}] */

import { DisallowedObject } from "foo";
```
Expand All @@ -145,10 +145,10 @@ Whether to allow type-only imports for a path. Default: `false`.
Examples of **incorrect** code for this rule:

```typescript
/*eslint no-restricted-imports: ["error", { paths: [{
/* no-restricted-imports: ["error", { paths: [{
"name": "foo",
"allowTypeImports": true
}]}]*/
}]}] */

import foo from "import-foo";
export { Foo } from "import-foo";
Expand All @@ -157,10 +157,10 @@ export { Foo } from "import-foo";
Examples of **correct** code for this rule:

```typescript
/*eslint no-restricted-imports: ["error", { paths: [{
/* no-restricted-imports: ["error", { paths: [{
"name": "foo",
"allowTypeImports": true
}]}]*/
}]}] */

import type foo from "import-foo";
export type { Foo } from "import-foo";
Expand Down Expand Up @@ -204,15 +204,15 @@ You can also use regular expressions to restrict modules (see the `regex` option
Examples of **incorrect** code for `patterns` option:

```js
/*eslint no-restricted-imports: ["error", { "patterns": ["lodash/*"] }]*/
/* no-restricted-imports: ["error", { "patterns": ["lodash/*"] }] */

import pick from "lodash/pick";
```

Examples of **correct** code for `patterns` option:

```js
/*eslint no-restricted-imports: ["error", { "patterns": ["crypto/*"] }]*/
/* no-restricted-imports: ["error", { "patterns": ["crypto/*"] }] */

import crypto from "crypto";
```
Expand All @@ -227,10 +227,10 @@ Either of the `group` or `regex` properties is required when using the `patterns
Examples of **incorrect** code for `group` option:

```js
/*eslint no-restricted-imports: ["error", { patterns: [{
/* no-restricted-imports: ["error", { patterns: [{
group: ["lodash/*"],
message: "Please use the default import from 'lodash' instead."
}]}]*/
}]}] */

import pick from "lodash/pick";
```
Expand All @@ -247,9 +247,9 @@ like Lookahead and Lookbehinds.
Examples of **incorrect** code for `regex` option:

```js
/*eslint no-restricted-imports: ["error", { patterns: [{
/* no-restricted-imports: ["error", { patterns: [{
regex: "@app/(api|enums).*",
}]}]*/
}]}] */

import Foo from "@app/api";
import Bar from "@app/api/bar";
Expand All @@ -271,11 +271,11 @@ In this case, the specified names apply only to the associated `group` or `regex
Examples of **incorrect** code for `importNames` in `patterns`:

```js
/*eslint no-restricted-imports: ["error", { patterns: [{
/* no-restricted-imports: ["error", { patterns: [{
group: ["utils/*"],
importNames: ['isEmpty'],
message: "Use 'isEmpty' from lodash instead."
}]}]*/
}]}] */

import { isEmpty } from "utils/collection-utils";
```
Expand All @@ -294,11 +294,11 @@ This option allows you to use regex patterns to restrict import names.
Examples of **incorrect** code for `importNamePattern` option:

```js
/*eslint no-restricted-imports: ["error", { patterns: [{
/* no-restricted-imports: ["error", { patterns: [{
group: ["foo/*"],
importNamePattern: '^(is|has)',
message: "Use 'is*' and 'has*' functions from baz/bar instead"
}]}]*/
}]}] */

import { isSomething, hasSomething } from "foo/bar";
```
Expand All @@ -322,21 +322,21 @@ Note: `allowImportNamePattern` cannot be used in combination with `importNames`,
Examples of **incorrect** code for `allowImportNamePattern` option:

```js
/*eslint no-restricted-imports: ["error", { patterns: [{
/* no-restricted-imports: ["error", { patterns: [{
group: ["utils/*"],
allowImportNamePattern: '^has'
}]}]*/
}]}] */

import { isEmpty } from "utils/collection-utils";
```

Examples of **correct** code for `allowImportNamePattern` option:

```js
/*eslint no-restricted-imports: ["error", { patterns: [{
/* no-restricted-imports: ["error", { patterns: [{
group: ["utils/*"],
allowImportNamePattern: '^is'
}]}]*/
}]}] */

import { isEmpty } from "utils/collection-utils";
```
Expand Down
Loading