You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs(linter): Add config option docs for 7 rules. (#15209)
Part of #14743.
- eslint/no-self-assign
- jest/prefer-lowercase-title
- jsx-a11y/label-has-associated-control
- jsx-a11y/media-has-caption
- jsx-a11y/no-noninteractive-tabindex
- promise/spec-only
- typescript/consistent-generic-constructors
For `jsx-a11y/no-noninteractive-tabindex`, this required changing the
way this is implemented slightly so we properly derive the default
value, otherwise the JsonSchema derivation complained.
Generated docs:
```md
## Configuration
This rule accepts a configuration object with the following properties:
### props
type: `boolean`
default: `true`
The `props` option when set to `false`, disables the checking of properties.
With `props` set to `false` the following are examples of correct code:
\```javascript
obj.a = obj.a;
obj.a.b = obj.a.b;
obj["a"] = obj["a"];
obj[a] = obj[a];
\```
```
```md
## Configuration
This rule accepts a configuration object with the following properties:
### option
default: `"constructor"`
Specifies where the generic type should be specified.
Possible values:
- `"constructor"` (default):Type arguments that only appear on the type annotation are disallowed.
- `"type-annotation"`: Type arguments that only appear on the constructor are disallowed.
```
```md
## Configuration
This rule accepts a configuration object with the following properties:
### allowedPrefixes
type: `string[]`
default: `[]`
This array option allows specifying prefixes, which contain capitals that titles
can start with. This can be useful when writing tests for API endpoints, where
you'd like to prefix with the HTTP method.
By default, nothing is allowed (the equivalent of `{ "allowedPrefixes": [] }`).
Example of **correct** code for the `{ "allowedPrefixes": ["GET"] }` option:
\```js
/* eslint jest/prefer-lowercase-title: ["error", { "allowedPrefixes": ["GET"] }] */
describe('GET /live');
\```
### ignore
type: `string[]`
default: `[]`
This array option controls which Jest or Vitest functions are checked by this rule. There
are four possible values:
- `"describe"`
- `"test"`
- `"it"`
- `"bench"`
By default, none of these options are enabled (the equivalent of
`{ "ignore": [] }`).
Example of **correct** code for the `{ "ignore": ["describe"] }` option:
\```js
/* eslint jest/prefer-lowercase-title: ["error", { "ignore": ["describe"] }] */
describe('Uppercase description');
\```
Example of **correct** code for the `{ "ignore": ["test"] }` option:
\```js
/* eslint jest/prefer-lowercase-title: ["error", { "ignore": ["test"] }] */
test('Uppercase description');
\```
Example of **correct** code for the `{ "ignore": ["it"] }` option:
\```js
/* eslint jest/prefer-lowercase-title: ["error", { "ignore": ["it"] }] */
it('Uppercase description');
\```
### ignoreTopLevelDescribe
type: `boolean`
default: `false`
This option can be set to allow only the top-level `describe` blocks to have a
title starting with an upper-case letter.
Example of **correct** code for the `{ "ignoreTopLevelDescribe": true }` option:
\```js
/* eslint jest/prefer-lowercase-title: ["error", { "ignoreTopLevelDescribe": true }] */
describe('MyClass', () => {
describe('#myMethod', () => {
it('does things', () => {
//
});
});
});
\```
### lowercaseFirstCharacterOnly
type: `boolean`
default: `true`
This option can be set to only validate that the first character of a test name is lowercased.
Example of **correct** code for the `{ "lowercaseFirstCharacterOnly": true }` option:
\```js
/* eslint vitest/prefer-lowercase-title: ["error", { "lowercaseFirstCharacterOnly": true }] */
describe('myClass', () => {
describe('myMethod', () => {
it('does things', () => {
//
});
});
});
\```
Example of **incorrect** code for the `{ "lowercaseFirstCharacterOnly": true }` option:
\```js
/* eslint vitest/prefer-lowercase-title: ["error", { "lowercaseFirstCharacterOnly": true }] */
describe('MyClass', () => {
describe('MyMethod', () => {
it('does things', () => {
//
});
});
});
\```
```
```md
## Configuration
This rule accepts a configuration object with the following properties:
### audio
type: `string[]`
default: `["audio"]`
Element names to treat as `<audio>` elements
### track
type: `string[]`
default: `["track"]`
Element names to treat as `<track>` elements
### video
type: `string[]`
default: `["video"]`
Element names to treat as `<video>` elements
```
```md
## Configuration
This rule accepts a configuration object with the following properties:
### assert
type: `"html-for" | "nesting" | "both" | "either"`
default: `"either"`
The type of association required between the label and the control.
### controlComponents
type: `string[]`
default: `[]`
Custom JSX components to be treated as form controls.
### depth
type: `integer`
default: `2`
Maximum depth to search for a nested control.
### labelAttributes
type: `string[]`
default: `["alt", "aria-label", "aria-labelledby"]`
Attributes to check for accessible label text.
### labelComponents
type: `string[]`
default: `["label"]`
Custom JSX components to be treated as labels.
```
```md
## Configuration
This rule accepts a configuration object with the following properties:
### allowExpressionValues
type: `boolean`
default: `true`
If `true`, allows tabIndex values to be expression values (e.g., variables, ternaries). If `false`, only string literal values are allowed.
### roles
type: `string[]`
default: `["tabpanel"]`
An array of ARIA roles that should be considered interactive.
### tags
type: `string[]`
default: `[]`
An array of custom HTML elements that should be considered interactive.
```
```md
## Configuration
This rule accepts a configuration object with the following properties:
### allowedMethods
type: `string[]`
default: `null`
List of Promise static methods that are allowed to be used.
```
---------
Signed-off-by: Connor Shea <connor.james.shea@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
0 commit comments