Latest Results
docs(linter): Add config option docs for various rules. (#16024)
Part of #14743.
- `typescript/consistent-type-imports`
- `eslint/no-else-return`
- `react/state-in-constructor`
- `eslint/no-cond-assign`
- `eslint/default-case`
- `react/jsx-handler-names`
- `eslint/new-cap`
Generated docs:
typescript/consistent-type-imports:
```md
## Configuration
This rule accepts a configuration object with the following properties:
### disallowTypeAnnotations
type: `boolean`
Disallow using `import()` in type annotations, like `type T = import('foo')`
### fixStyle
type: `"separate-type-imports" | "inline-type-imports"`
Control how type imports are added when auto-fixing.
#### `"separate-type-imports"`
Will add the type keyword after the import keyword `import type { A } from '...'`
#### `"inline-type-imports"`
Will inline the type keyword `import { type A } from '...'` (only available in TypeScript 4.5+)
### prefer
type: `"type-imports" | "no-type-imports"`
Control whether to enforce type imports or value imports.
#### `"type-imports"`
Will enforce that you always use `import type Foo from '...'` except referenced by metadata of decorators.
#### `"no-type-imports"`
Will enforce that you always use `import Foo from '...'`
```
eslint/no-else-return:
```md
## Configuration
This rule accepts a configuration object with the following properties:
### allowElseIf
type: `boolean`
default: `true`
Whether to allow `else if` blocks after a return statement.
Examples of **incorrect** code for this rule with `allowElseIf: false`:
\```javascript
function foo() {
if (error) {
return 'It failed';
} else if (loading) {
return "It's still loading";
}
}
\```
Examples of **correct** code for this rule with `allowElseIf: false`:
\```javascript
function foo() {
if (error) {
return 'It failed';
}
if (loading) {
return "It's still loading";
}
}
\```
```
react/state-in-constructor:
```md
## Configuration
This rule accepts one of the following string values:
### `"always"`
Enforce state initialization in the constructor.
### `"never"`
Enforce state initialization with a class property.
```
eslint/no-cond-assign:
```md
## Configuration
This rule accepts one of the following string values:
### `"except-parens"`
Allow assignments in conditional expressions only if they are
enclosed in parentheses.
### `"always"`
Disallow all assignments in conditional expressions.
```
eslint/default-case:
```md
## Configuration
This rule accepts a configuration object with the following properties:
### commentPattern
type: `[
string,
null
]`
A regex pattern used to detect comments that mark the absence
of a `default` case as intentional.
Default value: `no default`.
Examples of **incorrect** code for this rule with the `{ "commentPattern": "^skip\\sdefault" }` option:
\```js
/* default-case: ["error", { "commentPattern": "^skip\sdefault" }] */
switch (a) {
case 1:
break;
// no default
}
\```
Examples of **correct** code for this rule with the `{ "commentPattern": "^skip\\sdefault" }` option:
\```js
/* default-case: ["error", { "commentPattern": "^skip\\sdefault" }] */
switch (a) {
case 1:
break;
// skip default
}
\```
```
eslint/no-fallthrough:
```md
## Configuration
This rule accepts a configuration object with the following properties:
### allowEmptyCase
type: `boolean`
default: `false`
Whether to allow empty case clauses to fall through.
### commentPattern
type: `[
string,
null
]`
Custom regex pattern to match fallthrough comments.
### reportUnusedFallthroughComment
type: `boolean`
default: `false`
Whether to report unused fallthrough comments.
```
react/jsx-handler-names:
```md
## Configuration
This rule accepts a configuration object with the following properties:
### checkInlineFunctions
type: `boolean`
default: `false`
Whether to check for inline functions in JSX attributes.
### checkLocalVariables
type: `boolean`
default: `false`
Whether to check for local variables in JSX attributes.
### eventHandlerPrefixes
type: `string`
default: `"handle"`
Event handler prefixes to check against.
### eventHandlerPropPrefixes
type: `string`
default: `"on"`
Event handler prop prefixes to check against.
### eventHandlerPropRegex
type: `[
string,
null
]`
Compiled regex for event handler prop prefixes.
### eventHandlerRegex
type: `[
string,
null
]`
Compiled regex for event handler prefixes.
### ignoreComponentNames
type: `string[]`
default: `[]`
Component names to ignore when checking for event handler prefixes.
```
eslint/new-cap:
```md
## Configuration
This rule accepts a configuration object with the following properties:
### capIsNew
type: `boolean`
default: `true`
Whether to enforce that functions with names starting with an uppercase letter are only used as constructors.
### capIsNewExceptionPattern
type: `[
string,
null
]`
A regex pattern to match exceptions for functions with names starting with an uppercase letter.
### capIsNewExceptions
type: `string[]`
default: `[]`
Exceptions to ignore for functions with names starting with an uppercase letter.
### newIsCap
type: `boolean`
default: `true`
Whether to enforce that constructor names start with an uppercase letter.
### newIsCapExceptionPattern
type: `[
string,
null
]`
A regex pattern to match exceptions for constructor names starting with an uppercase letter.
### newIsCapExceptions
type: `string[]`
default: `["Array", "Boolean", "Date", "Error", "Function", "Number", "Object", "RegExp", "String", "Symbol", "BigInt"]`
Exceptions to ignore for constructor names starting with an uppercase letter.
### properties
type: `boolean`
default: `true`
Whether to check member expressions (e.g., `obj.Method()`).
``` Active Branches
#160380%
#16036+5%
#160350%
© 2025 CodSpeed Technology