@aiou/eslint-config 3.0.2 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +131 -0
- package/dist/index.mjs +13 -8
- package/dts/typegen.d.ts +135 -335
- package/package.json +4 -4
- package/readme.md +0 -77
package/README.md
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# @aiou/eslint-config
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@aiou/eslint-config) [](https://github.com/JiangWeixian/eslint-config/tree/master/packages/default)
|
|
4
|
+
|
|
5
|
+
Flat ESLint config with TypeScript, React, SSR, and more.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- Common ignore patterns (dist, lib, .next, .nuxt, lock files, etc.)
|
|
10
|
+
- TypeScript, YAML, JSONC, Markdown, TOML support
|
|
11
|
+
- Built-in React rules via `@eslint-react`, react-refresh, and SSR-safe linting
|
|
12
|
+
- Auto-detected framework support (Next.js, Tailwind CSS)
|
|
13
|
+
- Import sorting, unused import removal, and multi-line import enforcement
|
|
14
|
+
- Sorted keys for `package.json` and `tsconfig.json`
|
|
15
|
+
- Visual linting progress reporter
|
|
16
|
+
|
|
17
|
+
<div align='center'>
|
|
18
|
+
|
|
19
|
+
<img src="https://user-images.githubusercontent.com/6839576/148364688-6a9fa8ac-94a3-4897-89fc-a3b64606e93c.png" width="400px" />
|
|
20
|
+
|
|
21
|
+
*▲ @aiou/eslint-plugin-progress*
|
|
22
|
+
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
## Install
|
|
26
|
+
|
|
27
|
+
```console
|
|
28
|
+
npm install @aiou/eslint-config --save-dev
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Requires **Node.js >= 20.19** and **ESLint >= 10**.
|
|
32
|
+
|
|
33
|
+
## Usage
|
|
34
|
+
|
|
35
|
+
In `eslint.config.mjs`:
|
|
36
|
+
|
|
37
|
+
```js
|
|
38
|
+
import { aiou } from '@aiou/eslint-config'
|
|
39
|
+
|
|
40
|
+
export default await aiou()
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### With Options
|
|
44
|
+
|
|
45
|
+
```js
|
|
46
|
+
import { aiou } from '@aiou/eslint-config'
|
|
47
|
+
|
|
48
|
+
export default await aiou({
|
|
49
|
+
ssr: true,
|
|
50
|
+
regexp: true,
|
|
51
|
+
})
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### With Custom Overrides
|
|
55
|
+
|
|
56
|
+
```js
|
|
57
|
+
import { aiou } from '@aiou/eslint-config'
|
|
58
|
+
|
|
59
|
+
export default await aiou(
|
|
60
|
+
{ ssr: false },
|
|
61
|
+
{
|
|
62
|
+
ignores: ['**/generated/**'],
|
|
63
|
+
rules: {
|
|
64
|
+
'no-console': 'off',
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
)
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
`aiou()` returns a `FlatConfigComposer` — you can chain `.append()`, `.override()`, etc.
|
|
71
|
+
|
|
72
|
+
## Options
|
|
73
|
+
|
|
74
|
+
| Option | Type | Default | Description |
|
|
75
|
+
|--------|------|---------|-------------|
|
|
76
|
+
| `ssr` | `boolean` | `true` | Enable SSR-safe rules — forbids direct access to `window`, `document`, `navigator`, `location`, `history`, `localStorage` without `typeof` guards |
|
|
77
|
+
| `regexp` | `boolean` | `true` | Enable `eslint-plugin-regexp` recommended rules |
|
|
78
|
+
|
|
79
|
+
## Auto-Detection
|
|
80
|
+
|
|
81
|
+
The following plugins are enabled automatically when their packages are found in your project:
|
|
82
|
+
|
|
83
|
+
| Feature | Package | Plugin |
|
|
84
|
+
|---------|---------|--------|
|
|
85
|
+
| Next.js | `next` | `@next/eslint-plugin-next` |
|
|
86
|
+
| Tailwind CSS | `tailwindcss` | `eslint-plugin-tailwindcss` |
|
|
87
|
+
|
|
88
|
+
## Style Defaults
|
|
89
|
+
|
|
90
|
+
| Setting | Value |
|
|
91
|
+
|---------|-------|
|
|
92
|
+
| Indentation | 2 spaces |
|
|
93
|
+
| Quotes | Single (JS/TS), Double (JSX, YAML) |
|
|
94
|
+
| Semicolons | Never |
|
|
95
|
+
| Trailing commas | `always-multiline` |
|
|
96
|
+
| Arrow parens | `as-needed` |
|
|
97
|
+
| Curly | `all` |
|
|
98
|
+
| File naming | `kebab-case` (via unicorn) |
|
|
99
|
+
| Import sorting | side-effects → `node:` builtins → packages → relative/alias → virtual → types |
|
|
100
|
+
|
|
101
|
+
## Included Plugins
|
|
102
|
+
|
|
103
|
+
| Plugin | Notes |
|
|
104
|
+
|--------|-------|
|
|
105
|
+
| `@typescript-eslint/eslint-plugin` | TypeScript rules, type imports, enum prohibition |
|
|
106
|
+
| `@eslint-react/eslint-plugin` | React rules (recommended-typescript, dom, x, web-api) |
|
|
107
|
+
| `eslint-plugin-react-hooks` | Hooks rules |
|
|
108
|
+
| `eslint-plugin-react-refresh` | React Refresh compatibility |
|
|
109
|
+
| `@stylistic/eslint-plugin` | Formatting rules |
|
|
110
|
+
| `eslint-plugin-import-x` | Import rules |
|
|
111
|
+
| `eslint-plugin-simple-import-sort` | Import sorting |
|
|
112
|
+
| `eslint-plugin-import-newlines` | Multi-line import enforcement |
|
|
113
|
+
| `eslint-plugin-unused-imports` | Unused import/variable removal |
|
|
114
|
+
| `eslint-plugin-unicorn` | Best practice rules |
|
|
115
|
+
| `eslint-plugin-n` | Node.js rules |
|
|
116
|
+
| `eslint-plugin-promise` | Promise rules |
|
|
117
|
+
| `eslint-plugin-jsonc` | JSON/JSONC rules + sorted `package.json`/`tsconfig.json` keys |
|
|
118
|
+
| `eslint-plugin-yml` | YAML rules |
|
|
119
|
+
| `@eslint/markdown` | Markdown linting |
|
|
120
|
+
| `eslint-plugin-toml` | TOML rules |
|
|
121
|
+
| `eslint-plugin-regexp` | RegExp rules (when `regexp: true`) |
|
|
122
|
+
| `@eslint-community/eslint-plugin-eslint-comments` | ESLint directive rules |
|
|
123
|
+
| `eslint-plugin-etc` | TypeScript extras (no single-char type params) |
|
|
124
|
+
| `@next/eslint-plugin-next` | Next.js rules (auto-detected) |
|
|
125
|
+
| `eslint-plugin-tailwindcss` | Tailwind CSS rules (auto-detected) |
|
|
126
|
+
| `@aiou/eslint-plugin-progress` | Visual progress reporter |
|
|
127
|
+
|
|
128
|
+
## Exports
|
|
129
|
+
|
|
130
|
+
- **`aiou(options?, ...userConfigs)`** — Main factory. Returns `FlatConfigComposer`.
|
|
131
|
+
- **`all`** — Full flat config array of all rules (useful for tooling/typegen).
|
package/dist/index.mjs
CHANGED
|
@@ -90,16 +90,16 @@ const imports = () => {
|
|
|
90
90
|
{
|
|
91
91
|
groups: [
|
|
92
92
|
// Side effect imports.
|
|
93
|
-
[
|
|
93
|
+
[String.raw`^\u0000`],
|
|
94
94
|
// Node.js builtins prefixed with `node:`.
|
|
95
95
|
["^node:"],
|
|
96
96
|
// Packages.
|
|
97
97
|
// Things that start with a letter (or digit or underscore), or `@` followed by a letter.
|
|
98
|
-
[
|
|
98
|
+
[String.raw`^@?\w`],
|
|
99
99
|
// Relative imports.
|
|
100
100
|
// Absolute imports and other imports such as `@/foo` or `~/foo`.
|
|
101
101
|
// Anything not matched in another group.
|
|
102
|
-
["^",
|
|
102
|
+
["^", String.raw`^\.`, String.raw`^@/\w`, String.raw`^~/\w`],
|
|
103
103
|
// Virtual modules prefixed with `virtual:` or `virtual-`, rollup & vite favor
|
|
104
104
|
["^virtual:", "^virtual-"],
|
|
105
105
|
// Types
|
|
@@ -752,7 +752,8 @@ const markdown = () => {
|
|
|
752
752
|
"import/no-default-export": "off",
|
|
753
753
|
"import/no-anonymous-default-export": "off",
|
|
754
754
|
"react-refresh/only-export-components": "off",
|
|
755
|
-
"react/jsx-no-undef": "off"
|
|
755
|
+
"react/jsx-no-undef": "off",
|
|
756
|
+
"unicorn/filename-case": "off"
|
|
756
757
|
}
|
|
757
758
|
}
|
|
758
759
|
];
|
|
@@ -829,9 +830,9 @@ const react = () => {
|
|
|
829
830
|
},
|
|
830
831
|
rules: {
|
|
831
832
|
...renameRules(pluginReact.configs["recommended-typescript"].rules, { "@eslint-react": "react" }),
|
|
832
|
-
...renameRules(pluginReact.configs
|
|
833
|
-
...renameRules(pluginReact.configs
|
|
834
|
-
...renameRules(pluginReact.configs
|
|
833
|
+
...renameRules(pluginReact.configs.dom.rules, { "@eslint-react": "react-dom" }),
|
|
834
|
+
...renameRules(pluginReact.configs.x.rules, { "@eslint-react": "react-hooks-extra" }),
|
|
835
|
+
...renameRules(pluginReact.configs.x.rules, { "@eslint-react": "react-naming-convention" }),
|
|
835
836
|
...renameRules(pluginReact.configs["web-api"].rules, { "@eslint-react": "react-web-api" }),
|
|
836
837
|
...pluginReactHooks.configs.flat.recommended.rules,
|
|
837
838
|
"react/no-nested-component-definitions": "warn",
|
|
@@ -1290,7 +1291,11 @@ const unicorn = () => {
|
|
|
1290
1291
|
"unicorn/prefer-number-properties": "error",
|
|
1291
1292
|
"unicorn/prefer-string-starts-ends-with": "error",
|
|
1292
1293
|
"unicorn/prefer-type-error": "error",
|
|
1293
|
-
"unicorn/throw-new-error": "error"
|
|
1294
|
+
"unicorn/throw-new-error": "error",
|
|
1295
|
+
"unicorn/filename-case": ["error", {
|
|
1296
|
+
case: "kebabCase",
|
|
1297
|
+
ignore: [/^[A-Z]+\.md$/, /^[A-Z]+\.yml$/, /^\.?[A-Z]/, /^Dockerfile$/]
|
|
1298
|
+
}]
|
|
1294
1299
|
}
|
|
1295
1300
|
}
|
|
1296
1301
|
];
|
package/dts/typegen.d.ts
CHANGED
|
@@ -2254,11 +2254,6 @@ export interface Rules {
|
|
|
2254
2254
|
* @see https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/valid-params.md
|
|
2255
2255
|
*/
|
|
2256
2256
|
'promise/valid-params'?: Linter.RuleEntry<PromiseValidParams>;
|
|
2257
|
-
/**
|
|
2258
|
-
* Disallows higher order functions that define components or hooks inside them.
|
|
2259
|
-
* @see https://eslint-react.xyz/docs/rules/component-hook-factories
|
|
2260
|
-
*/
|
|
2261
|
-
'react-dom/component-hook-factories'?: Linter.RuleEntry<[]>;
|
|
2262
2257
|
/**
|
|
2263
2258
|
* Disallows DOM elements from using 'dangerouslySetInnerHTML'.
|
|
2264
2259
|
* @see https://eslint-react.xyz/docs/rules/dom-no-dangerously-set-innerhtml
|
|
@@ -2339,11 +2334,6 @@ export interface Rules {
|
|
|
2339
2334
|
* @see https://eslint-react.xyz/docs/rules/dom-no-void-elements-with-children
|
|
2340
2335
|
*/
|
|
2341
2336
|
'react-dom/dom-no-void-elements-with-children'?: Linter.RuleEntry<[]>;
|
|
2342
|
-
/**
|
|
2343
|
-
* Enforces importing React DOM via a namespace import.
|
|
2344
|
-
* @see https://eslint-react.xyz/docs/rules/dom-prefer-namespace-import
|
|
2345
|
-
*/
|
|
2346
|
-
'react-dom/dom-prefer-namespace-import'?: Linter.RuleEntry<[]>;
|
|
2347
2337
|
/**
|
|
2348
2338
|
* Validates usage of Error Boundaries instead of try/catch for errors in child components.
|
|
2349
2339
|
* @see https://eslint-react.xyz/docs/rules/error-boundaries
|
|
@@ -2354,6 +2344,11 @@ export interface Rules {
|
|
|
2354
2344
|
* @see https://github.com/facebook/react/issues/14920
|
|
2355
2345
|
*/
|
|
2356
2346
|
'react-dom/exhaustive-deps'?: Linter.RuleEntry<ReactDomExhaustiveDeps>;
|
|
2347
|
+
/**
|
|
2348
|
+
* Validates against assignment/mutation of globals during render, part of ensuring that side effects must run outside of render.
|
|
2349
|
+
* @see https://eslint-react.xyz/docs/rules/globals
|
|
2350
|
+
*/
|
|
2351
|
+
'react-dom/globals'?: Linter.RuleEntry<[]>;
|
|
2357
2352
|
/**
|
|
2358
2353
|
* Validates against mutating props, state, and other values that are immutable.
|
|
2359
2354
|
* @see https://eslint-react.xyz/docs/rules/immutability
|
|
@@ -2549,11 +2544,6 @@ export interface Rules {
|
|
|
2549
2544
|
* @see https://eslint-react.xyz/docs/rules/no-nested-lazy-component-declarations
|
|
2550
2545
|
*/
|
|
2551
2546
|
'react-dom/no-nested-lazy-component-declarations'?: Linter.RuleEntry<[]>;
|
|
2552
|
-
/**
|
|
2553
|
-
* Disallows 'shouldComponentUpdate' when extending 'React.PureComponent'.
|
|
2554
|
-
* @see https://eslint-react.xyz/docs/rules/no-redundant-should-component-update
|
|
2555
|
-
*/
|
|
2556
|
-
'react-dom/no-redundant-should-component-update'?: Linter.RuleEntry<[]>;
|
|
2557
2547
|
/**
|
|
2558
2548
|
* Disallows calling 'this.setState' in 'componentDidMount' outside functions such as callbacks.
|
|
2559
2549
|
* @see https://eslint-react.xyz/docs/rules/no-set-state-in-component-did-mount
|
|
@@ -2569,16 +2559,6 @@ export interface Rules {
|
|
|
2569
2559
|
* @see https://eslint-react.xyz/docs/rules/no-set-state-in-component-will-update
|
|
2570
2560
|
*/
|
|
2571
2561
|
'react-dom/no-set-state-in-component-will-update'?: Linter.RuleEntry<[]>;
|
|
2572
|
-
/**
|
|
2573
|
-
* Disallows unnecessary usage of 'useCallback'.
|
|
2574
|
-
* @see https://eslint-react.xyz/docs/rules/no-unnecessary-use-callback
|
|
2575
|
-
*/
|
|
2576
|
-
'react-dom/no-unnecessary-use-callback'?: Linter.RuleEntry<[]>;
|
|
2577
|
-
/**
|
|
2578
|
-
* Disallows unnecessary usage of 'useMemo'.
|
|
2579
|
-
* @see https://eslint-react.xyz/docs/rules/no-unnecessary-use-memo
|
|
2580
|
-
*/
|
|
2581
|
-
'react-dom/no-unnecessary-use-memo'?: Linter.RuleEntry<[]>;
|
|
2582
2562
|
/**
|
|
2583
2563
|
* Enforces that a function with the 'use' prefix uses at least one Hook inside it.
|
|
2584
2564
|
* @see https://eslint-react.xyz/docs/rules/no-unnecessary-use-prefix
|
|
@@ -2620,7 +2600,7 @@ export interface Rules {
|
|
|
2620
2600
|
*/
|
|
2621
2601
|
'react-dom/no-unused-props'?: Linter.RuleEntry<[]>;
|
|
2622
2602
|
/**
|
|
2623
|
-
* Warns about
|
|
2603
|
+
* Warns about state variables that are defined but never used, or only used in effects.
|
|
2624
2604
|
* @see https://eslint-react.xyz/docs/rules/no-unused-state
|
|
2625
2605
|
*/
|
|
2626
2606
|
'react-dom/no-unused-state'?: Linter.RuleEntry<[]>;
|
|
@@ -2629,16 +2609,6 @@ export interface Rules {
|
|
|
2629
2609
|
* @see https://eslint-react.xyz/docs/rules/no-use-context
|
|
2630
2610
|
*/
|
|
2631
2611
|
'react-dom/no-use-context'?: Linter.RuleEntry<[]>;
|
|
2632
|
-
/**
|
|
2633
|
-
* Enforces destructuring assignment for component props and context.
|
|
2634
|
-
* @see https://eslint-react.xyz/docs/rules/prefer-destructuring-assignment
|
|
2635
|
-
*/
|
|
2636
|
-
'react-dom/prefer-destructuring-assignment'?: Linter.RuleEntry<[]>;
|
|
2637
|
-
/**
|
|
2638
|
-
* Enforces importing React via a namespace import.
|
|
2639
|
-
* @see https://eslint-react.xyz/docs/rules/prefer-namespace-import
|
|
2640
|
-
*/
|
|
2641
|
-
'react-dom/prefer-namespace-import'?: Linter.RuleEntry<[]>;
|
|
2642
2612
|
/**
|
|
2643
2613
|
* Validates that components and hooks are pure by checking that they do not call known-impure functions during render.
|
|
2644
2614
|
* @see https://eslint-react.xyz/docs/rules/purity
|
|
@@ -2669,6 +2639,11 @@ export interface Rules {
|
|
|
2669
2639
|
* @see https://eslint-react.xyz/docs/rules/set-state-in-render
|
|
2670
2640
|
*/
|
|
2671
2641
|
'react-dom/set-state-in-render'?: Linter.RuleEntry<[]>;
|
|
2642
|
+
/**
|
|
2643
|
+
* Validates that components are static, not recreated every render.
|
|
2644
|
+
* @see https://eslint-react.xyz/docs/rules/static-components
|
|
2645
|
+
*/
|
|
2646
|
+
'react-dom/static-components'?: Linter.RuleEntry<[]>;
|
|
2672
2647
|
/**
|
|
2673
2648
|
* Validates against syntax that React Compiler does not support.
|
|
2674
2649
|
* @see https://eslint-react.xyz/docs/rules/unsupported-syntax
|
|
@@ -2689,6 +2664,11 @@ export interface Rules {
|
|
|
2689
2664
|
* @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-event-listener
|
|
2690
2665
|
*/
|
|
2691
2666
|
'react-dom/web-api-no-leaked-event-listener'?: Linter.RuleEntry<[]>;
|
|
2667
|
+
/**
|
|
2668
|
+
* Enforces that every 'fetch' in a component or custom hook has a corresponding 'AbortController' abort in the cleanup function.
|
|
2669
|
+
* @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-fetch
|
|
2670
|
+
*/
|
|
2671
|
+
'react-dom/web-api-no-leaked-fetch'?: Linter.RuleEntry<[]>;
|
|
2692
2672
|
/**
|
|
2693
2673
|
* Enforces that every 'setInterval' in a component or custom hook has a corresponding 'clearInterval'.
|
|
2694
2674
|
* @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-interval
|
|
@@ -2704,11 +2684,6 @@ export interface Rules {
|
|
|
2704
2684
|
* @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-timeout
|
|
2705
2685
|
*/
|
|
2706
2686
|
'react-dom/web-api-no-leaked-timeout'?: Linter.RuleEntry<[]>;
|
|
2707
|
-
/**
|
|
2708
|
-
* Disallows higher order functions that define components or hooks inside them.
|
|
2709
|
-
* @see https://eslint-react.xyz/docs/rules/component-hook-factories
|
|
2710
|
-
*/
|
|
2711
|
-
'react-dom/x-component-hook-factories'?: Linter.RuleEntry<[]>;
|
|
2712
2687
|
/**
|
|
2713
2688
|
* Validates usage of Error Boundaries instead of try/catch for errors in child components.
|
|
2714
2689
|
* @see https://eslint-react.xyz/docs/rules/error-boundaries
|
|
@@ -2719,6 +2694,11 @@ export interface Rules {
|
|
|
2719
2694
|
* @see https://github.com/facebook/react/issues/14920
|
|
2720
2695
|
*/
|
|
2721
2696
|
'react-dom/x-exhaustive-deps'?: Linter.RuleEntry<ReactDomXExhaustiveDeps>;
|
|
2697
|
+
/**
|
|
2698
|
+
* Validates against assignment/mutation of globals during render, part of ensuring that side effects must run outside of render.
|
|
2699
|
+
* @see https://eslint-react.xyz/docs/rules/globals
|
|
2700
|
+
*/
|
|
2701
|
+
'react-dom/x-globals'?: Linter.RuleEntry<[]>;
|
|
2722
2702
|
/**
|
|
2723
2703
|
* Validates against mutating props, state, and other values that are immutable.
|
|
2724
2704
|
* @see https://eslint-react.xyz/docs/rules/immutability
|
|
@@ -2859,11 +2839,6 @@ export interface Rules {
|
|
|
2859
2839
|
* @see https://eslint-react.xyz/docs/rules/no-nested-lazy-component-declarations
|
|
2860
2840
|
*/
|
|
2861
2841
|
'react-dom/x-no-nested-lazy-component-declarations'?: Linter.RuleEntry<[]>;
|
|
2862
|
-
/**
|
|
2863
|
-
* Disallows 'shouldComponentUpdate' when extending 'React.PureComponent'.
|
|
2864
|
-
* @see https://eslint-react.xyz/docs/rules/no-redundant-should-component-update
|
|
2865
|
-
*/
|
|
2866
|
-
'react-dom/x-no-redundant-should-component-update'?: Linter.RuleEntry<[]>;
|
|
2867
2842
|
/**
|
|
2868
2843
|
* Disallows calling 'this.setState' in 'componentDidMount' outside functions such as callbacks.
|
|
2869
2844
|
* @see https://eslint-react.xyz/docs/rules/no-set-state-in-component-did-mount
|
|
@@ -2879,16 +2854,6 @@ export interface Rules {
|
|
|
2879
2854
|
* @see https://eslint-react.xyz/docs/rules/no-set-state-in-component-will-update
|
|
2880
2855
|
*/
|
|
2881
2856
|
'react-dom/x-no-set-state-in-component-will-update'?: Linter.RuleEntry<[]>;
|
|
2882
|
-
/**
|
|
2883
|
-
* Disallows unnecessary usage of 'useCallback'.
|
|
2884
|
-
* @see https://eslint-react.xyz/docs/rules/no-unnecessary-use-callback
|
|
2885
|
-
*/
|
|
2886
|
-
'react-dom/x-no-unnecessary-use-callback'?: Linter.RuleEntry<[]>;
|
|
2887
|
-
/**
|
|
2888
|
-
* Disallows unnecessary usage of 'useMemo'.
|
|
2889
|
-
* @see https://eslint-react.xyz/docs/rules/no-unnecessary-use-memo
|
|
2890
|
-
*/
|
|
2891
|
-
'react-dom/x-no-unnecessary-use-memo'?: Linter.RuleEntry<[]>;
|
|
2892
2857
|
/**
|
|
2893
2858
|
* Enforces that a function with the 'use' prefix uses at least one Hook inside it.
|
|
2894
2859
|
* @see https://eslint-react.xyz/docs/rules/no-unnecessary-use-prefix
|
|
@@ -2930,7 +2895,7 @@ export interface Rules {
|
|
|
2930
2895
|
*/
|
|
2931
2896
|
'react-dom/x-no-unused-props'?: Linter.RuleEntry<[]>;
|
|
2932
2897
|
/**
|
|
2933
|
-
* Warns about
|
|
2898
|
+
* Warns about state variables that are defined but never used, or only used in effects.
|
|
2934
2899
|
* @see https://eslint-react.xyz/docs/rules/no-unused-state
|
|
2935
2900
|
*/
|
|
2936
2901
|
'react-dom/x-no-unused-state'?: Linter.RuleEntry<[]>;
|
|
@@ -2939,16 +2904,6 @@ export interface Rules {
|
|
|
2939
2904
|
* @see https://eslint-react.xyz/docs/rules/no-use-context
|
|
2940
2905
|
*/
|
|
2941
2906
|
'react-dom/x-no-use-context'?: Linter.RuleEntry<[]>;
|
|
2942
|
-
/**
|
|
2943
|
-
* Enforces destructuring assignment for component props and context.
|
|
2944
|
-
* @see https://eslint-react.xyz/docs/rules/prefer-destructuring-assignment
|
|
2945
|
-
*/
|
|
2946
|
-
'react-dom/x-prefer-destructuring-assignment'?: Linter.RuleEntry<[]>;
|
|
2947
|
-
/**
|
|
2948
|
-
* Enforces importing React via a namespace import.
|
|
2949
|
-
* @see https://eslint-react.xyz/docs/rules/prefer-namespace-import
|
|
2950
|
-
*/
|
|
2951
|
-
'react-dom/x-prefer-namespace-import'?: Linter.RuleEntry<[]>;
|
|
2952
2907
|
/**
|
|
2953
2908
|
* Validates that components and hooks are pure by checking that they do not call known-impure functions during render.
|
|
2954
2909
|
* @see https://eslint-react.xyz/docs/rules/purity
|
|
@@ -2974,6 +2929,11 @@ export interface Rules {
|
|
|
2974
2929
|
* @see https://eslint-react.xyz/docs/rules/set-state-in-render
|
|
2975
2930
|
*/
|
|
2976
2931
|
'react-dom/x-set-state-in-render'?: Linter.RuleEntry<[]>;
|
|
2932
|
+
/**
|
|
2933
|
+
* Validates that components are static, not recreated every render.
|
|
2934
|
+
* @see https://eslint-react.xyz/docs/rules/static-components
|
|
2935
|
+
*/
|
|
2936
|
+
'react-dom/x-static-components'?: Linter.RuleEntry<[]>;
|
|
2977
2937
|
/**
|
|
2978
2938
|
* Validates against syntax that React Compiler does not support.
|
|
2979
2939
|
* @see https://eslint-react.xyz/docs/rules/unsupported-syntax
|
|
@@ -2989,11 +2949,6 @@ export interface Rules {
|
|
|
2989
2949
|
* @see https://eslint-react.xyz/docs/rules/use-state
|
|
2990
2950
|
*/
|
|
2991
2951
|
'react-dom/x-use-state'?: Linter.RuleEntry<ReactDomXUseState>;
|
|
2992
|
-
/**
|
|
2993
|
-
* Disallows higher order functions that define components or hooks inside them.
|
|
2994
|
-
* @see https://eslint-react.xyz/docs/rules/component-hook-factories
|
|
2995
|
-
*/
|
|
2996
|
-
'react-hooks-extra/component-hook-factories'?: Linter.RuleEntry<[]>;
|
|
2997
2952
|
/**
|
|
2998
2953
|
* Disallows DOM elements from using 'dangerouslySetInnerHTML'.
|
|
2999
2954
|
* @see https://eslint-react.xyz/docs/rules/dom-no-dangerously-set-innerhtml
|
|
@@ -3074,11 +3029,6 @@ export interface Rules {
|
|
|
3074
3029
|
* @see https://eslint-react.xyz/docs/rules/dom-no-void-elements-with-children
|
|
3075
3030
|
*/
|
|
3076
3031
|
'react-hooks-extra/dom-no-void-elements-with-children'?: Linter.RuleEntry<[]>;
|
|
3077
|
-
/**
|
|
3078
|
-
* Enforces importing React DOM via a namespace import.
|
|
3079
|
-
* @see https://eslint-react.xyz/docs/rules/dom-prefer-namespace-import
|
|
3080
|
-
*/
|
|
3081
|
-
'react-hooks-extra/dom-prefer-namespace-import'?: Linter.RuleEntry<[]>;
|
|
3082
3032
|
/**
|
|
3083
3033
|
* Validates usage of Error Boundaries instead of try/catch for errors in child components.
|
|
3084
3034
|
* @see https://eslint-react.xyz/docs/rules/error-boundaries
|
|
@@ -3089,6 +3039,11 @@ export interface Rules {
|
|
|
3089
3039
|
* @see https://github.com/facebook/react/issues/14920
|
|
3090
3040
|
*/
|
|
3091
3041
|
'react-hooks-extra/exhaustive-deps'?: Linter.RuleEntry<ReactHooksExtraExhaustiveDeps>;
|
|
3042
|
+
/**
|
|
3043
|
+
* Validates against assignment/mutation of globals during render, part of ensuring that side effects must run outside of render.
|
|
3044
|
+
* @see https://eslint-react.xyz/docs/rules/globals
|
|
3045
|
+
*/
|
|
3046
|
+
'react-hooks-extra/globals'?: Linter.RuleEntry<[]>;
|
|
3092
3047
|
/**
|
|
3093
3048
|
* Validates against mutating props, state, and other values that are immutable.
|
|
3094
3049
|
* @see https://eslint-react.xyz/docs/rules/immutability
|
|
@@ -3284,11 +3239,6 @@ export interface Rules {
|
|
|
3284
3239
|
* @see https://eslint-react.xyz/docs/rules/no-nested-lazy-component-declarations
|
|
3285
3240
|
*/
|
|
3286
3241
|
'react-hooks-extra/no-nested-lazy-component-declarations'?: Linter.RuleEntry<[]>;
|
|
3287
|
-
/**
|
|
3288
|
-
* Disallows 'shouldComponentUpdate' when extending 'React.PureComponent'.
|
|
3289
|
-
* @see https://eslint-react.xyz/docs/rules/no-redundant-should-component-update
|
|
3290
|
-
*/
|
|
3291
|
-
'react-hooks-extra/no-redundant-should-component-update'?: Linter.RuleEntry<[]>;
|
|
3292
3242
|
/**
|
|
3293
3243
|
* Disallows calling 'this.setState' in 'componentDidMount' outside functions such as callbacks.
|
|
3294
3244
|
* @see https://eslint-react.xyz/docs/rules/no-set-state-in-component-did-mount
|
|
@@ -3304,16 +3254,6 @@ export interface Rules {
|
|
|
3304
3254
|
* @see https://eslint-react.xyz/docs/rules/no-set-state-in-component-will-update
|
|
3305
3255
|
*/
|
|
3306
3256
|
'react-hooks-extra/no-set-state-in-component-will-update'?: Linter.RuleEntry<[]>;
|
|
3307
|
-
/**
|
|
3308
|
-
* Disallows unnecessary usage of 'useCallback'.
|
|
3309
|
-
* @see https://eslint-react.xyz/docs/rules/no-unnecessary-use-callback
|
|
3310
|
-
*/
|
|
3311
|
-
'react-hooks-extra/no-unnecessary-use-callback'?: Linter.RuleEntry<[]>;
|
|
3312
|
-
/**
|
|
3313
|
-
* Disallows unnecessary usage of 'useMemo'.
|
|
3314
|
-
* @see https://eslint-react.xyz/docs/rules/no-unnecessary-use-memo
|
|
3315
|
-
*/
|
|
3316
|
-
'react-hooks-extra/no-unnecessary-use-memo'?: Linter.RuleEntry<[]>;
|
|
3317
3257
|
/**
|
|
3318
3258
|
* Enforces that a function with the 'use' prefix uses at least one Hook inside it.
|
|
3319
3259
|
* @see https://eslint-react.xyz/docs/rules/no-unnecessary-use-prefix
|
|
@@ -3355,7 +3295,7 @@ export interface Rules {
|
|
|
3355
3295
|
*/
|
|
3356
3296
|
'react-hooks-extra/no-unused-props'?: Linter.RuleEntry<[]>;
|
|
3357
3297
|
/**
|
|
3358
|
-
* Warns about
|
|
3298
|
+
* Warns about state variables that are defined but never used, or only used in effects.
|
|
3359
3299
|
* @see https://eslint-react.xyz/docs/rules/no-unused-state
|
|
3360
3300
|
*/
|
|
3361
3301
|
'react-hooks-extra/no-unused-state'?: Linter.RuleEntry<[]>;
|
|
@@ -3364,16 +3304,6 @@ export interface Rules {
|
|
|
3364
3304
|
* @see https://eslint-react.xyz/docs/rules/no-use-context
|
|
3365
3305
|
*/
|
|
3366
3306
|
'react-hooks-extra/no-use-context'?: Linter.RuleEntry<[]>;
|
|
3367
|
-
/**
|
|
3368
|
-
* Enforces destructuring assignment for component props and context.
|
|
3369
|
-
* @see https://eslint-react.xyz/docs/rules/prefer-destructuring-assignment
|
|
3370
|
-
*/
|
|
3371
|
-
'react-hooks-extra/prefer-destructuring-assignment'?: Linter.RuleEntry<[]>;
|
|
3372
|
-
/**
|
|
3373
|
-
* Enforces importing React via a namespace import.
|
|
3374
|
-
* @see https://eslint-react.xyz/docs/rules/prefer-namespace-import
|
|
3375
|
-
*/
|
|
3376
|
-
'react-hooks-extra/prefer-namespace-import'?: Linter.RuleEntry<[]>;
|
|
3377
3307
|
/**
|
|
3378
3308
|
* Validates that components and hooks are pure by checking that they do not call known-impure functions during render.
|
|
3379
3309
|
* @see https://eslint-react.xyz/docs/rules/purity
|
|
@@ -3404,6 +3334,11 @@ export interface Rules {
|
|
|
3404
3334
|
* @see https://eslint-react.xyz/docs/rules/set-state-in-render
|
|
3405
3335
|
*/
|
|
3406
3336
|
'react-hooks-extra/set-state-in-render'?: Linter.RuleEntry<[]>;
|
|
3337
|
+
/**
|
|
3338
|
+
* Validates that components are static, not recreated every render.
|
|
3339
|
+
* @see https://eslint-react.xyz/docs/rules/static-components
|
|
3340
|
+
*/
|
|
3341
|
+
'react-hooks-extra/static-components'?: Linter.RuleEntry<[]>;
|
|
3407
3342
|
/**
|
|
3408
3343
|
* Validates against syntax that React Compiler does not support.
|
|
3409
3344
|
* @see https://eslint-react.xyz/docs/rules/unsupported-syntax
|
|
@@ -3424,6 +3359,11 @@ export interface Rules {
|
|
|
3424
3359
|
* @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-event-listener
|
|
3425
3360
|
*/
|
|
3426
3361
|
'react-hooks-extra/web-api-no-leaked-event-listener'?: Linter.RuleEntry<[]>;
|
|
3362
|
+
/**
|
|
3363
|
+
* Enforces that every 'fetch' in a component or custom hook has a corresponding 'AbortController' abort in the cleanup function.
|
|
3364
|
+
* @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-fetch
|
|
3365
|
+
*/
|
|
3366
|
+
'react-hooks-extra/web-api-no-leaked-fetch'?: Linter.RuleEntry<[]>;
|
|
3427
3367
|
/**
|
|
3428
3368
|
* Enforces that every 'setInterval' in a component or custom hook has a corresponding 'clearInterval'.
|
|
3429
3369
|
* @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-interval
|
|
@@ -3439,11 +3379,6 @@ export interface Rules {
|
|
|
3439
3379
|
* @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-timeout
|
|
3440
3380
|
*/
|
|
3441
3381
|
'react-hooks-extra/web-api-no-leaked-timeout'?: Linter.RuleEntry<[]>;
|
|
3442
|
-
/**
|
|
3443
|
-
* Disallows higher order functions that define components or hooks inside them.
|
|
3444
|
-
* @see https://eslint-react.xyz/docs/rules/component-hook-factories
|
|
3445
|
-
*/
|
|
3446
|
-
'react-hooks-extra/x-component-hook-factories'?: Linter.RuleEntry<[]>;
|
|
3447
3382
|
/**
|
|
3448
3383
|
* Validates usage of Error Boundaries instead of try/catch for errors in child components.
|
|
3449
3384
|
* @see https://eslint-react.xyz/docs/rules/error-boundaries
|
|
@@ -3454,6 +3389,11 @@ export interface Rules {
|
|
|
3454
3389
|
* @see https://github.com/facebook/react/issues/14920
|
|
3455
3390
|
*/
|
|
3456
3391
|
'react-hooks-extra/x-exhaustive-deps'?: Linter.RuleEntry<ReactHooksExtraXExhaustiveDeps>;
|
|
3392
|
+
/**
|
|
3393
|
+
* Validates against assignment/mutation of globals during render, part of ensuring that side effects must run outside of render.
|
|
3394
|
+
* @see https://eslint-react.xyz/docs/rules/globals
|
|
3395
|
+
*/
|
|
3396
|
+
'react-hooks-extra/x-globals'?: Linter.RuleEntry<[]>;
|
|
3457
3397
|
/**
|
|
3458
3398
|
* Validates against mutating props, state, and other values that are immutable.
|
|
3459
3399
|
* @see https://eslint-react.xyz/docs/rules/immutability
|
|
@@ -3594,11 +3534,6 @@ export interface Rules {
|
|
|
3594
3534
|
* @see https://eslint-react.xyz/docs/rules/no-nested-lazy-component-declarations
|
|
3595
3535
|
*/
|
|
3596
3536
|
'react-hooks-extra/x-no-nested-lazy-component-declarations'?: Linter.RuleEntry<[]>;
|
|
3597
|
-
/**
|
|
3598
|
-
* Disallows 'shouldComponentUpdate' when extending 'React.PureComponent'.
|
|
3599
|
-
* @see https://eslint-react.xyz/docs/rules/no-redundant-should-component-update
|
|
3600
|
-
*/
|
|
3601
|
-
'react-hooks-extra/x-no-redundant-should-component-update'?: Linter.RuleEntry<[]>;
|
|
3602
3537
|
/**
|
|
3603
3538
|
* Disallows calling 'this.setState' in 'componentDidMount' outside functions such as callbacks.
|
|
3604
3539
|
* @see https://eslint-react.xyz/docs/rules/no-set-state-in-component-did-mount
|
|
@@ -3614,16 +3549,6 @@ export interface Rules {
|
|
|
3614
3549
|
* @see https://eslint-react.xyz/docs/rules/no-set-state-in-component-will-update
|
|
3615
3550
|
*/
|
|
3616
3551
|
'react-hooks-extra/x-no-set-state-in-component-will-update'?: Linter.RuleEntry<[]>;
|
|
3617
|
-
/**
|
|
3618
|
-
* Disallows unnecessary usage of 'useCallback'.
|
|
3619
|
-
* @see https://eslint-react.xyz/docs/rules/no-unnecessary-use-callback
|
|
3620
|
-
*/
|
|
3621
|
-
'react-hooks-extra/x-no-unnecessary-use-callback'?: Linter.RuleEntry<[]>;
|
|
3622
|
-
/**
|
|
3623
|
-
* Disallows unnecessary usage of 'useMemo'.
|
|
3624
|
-
* @see https://eslint-react.xyz/docs/rules/no-unnecessary-use-memo
|
|
3625
|
-
*/
|
|
3626
|
-
'react-hooks-extra/x-no-unnecessary-use-memo'?: Linter.RuleEntry<[]>;
|
|
3627
3552
|
/**
|
|
3628
3553
|
* Enforces that a function with the 'use' prefix uses at least one Hook inside it.
|
|
3629
3554
|
* @see https://eslint-react.xyz/docs/rules/no-unnecessary-use-prefix
|
|
@@ -3665,7 +3590,7 @@ export interface Rules {
|
|
|
3665
3590
|
*/
|
|
3666
3591
|
'react-hooks-extra/x-no-unused-props'?: Linter.RuleEntry<[]>;
|
|
3667
3592
|
/**
|
|
3668
|
-
* Warns about
|
|
3593
|
+
* Warns about state variables that are defined but never used, or only used in effects.
|
|
3669
3594
|
* @see https://eslint-react.xyz/docs/rules/no-unused-state
|
|
3670
3595
|
*/
|
|
3671
3596
|
'react-hooks-extra/x-no-unused-state'?: Linter.RuleEntry<[]>;
|
|
@@ -3674,16 +3599,6 @@ export interface Rules {
|
|
|
3674
3599
|
* @see https://eslint-react.xyz/docs/rules/no-use-context
|
|
3675
3600
|
*/
|
|
3676
3601
|
'react-hooks-extra/x-no-use-context'?: Linter.RuleEntry<[]>;
|
|
3677
|
-
/**
|
|
3678
|
-
* Enforces destructuring assignment for component props and context.
|
|
3679
|
-
* @see https://eslint-react.xyz/docs/rules/prefer-destructuring-assignment
|
|
3680
|
-
*/
|
|
3681
|
-
'react-hooks-extra/x-prefer-destructuring-assignment'?: Linter.RuleEntry<[]>;
|
|
3682
|
-
/**
|
|
3683
|
-
* Enforces importing React via a namespace import.
|
|
3684
|
-
* @see https://eslint-react.xyz/docs/rules/prefer-namespace-import
|
|
3685
|
-
*/
|
|
3686
|
-
'react-hooks-extra/x-prefer-namespace-import'?: Linter.RuleEntry<[]>;
|
|
3687
3602
|
/**
|
|
3688
3603
|
* Validates that components and hooks are pure by checking that they do not call known-impure functions during render.
|
|
3689
3604
|
* @see https://eslint-react.xyz/docs/rules/purity
|
|
@@ -3709,6 +3624,11 @@ export interface Rules {
|
|
|
3709
3624
|
* @see https://eslint-react.xyz/docs/rules/set-state-in-render
|
|
3710
3625
|
*/
|
|
3711
3626
|
'react-hooks-extra/x-set-state-in-render'?: Linter.RuleEntry<[]>;
|
|
3627
|
+
/**
|
|
3628
|
+
* Validates that components are static, not recreated every render.
|
|
3629
|
+
* @see https://eslint-react.xyz/docs/rules/static-components
|
|
3630
|
+
*/
|
|
3631
|
+
'react-hooks-extra/x-static-components'?: Linter.RuleEntry<[]>;
|
|
3712
3632
|
/**
|
|
3713
3633
|
* Validates against syntax that React Compiler does not support.
|
|
3714
3634
|
* @see https://eslint-react.xyz/docs/rules/unsupported-syntax
|
|
@@ -3869,11 +3789,6 @@ export interface Rules {
|
|
|
3869
3789
|
* @see https://react.dev/reference/eslint-plugin-react-hooks/lints/void-use-memo
|
|
3870
3790
|
*/
|
|
3871
3791
|
'react-hooks/void-use-memo'?: Linter.RuleEntry<ReactHooksVoidUseMemo>;
|
|
3872
|
-
/**
|
|
3873
|
-
* Disallows higher order functions that define components or hooks inside them.
|
|
3874
|
-
* @see https://eslint-react.xyz/docs/rules/component-hook-factories
|
|
3875
|
-
*/
|
|
3876
|
-
'react-naming-convention/component-hook-factories'?: Linter.RuleEntry<[]>;
|
|
3877
3792
|
/**
|
|
3878
3793
|
* Disallows DOM elements from using 'dangerouslySetInnerHTML'.
|
|
3879
3794
|
* @see https://eslint-react.xyz/docs/rules/dom-no-dangerously-set-innerhtml
|
|
@@ -3954,11 +3869,6 @@ export interface Rules {
|
|
|
3954
3869
|
* @see https://eslint-react.xyz/docs/rules/dom-no-void-elements-with-children
|
|
3955
3870
|
*/
|
|
3956
3871
|
'react-naming-convention/dom-no-void-elements-with-children'?: Linter.RuleEntry<[]>;
|
|
3957
|
-
/**
|
|
3958
|
-
* Enforces importing React DOM via a namespace import.
|
|
3959
|
-
* @see https://eslint-react.xyz/docs/rules/dom-prefer-namespace-import
|
|
3960
|
-
*/
|
|
3961
|
-
'react-naming-convention/dom-prefer-namespace-import'?: Linter.RuleEntry<[]>;
|
|
3962
3872
|
/**
|
|
3963
3873
|
* Validates usage of Error Boundaries instead of try/catch for errors in child components.
|
|
3964
3874
|
* @see https://eslint-react.xyz/docs/rules/error-boundaries
|
|
@@ -3969,6 +3879,11 @@ export interface Rules {
|
|
|
3969
3879
|
* @see https://github.com/facebook/react/issues/14920
|
|
3970
3880
|
*/
|
|
3971
3881
|
'react-naming-convention/exhaustive-deps'?: Linter.RuleEntry<ReactNamingConventionExhaustiveDeps>;
|
|
3882
|
+
/**
|
|
3883
|
+
* Validates against assignment/mutation of globals during render, part of ensuring that side effects must run outside of render.
|
|
3884
|
+
* @see https://eslint-react.xyz/docs/rules/globals
|
|
3885
|
+
*/
|
|
3886
|
+
'react-naming-convention/globals'?: Linter.RuleEntry<[]>;
|
|
3972
3887
|
/**
|
|
3973
3888
|
* Validates against mutating props, state, and other values that are immutable.
|
|
3974
3889
|
* @see https://eslint-react.xyz/docs/rules/immutability
|
|
@@ -4164,11 +4079,6 @@ export interface Rules {
|
|
|
4164
4079
|
* @see https://eslint-react.xyz/docs/rules/no-nested-lazy-component-declarations
|
|
4165
4080
|
*/
|
|
4166
4081
|
'react-naming-convention/no-nested-lazy-component-declarations'?: Linter.RuleEntry<[]>;
|
|
4167
|
-
/**
|
|
4168
|
-
* Disallows 'shouldComponentUpdate' when extending 'React.PureComponent'.
|
|
4169
|
-
* @see https://eslint-react.xyz/docs/rules/no-redundant-should-component-update
|
|
4170
|
-
*/
|
|
4171
|
-
'react-naming-convention/no-redundant-should-component-update'?: Linter.RuleEntry<[]>;
|
|
4172
4082
|
/**
|
|
4173
4083
|
* Disallows calling 'this.setState' in 'componentDidMount' outside functions such as callbacks.
|
|
4174
4084
|
* @see https://eslint-react.xyz/docs/rules/no-set-state-in-component-did-mount
|
|
@@ -4184,16 +4094,6 @@ export interface Rules {
|
|
|
4184
4094
|
* @see https://eslint-react.xyz/docs/rules/no-set-state-in-component-will-update
|
|
4185
4095
|
*/
|
|
4186
4096
|
'react-naming-convention/no-set-state-in-component-will-update'?: Linter.RuleEntry<[]>;
|
|
4187
|
-
/**
|
|
4188
|
-
* Disallows unnecessary usage of 'useCallback'.
|
|
4189
|
-
* @see https://eslint-react.xyz/docs/rules/no-unnecessary-use-callback
|
|
4190
|
-
*/
|
|
4191
|
-
'react-naming-convention/no-unnecessary-use-callback'?: Linter.RuleEntry<[]>;
|
|
4192
|
-
/**
|
|
4193
|
-
* Disallows unnecessary usage of 'useMemo'.
|
|
4194
|
-
* @see https://eslint-react.xyz/docs/rules/no-unnecessary-use-memo
|
|
4195
|
-
*/
|
|
4196
|
-
'react-naming-convention/no-unnecessary-use-memo'?: Linter.RuleEntry<[]>;
|
|
4197
4097
|
/**
|
|
4198
4098
|
* Enforces that a function with the 'use' prefix uses at least one Hook inside it.
|
|
4199
4099
|
* @see https://eslint-react.xyz/docs/rules/no-unnecessary-use-prefix
|
|
@@ -4235,7 +4135,7 @@ export interface Rules {
|
|
|
4235
4135
|
*/
|
|
4236
4136
|
'react-naming-convention/no-unused-props'?: Linter.RuleEntry<[]>;
|
|
4237
4137
|
/**
|
|
4238
|
-
* Warns about
|
|
4138
|
+
* Warns about state variables that are defined but never used, or only used in effects.
|
|
4239
4139
|
* @see https://eslint-react.xyz/docs/rules/no-unused-state
|
|
4240
4140
|
*/
|
|
4241
4141
|
'react-naming-convention/no-unused-state'?: Linter.RuleEntry<[]>;
|
|
@@ -4244,16 +4144,6 @@ export interface Rules {
|
|
|
4244
4144
|
* @see https://eslint-react.xyz/docs/rules/no-use-context
|
|
4245
4145
|
*/
|
|
4246
4146
|
'react-naming-convention/no-use-context'?: Linter.RuleEntry<[]>;
|
|
4247
|
-
/**
|
|
4248
|
-
* Enforces destructuring assignment for component props and context.
|
|
4249
|
-
* @see https://eslint-react.xyz/docs/rules/prefer-destructuring-assignment
|
|
4250
|
-
*/
|
|
4251
|
-
'react-naming-convention/prefer-destructuring-assignment'?: Linter.RuleEntry<[]>;
|
|
4252
|
-
/**
|
|
4253
|
-
* Enforces importing React via a namespace import.
|
|
4254
|
-
* @see https://eslint-react.xyz/docs/rules/prefer-namespace-import
|
|
4255
|
-
*/
|
|
4256
|
-
'react-naming-convention/prefer-namespace-import'?: Linter.RuleEntry<[]>;
|
|
4257
4147
|
/**
|
|
4258
4148
|
* Validates that components and hooks are pure by checking that they do not call known-impure functions during render.
|
|
4259
4149
|
* @see https://eslint-react.xyz/docs/rules/purity
|
|
@@ -4284,6 +4174,11 @@ export interface Rules {
|
|
|
4284
4174
|
* @see https://eslint-react.xyz/docs/rules/set-state-in-render
|
|
4285
4175
|
*/
|
|
4286
4176
|
'react-naming-convention/set-state-in-render'?: Linter.RuleEntry<[]>;
|
|
4177
|
+
/**
|
|
4178
|
+
* Validates that components are static, not recreated every render.
|
|
4179
|
+
* @see https://eslint-react.xyz/docs/rules/static-components
|
|
4180
|
+
*/
|
|
4181
|
+
'react-naming-convention/static-components'?: Linter.RuleEntry<[]>;
|
|
4287
4182
|
/**
|
|
4288
4183
|
* Validates against syntax that React Compiler does not support.
|
|
4289
4184
|
* @see https://eslint-react.xyz/docs/rules/unsupported-syntax
|
|
@@ -4304,6 +4199,11 @@ export interface Rules {
|
|
|
4304
4199
|
* @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-event-listener
|
|
4305
4200
|
*/
|
|
4306
4201
|
'react-naming-convention/web-api-no-leaked-event-listener'?: Linter.RuleEntry<[]>;
|
|
4202
|
+
/**
|
|
4203
|
+
* Enforces that every 'fetch' in a component or custom hook has a corresponding 'AbortController' abort in the cleanup function.
|
|
4204
|
+
* @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-fetch
|
|
4205
|
+
*/
|
|
4206
|
+
'react-naming-convention/web-api-no-leaked-fetch'?: Linter.RuleEntry<[]>;
|
|
4307
4207
|
/**
|
|
4308
4208
|
* Enforces that every 'setInterval' in a component or custom hook has a corresponding 'clearInterval'.
|
|
4309
4209
|
* @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-interval
|
|
@@ -4319,11 +4219,6 @@ export interface Rules {
|
|
|
4319
4219
|
* @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-timeout
|
|
4320
4220
|
*/
|
|
4321
4221
|
'react-naming-convention/web-api-no-leaked-timeout'?: Linter.RuleEntry<[]>;
|
|
4322
|
-
/**
|
|
4323
|
-
* Disallows higher order functions that define components or hooks inside them.
|
|
4324
|
-
* @see https://eslint-react.xyz/docs/rules/component-hook-factories
|
|
4325
|
-
*/
|
|
4326
|
-
'react-naming-convention/x-component-hook-factories'?: Linter.RuleEntry<[]>;
|
|
4327
4222
|
/**
|
|
4328
4223
|
* Validates usage of Error Boundaries instead of try/catch for errors in child components.
|
|
4329
4224
|
* @see https://eslint-react.xyz/docs/rules/error-boundaries
|
|
@@ -4334,6 +4229,11 @@ export interface Rules {
|
|
|
4334
4229
|
* @see https://github.com/facebook/react/issues/14920
|
|
4335
4230
|
*/
|
|
4336
4231
|
'react-naming-convention/x-exhaustive-deps'?: Linter.RuleEntry<ReactNamingConventionXExhaustiveDeps>;
|
|
4232
|
+
/**
|
|
4233
|
+
* Validates against assignment/mutation of globals during render, part of ensuring that side effects must run outside of render.
|
|
4234
|
+
* @see https://eslint-react.xyz/docs/rules/globals
|
|
4235
|
+
*/
|
|
4236
|
+
'react-naming-convention/x-globals'?: Linter.RuleEntry<[]>;
|
|
4337
4237
|
/**
|
|
4338
4238
|
* Validates against mutating props, state, and other values that are immutable.
|
|
4339
4239
|
* @see https://eslint-react.xyz/docs/rules/immutability
|
|
@@ -4474,11 +4374,6 @@ export interface Rules {
|
|
|
4474
4374
|
* @see https://eslint-react.xyz/docs/rules/no-nested-lazy-component-declarations
|
|
4475
4375
|
*/
|
|
4476
4376
|
'react-naming-convention/x-no-nested-lazy-component-declarations'?: Linter.RuleEntry<[]>;
|
|
4477
|
-
/**
|
|
4478
|
-
* Disallows 'shouldComponentUpdate' when extending 'React.PureComponent'.
|
|
4479
|
-
* @see https://eslint-react.xyz/docs/rules/no-redundant-should-component-update
|
|
4480
|
-
*/
|
|
4481
|
-
'react-naming-convention/x-no-redundant-should-component-update'?: Linter.RuleEntry<[]>;
|
|
4482
4377
|
/**
|
|
4483
4378
|
* Disallows calling 'this.setState' in 'componentDidMount' outside functions such as callbacks.
|
|
4484
4379
|
* @see https://eslint-react.xyz/docs/rules/no-set-state-in-component-did-mount
|
|
@@ -4494,16 +4389,6 @@ export interface Rules {
|
|
|
4494
4389
|
* @see https://eslint-react.xyz/docs/rules/no-set-state-in-component-will-update
|
|
4495
4390
|
*/
|
|
4496
4391
|
'react-naming-convention/x-no-set-state-in-component-will-update'?: Linter.RuleEntry<[]>;
|
|
4497
|
-
/**
|
|
4498
|
-
* Disallows unnecessary usage of 'useCallback'.
|
|
4499
|
-
* @see https://eslint-react.xyz/docs/rules/no-unnecessary-use-callback
|
|
4500
|
-
*/
|
|
4501
|
-
'react-naming-convention/x-no-unnecessary-use-callback'?: Linter.RuleEntry<[]>;
|
|
4502
|
-
/**
|
|
4503
|
-
* Disallows unnecessary usage of 'useMemo'.
|
|
4504
|
-
* @see https://eslint-react.xyz/docs/rules/no-unnecessary-use-memo
|
|
4505
|
-
*/
|
|
4506
|
-
'react-naming-convention/x-no-unnecessary-use-memo'?: Linter.RuleEntry<[]>;
|
|
4507
4392
|
/**
|
|
4508
4393
|
* Enforces that a function with the 'use' prefix uses at least one Hook inside it.
|
|
4509
4394
|
* @see https://eslint-react.xyz/docs/rules/no-unnecessary-use-prefix
|
|
@@ -4545,7 +4430,7 @@ export interface Rules {
|
|
|
4545
4430
|
*/
|
|
4546
4431
|
'react-naming-convention/x-no-unused-props'?: Linter.RuleEntry<[]>;
|
|
4547
4432
|
/**
|
|
4548
|
-
* Warns about
|
|
4433
|
+
* Warns about state variables that are defined but never used, or only used in effects.
|
|
4549
4434
|
* @see https://eslint-react.xyz/docs/rules/no-unused-state
|
|
4550
4435
|
*/
|
|
4551
4436
|
'react-naming-convention/x-no-unused-state'?: Linter.RuleEntry<[]>;
|
|
@@ -4554,16 +4439,6 @@ export interface Rules {
|
|
|
4554
4439
|
* @see https://eslint-react.xyz/docs/rules/no-use-context
|
|
4555
4440
|
*/
|
|
4556
4441
|
'react-naming-convention/x-no-use-context'?: Linter.RuleEntry<[]>;
|
|
4557
|
-
/**
|
|
4558
|
-
* Enforces destructuring assignment for component props and context.
|
|
4559
|
-
* @see https://eslint-react.xyz/docs/rules/prefer-destructuring-assignment
|
|
4560
|
-
*/
|
|
4561
|
-
'react-naming-convention/x-prefer-destructuring-assignment'?: Linter.RuleEntry<[]>;
|
|
4562
|
-
/**
|
|
4563
|
-
* Enforces importing React via a namespace import.
|
|
4564
|
-
* @see https://eslint-react.xyz/docs/rules/prefer-namespace-import
|
|
4565
|
-
*/
|
|
4566
|
-
'react-naming-convention/x-prefer-namespace-import'?: Linter.RuleEntry<[]>;
|
|
4567
4442
|
/**
|
|
4568
4443
|
* Validates that components and hooks are pure by checking that they do not call known-impure functions during render.
|
|
4569
4444
|
* @see https://eslint-react.xyz/docs/rules/purity
|
|
@@ -4589,6 +4464,11 @@ export interface Rules {
|
|
|
4589
4464
|
* @see https://eslint-react.xyz/docs/rules/set-state-in-render
|
|
4590
4465
|
*/
|
|
4591
4466
|
'react-naming-convention/x-set-state-in-render'?: Linter.RuleEntry<[]>;
|
|
4467
|
+
/**
|
|
4468
|
+
* Validates that components are static, not recreated every render.
|
|
4469
|
+
* @see https://eslint-react.xyz/docs/rules/static-components
|
|
4470
|
+
*/
|
|
4471
|
+
'react-naming-convention/x-static-components'?: Linter.RuleEntry<[]>;
|
|
4592
4472
|
/**
|
|
4593
4473
|
* Validates against syntax that React Compiler does not support.
|
|
4594
4474
|
* @see https://eslint-react.xyz/docs/rules/unsupported-syntax
|
|
@@ -4605,11 +4485,6 @@ export interface Rules {
|
|
|
4605
4485
|
*/
|
|
4606
4486
|
'react-naming-convention/x-use-state'?: Linter.RuleEntry<ReactNamingConventionXUseState>;
|
|
4607
4487
|
'react-refresh/only-export-components'?: Linter.RuleEntry<ReactRefreshOnlyExportComponents>;
|
|
4608
|
-
/**
|
|
4609
|
-
* Disallows higher order functions that define components or hooks inside them.
|
|
4610
|
-
* @see https://eslint-react.xyz/docs/rules/component-hook-factories
|
|
4611
|
-
*/
|
|
4612
|
-
'react-web-api/component-hook-factories'?: Linter.RuleEntry<[]>;
|
|
4613
4488
|
/**
|
|
4614
4489
|
* Disallows DOM elements from using 'dangerouslySetInnerHTML'.
|
|
4615
4490
|
* @see https://eslint-react.xyz/docs/rules/dom-no-dangerously-set-innerhtml
|
|
@@ -4690,11 +4565,6 @@ export interface Rules {
|
|
|
4690
4565
|
* @see https://eslint-react.xyz/docs/rules/dom-no-void-elements-with-children
|
|
4691
4566
|
*/
|
|
4692
4567
|
'react-web-api/dom-no-void-elements-with-children'?: Linter.RuleEntry<[]>;
|
|
4693
|
-
/**
|
|
4694
|
-
* Enforces importing React DOM via a namespace import.
|
|
4695
|
-
* @see https://eslint-react.xyz/docs/rules/dom-prefer-namespace-import
|
|
4696
|
-
*/
|
|
4697
|
-
'react-web-api/dom-prefer-namespace-import'?: Linter.RuleEntry<[]>;
|
|
4698
4568
|
/**
|
|
4699
4569
|
* Validates usage of Error Boundaries instead of try/catch for errors in child components.
|
|
4700
4570
|
* @see https://eslint-react.xyz/docs/rules/error-boundaries
|
|
@@ -4705,6 +4575,11 @@ export interface Rules {
|
|
|
4705
4575
|
* @see https://github.com/facebook/react/issues/14920
|
|
4706
4576
|
*/
|
|
4707
4577
|
'react-web-api/exhaustive-deps'?: Linter.RuleEntry<ReactWebApiExhaustiveDeps>;
|
|
4578
|
+
/**
|
|
4579
|
+
* Validates against assignment/mutation of globals during render, part of ensuring that side effects must run outside of render.
|
|
4580
|
+
* @see https://eslint-react.xyz/docs/rules/globals
|
|
4581
|
+
*/
|
|
4582
|
+
'react-web-api/globals'?: Linter.RuleEntry<[]>;
|
|
4708
4583
|
/**
|
|
4709
4584
|
* Validates against mutating props, state, and other values that are immutable.
|
|
4710
4585
|
* @see https://eslint-react.xyz/docs/rules/immutability
|
|
@@ -4900,11 +4775,6 @@ export interface Rules {
|
|
|
4900
4775
|
* @see https://eslint-react.xyz/docs/rules/no-nested-lazy-component-declarations
|
|
4901
4776
|
*/
|
|
4902
4777
|
'react-web-api/no-nested-lazy-component-declarations'?: Linter.RuleEntry<[]>;
|
|
4903
|
-
/**
|
|
4904
|
-
* Disallows 'shouldComponentUpdate' when extending 'React.PureComponent'.
|
|
4905
|
-
* @see https://eslint-react.xyz/docs/rules/no-redundant-should-component-update
|
|
4906
|
-
*/
|
|
4907
|
-
'react-web-api/no-redundant-should-component-update'?: Linter.RuleEntry<[]>;
|
|
4908
4778
|
/**
|
|
4909
4779
|
* Disallows calling 'this.setState' in 'componentDidMount' outside functions such as callbacks.
|
|
4910
4780
|
* @see https://eslint-react.xyz/docs/rules/no-set-state-in-component-did-mount
|
|
@@ -4920,16 +4790,6 @@ export interface Rules {
|
|
|
4920
4790
|
* @see https://eslint-react.xyz/docs/rules/no-set-state-in-component-will-update
|
|
4921
4791
|
*/
|
|
4922
4792
|
'react-web-api/no-set-state-in-component-will-update'?: Linter.RuleEntry<[]>;
|
|
4923
|
-
/**
|
|
4924
|
-
* Disallows unnecessary usage of 'useCallback'.
|
|
4925
|
-
* @see https://eslint-react.xyz/docs/rules/no-unnecessary-use-callback
|
|
4926
|
-
*/
|
|
4927
|
-
'react-web-api/no-unnecessary-use-callback'?: Linter.RuleEntry<[]>;
|
|
4928
|
-
/**
|
|
4929
|
-
* Disallows unnecessary usage of 'useMemo'.
|
|
4930
|
-
* @see https://eslint-react.xyz/docs/rules/no-unnecessary-use-memo
|
|
4931
|
-
*/
|
|
4932
|
-
'react-web-api/no-unnecessary-use-memo'?: Linter.RuleEntry<[]>;
|
|
4933
4793
|
/**
|
|
4934
4794
|
* Enforces that a function with the 'use' prefix uses at least one Hook inside it.
|
|
4935
4795
|
* @see https://eslint-react.xyz/docs/rules/no-unnecessary-use-prefix
|
|
@@ -4971,7 +4831,7 @@ export interface Rules {
|
|
|
4971
4831
|
*/
|
|
4972
4832
|
'react-web-api/no-unused-props'?: Linter.RuleEntry<[]>;
|
|
4973
4833
|
/**
|
|
4974
|
-
* Warns about
|
|
4834
|
+
* Warns about state variables that are defined but never used, or only used in effects.
|
|
4975
4835
|
* @see https://eslint-react.xyz/docs/rules/no-unused-state
|
|
4976
4836
|
*/
|
|
4977
4837
|
'react-web-api/no-unused-state'?: Linter.RuleEntry<[]>;
|
|
@@ -4980,16 +4840,6 @@ export interface Rules {
|
|
|
4980
4840
|
* @see https://eslint-react.xyz/docs/rules/no-use-context
|
|
4981
4841
|
*/
|
|
4982
4842
|
'react-web-api/no-use-context'?: Linter.RuleEntry<[]>;
|
|
4983
|
-
/**
|
|
4984
|
-
* Enforces destructuring assignment for component props and context.
|
|
4985
|
-
* @see https://eslint-react.xyz/docs/rules/prefer-destructuring-assignment
|
|
4986
|
-
*/
|
|
4987
|
-
'react-web-api/prefer-destructuring-assignment'?: Linter.RuleEntry<[]>;
|
|
4988
|
-
/**
|
|
4989
|
-
* Enforces importing React via a namespace import.
|
|
4990
|
-
* @see https://eslint-react.xyz/docs/rules/prefer-namespace-import
|
|
4991
|
-
*/
|
|
4992
|
-
'react-web-api/prefer-namespace-import'?: Linter.RuleEntry<[]>;
|
|
4993
4843
|
/**
|
|
4994
4844
|
* Validates that components and hooks are pure by checking that they do not call known-impure functions during render.
|
|
4995
4845
|
* @see https://eslint-react.xyz/docs/rules/purity
|
|
@@ -5020,6 +4870,11 @@ export interface Rules {
|
|
|
5020
4870
|
* @see https://eslint-react.xyz/docs/rules/set-state-in-render
|
|
5021
4871
|
*/
|
|
5022
4872
|
'react-web-api/set-state-in-render'?: Linter.RuleEntry<[]>;
|
|
4873
|
+
/**
|
|
4874
|
+
* Validates that components are static, not recreated every render.
|
|
4875
|
+
* @see https://eslint-react.xyz/docs/rules/static-components
|
|
4876
|
+
*/
|
|
4877
|
+
'react-web-api/static-components'?: Linter.RuleEntry<[]>;
|
|
5023
4878
|
/**
|
|
5024
4879
|
* Validates against syntax that React Compiler does not support.
|
|
5025
4880
|
* @see https://eslint-react.xyz/docs/rules/unsupported-syntax
|
|
@@ -5040,6 +4895,11 @@ export interface Rules {
|
|
|
5040
4895
|
* @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-event-listener
|
|
5041
4896
|
*/
|
|
5042
4897
|
'react-web-api/web-api-no-leaked-event-listener'?: Linter.RuleEntry<[]>;
|
|
4898
|
+
/**
|
|
4899
|
+
* Enforces that every 'fetch' in a component or custom hook has a corresponding 'AbortController' abort in the cleanup function.
|
|
4900
|
+
* @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-fetch
|
|
4901
|
+
*/
|
|
4902
|
+
'react-web-api/web-api-no-leaked-fetch'?: Linter.RuleEntry<[]>;
|
|
5043
4903
|
/**
|
|
5044
4904
|
* Enforces that every 'setInterval' in a component or custom hook has a corresponding 'clearInterval'.
|
|
5045
4905
|
* @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-interval
|
|
@@ -5055,11 +4915,6 @@ export interface Rules {
|
|
|
5055
4915
|
* @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-timeout
|
|
5056
4916
|
*/
|
|
5057
4917
|
'react-web-api/web-api-no-leaked-timeout'?: Linter.RuleEntry<[]>;
|
|
5058
|
-
/**
|
|
5059
|
-
* Disallows higher order functions that define components or hooks inside them.
|
|
5060
|
-
* @see https://eslint-react.xyz/docs/rules/component-hook-factories
|
|
5061
|
-
*/
|
|
5062
|
-
'react-web-api/x-component-hook-factories'?: Linter.RuleEntry<[]>;
|
|
5063
4918
|
/**
|
|
5064
4919
|
* Validates usage of Error Boundaries instead of try/catch for errors in child components.
|
|
5065
4920
|
* @see https://eslint-react.xyz/docs/rules/error-boundaries
|
|
@@ -5070,6 +4925,11 @@ export interface Rules {
|
|
|
5070
4925
|
* @see https://github.com/facebook/react/issues/14920
|
|
5071
4926
|
*/
|
|
5072
4927
|
'react-web-api/x-exhaustive-deps'?: Linter.RuleEntry<ReactWebApiXExhaustiveDeps>;
|
|
4928
|
+
/**
|
|
4929
|
+
* Validates against assignment/mutation of globals during render, part of ensuring that side effects must run outside of render.
|
|
4930
|
+
* @see https://eslint-react.xyz/docs/rules/globals
|
|
4931
|
+
*/
|
|
4932
|
+
'react-web-api/x-globals'?: Linter.RuleEntry<[]>;
|
|
5073
4933
|
/**
|
|
5074
4934
|
* Validates against mutating props, state, and other values that are immutable.
|
|
5075
4935
|
* @see https://eslint-react.xyz/docs/rules/immutability
|
|
@@ -5210,11 +5070,6 @@ export interface Rules {
|
|
|
5210
5070
|
* @see https://eslint-react.xyz/docs/rules/no-nested-lazy-component-declarations
|
|
5211
5071
|
*/
|
|
5212
5072
|
'react-web-api/x-no-nested-lazy-component-declarations'?: Linter.RuleEntry<[]>;
|
|
5213
|
-
/**
|
|
5214
|
-
* Disallows 'shouldComponentUpdate' when extending 'React.PureComponent'.
|
|
5215
|
-
* @see https://eslint-react.xyz/docs/rules/no-redundant-should-component-update
|
|
5216
|
-
*/
|
|
5217
|
-
'react-web-api/x-no-redundant-should-component-update'?: Linter.RuleEntry<[]>;
|
|
5218
5073
|
/**
|
|
5219
5074
|
* Disallows calling 'this.setState' in 'componentDidMount' outside functions such as callbacks.
|
|
5220
5075
|
* @see https://eslint-react.xyz/docs/rules/no-set-state-in-component-did-mount
|
|
@@ -5230,16 +5085,6 @@ export interface Rules {
|
|
|
5230
5085
|
* @see https://eslint-react.xyz/docs/rules/no-set-state-in-component-will-update
|
|
5231
5086
|
*/
|
|
5232
5087
|
'react-web-api/x-no-set-state-in-component-will-update'?: Linter.RuleEntry<[]>;
|
|
5233
|
-
/**
|
|
5234
|
-
* Disallows unnecessary usage of 'useCallback'.
|
|
5235
|
-
* @see https://eslint-react.xyz/docs/rules/no-unnecessary-use-callback
|
|
5236
|
-
*/
|
|
5237
|
-
'react-web-api/x-no-unnecessary-use-callback'?: Linter.RuleEntry<[]>;
|
|
5238
|
-
/**
|
|
5239
|
-
* Disallows unnecessary usage of 'useMemo'.
|
|
5240
|
-
* @see https://eslint-react.xyz/docs/rules/no-unnecessary-use-memo
|
|
5241
|
-
*/
|
|
5242
|
-
'react-web-api/x-no-unnecessary-use-memo'?: Linter.RuleEntry<[]>;
|
|
5243
5088
|
/**
|
|
5244
5089
|
* Enforces that a function with the 'use' prefix uses at least one Hook inside it.
|
|
5245
5090
|
* @see https://eslint-react.xyz/docs/rules/no-unnecessary-use-prefix
|
|
@@ -5281,7 +5126,7 @@ export interface Rules {
|
|
|
5281
5126
|
*/
|
|
5282
5127
|
'react-web-api/x-no-unused-props'?: Linter.RuleEntry<[]>;
|
|
5283
5128
|
/**
|
|
5284
|
-
* Warns about
|
|
5129
|
+
* Warns about state variables that are defined but never used, or only used in effects.
|
|
5285
5130
|
* @see https://eslint-react.xyz/docs/rules/no-unused-state
|
|
5286
5131
|
*/
|
|
5287
5132
|
'react-web-api/x-no-unused-state'?: Linter.RuleEntry<[]>;
|
|
@@ -5290,16 +5135,6 @@ export interface Rules {
|
|
|
5290
5135
|
* @see https://eslint-react.xyz/docs/rules/no-use-context
|
|
5291
5136
|
*/
|
|
5292
5137
|
'react-web-api/x-no-use-context'?: Linter.RuleEntry<[]>;
|
|
5293
|
-
/**
|
|
5294
|
-
* Enforces destructuring assignment for component props and context.
|
|
5295
|
-
* @see https://eslint-react.xyz/docs/rules/prefer-destructuring-assignment
|
|
5296
|
-
*/
|
|
5297
|
-
'react-web-api/x-prefer-destructuring-assignment'?: Linter.RuleEntry<[]>;
|
|
5298
|
-
/**
|
|
5299
|
-
* Enforces importing React via a namespace import.
|
|
5300
|
-
* @see https://eslint-react.xyz/docs/rules/prefer-namespace-import
|
|
5301
|
-
*/
|
|
5302
|
-
'react-web-api/x-prefer-namespace-import'?: Linter.RuleEntry<[]>;
|
|
5303
5138
|
/**
|
|
5304
5139
|
* Validates that components and hooks are pure by checking that they do not call known-impure functions during render.
|
|
5305
5140
|
* @see https://eslint-react.xyz/docs/rules/purity
|
|
@@ -5325,6 +5160,11 @@ export interface Rules {
|
|
|
5325
5160
|
* @see https://eslint-react.xyz/docs/rules/set-state-in-render
|
|
5326
5161
|
*/
|
|
5327
5162
|
'react-web-api/x-set-state-in-render'?: Linter.RuleEntry<[]>;
|
|
5163
|
+
/**
|
|
5164
|
+
* Validates that components are static, not recreated every render.
|
|
5165
|
+
* @see https://eslint-react.xyz/docs/rules/static-components
|
|
5166
|
+
*/
|
|
5167
|
+
'react-web-api/x-static-components'?: Linter.RuleEntry<[]>;
|
|
5328
5168
|
/**
|
|
5329
5169
|
* Validates against syntax that React Compiler does not support.
|
|
5330
5170
|
* @see https://eslint-react.xyz/docs/rules/unsupported-syntax
|
|
@@ -5340,11 +5180,6 @@ export interface Rules {
|
|
|
5340
5180
|
* @see https://eslint-react.xyz/docs/rules/use-state
|
|
5341
5181
|
*/
|
|
5342
5182
|
'react-web-api/x-use-state'?: Linter.RuleEntry<ReactWebApiXUseState>;
|
|
5343
|
-
/**
|
|
5344
|
-
* Disallows higher order functions that define components or hooks inside them.
|
|
5345
|
-
* @see https://eslint-react.xyz/docs/rules/component-hook-factories
|
|
5346
|
-
*/
|
|
5347
|
-
'react/component-hook-factories'?: Linter.RuleEntry<[]>;
|
|
5348
5183
|
/**
|
|
5349
5184
|
* Disallows DOM elements from using 'dangerouslySetInnerHTML'.
|
|
5350
5185
|
* @see https://eslint-react.xyz/docs/rules/dom-no-dangerously-set-innerhtml
|
|
@@ -5425,11 +5260,6 @@ export interface Rules {
|
|
|
5425
5260
|
* @see https://eslint-react.xyz/docs/rules/dom-no-void-elements-with-children
|
|
5426
5261
|
*/
|
|
5427
5262
|
'react/dom-no-void-elements-with-children'?: Linter.RuleEntry<[]>;
|
|
5428
|
-
/**
|
|
5429
|
-
* Enforces importing React DOM via a namespace import.
|
|
5430
|
-
* @see https://eslint-react.xyz/docs/rules/dom-prefer-namespace-import
|
|
5431
|
-
*/
|
|
5432
|
-
'react/dom-prefer-namespace-import'?: Linter.RuleEntry<[]>;
|
|
5433
5263
|
/**
|
|
5434
5264
|
* Validates usage of Error Boundaries instead of try/catch for errors in child components.
|
|
5435
5265
|
* @see https://eslint-react.xyz/docs/rules/error-boundaries
|
|
@@ -5440,6 +5270,11 @@ export interface Rules {
|
|
|
5440
5270
|
* @see https://github.com/facebook/react/issues/14920
|
|
5441
5271
|
*/
|
|
5442
5272
|
'react/exhaustive-deps'?: Linter.RuleEntry<ReactExhaustiveDeps>;
|
|
5273
|
+
/**
|
|
5274
|
+
* Validates against assignment/mutation of globals during render, part of ensuring that side effects must run outside of render.
|
|
5275
|
+
* @see https://eslint-react.xyz/docs/rules/globals
|
|
5276
|
+
*/
|
|
5277
|
+
'react/globals'?: Linter.RuleEntry<[]>;
|
|
5443
5278
|
/**
|
|
5444
5279
|
* Validates against mutating props, state, and other values that are immutable.
|
|
5445
5280
|
* @see https://eslint-react.xyz/docs/rules/immutability
|
|
@@ -5635,11 +5470,6 @@ export interface Rules {
|
|
|
5635
5470
|
* @see https://eslint-react.xyz/docs/rules/no-nested-lazy-component-declarations
|
|
5636
5471
|
*/
|
|
5637
5472
|
'react/no-nested-lazy-component-declarations'?: Linter.RuleEntry<[]>;
|
|
5638
|
-
/**
|
|
5639
|
-
* Disallows 'shouldComponentUpdate' when extending 'React.PureComponent'.
|
|
5640
|
-
* @see https://eslint-react.xyz/docs/rules/no-redundant-should-component-update
|
|
5641
|
-
*/
|
|
5642
|
-
'react/no-redundant-should-component-update'?: Linter.RuleEntry<[]>;
|
|
5643
5473
|
/**
|
|
5644
5474
|
* Disallows calling 'this.setState' in 'componentDidMount' outside functions such as callbacks.
|
|
5645
5475
|
* @see https://eslint-react.xyz/docs/rules/no-set-state-in-component-did-mount
|
|
@@ -5655,16 +5485,6 @@ export interface Rules {
|
|
|
5655
5485
|
* @see https://eslint-react.xyz/docs/rules/no-set-state-in-component-will-update
|
|
5656
5486
|
*/
|
|
5657
5487
|
'react/no-set-state-in-component-will-update'?: Linter.RuleEntry<[]>;
|
|
5658
|
-
/**
|
|
5659
|
-
* Disallows unnecessary usage of 'useCallback'.
|
|
5660
|
-
* @see https://eslint-react.xyz/docs/rules/no-unnecessary-use-callback
|
|
5661
|
-
*/
|
|
5662
|
-
'react/no-unnecessary-use-callback'?: Linter.RuleEntry<[]>;
|
|
5663
|
-
/**
|
|
5664
|
-
* Disallows unnecessary usage of 'useMemo'.
|
|
5665
|
-
* @see https://eslint-react.xyz/docs/rules/no-unnecessary-use-memo
|
|
5666
|
-
*/
|
|
5667
|
-
'react/no-unnecessary-use-memo'?: Linter.RuleEntry<[]>;
|
|
5668
5488
|
/**
|
|
5669
5489
|
* Enforces that a function with the 'use' prefix uses at least one Hook inside it.
|
|
5670
5490
|
* @see https://eslint-react.xyz/docs/rules/no-unnecessary-use-prefix
|
|
@@ -5706,7 +5526,7 @@ export interface Rules {
|
|
|
5706
5526
|
*/
|
|
5707
5527
|
'react/no-unused-props'?: Linter.RuleEntry<[]>;
|
|
5708
5528
|
/**
|
|
5709
|
-
* Warns about
|
|
5529
|
+
* Warns about state variables that are defined but never used, or only used in effects.
|
|
5710
5530
|
* @see https://eslint-react.xyz/docs/rules/no-unused-state
|
|
5711
5531
|
*/
|
|
5712
5532
|
'react/no-unused-state'?: Linter.RuleEntry<[]>;
|
|
@@ -5715,16 +5535,6 @@ export interface Rules {
|
|
|
5715
5535
|
* @see https://eslint-react.xyz/docs/rules/no-use-context
|
|
5716
5536
|
*/
|
|
5717
5537
|
'react/no-use-context'?: Linter.RuleEntry<[]>;
|
|
5718
|
-
/**
|
|
5719
|
-
* Enforces destructuring assignment for component props and context.
|
|
5720
|
-
* @see https://eslint-react.xyz/docs/rules/prefer-destructuring-assignment
|
|
5721
|
-
*/
|
|
5722
|
-
'react/prefer-destructuring-assignment'?: Linter.RuleEntry<[]>;
|
|
5723
|
-
/**
|
|
5724
|
-
* Enforces importing React via a namespace import.
|
|
5725
|
-
* @see https://eslint-react.xyz/docs/rules/prefer-namespace-import
|
|
5726
|
-
*/
|
|
5727
|
-
'react/prefer-namespace-import'?: Linter.RuleEntry<[]>;
|
|
5728
5538
|
/**
|
|
5729
5539
|
* Validates that components and hooks are pure by checking that they do not call known-impure functions during render.
|
|
5730
5540
|
* @see https://eslint-react.xyz/docs/rules/purity
|
|
@@ -5755,6 +5565,11 @@ export interface Rules {
|
|
|
5755
5565
|
* @see https://eslint-react.xyz/docs/rules/set-state-in-render
|
|
5756
5566
|
*/
|
|
5757
5567
|
'react/set-state-in-render'?: Linter.RuleEntry<[]>;
|
|
5568
|
+
/**
|
|
5569
|
+
* Validates that components are static, not recreated every render.
|
|
5570
|
+
* @see https://eslint-react.xyz/docs/rules/static-components
|
|
5571
|
+
*/
|
|
5572
|
+
'react/static-components'?: Linter.RuleEntry<[]>;
|
|
5758
5573
|
/**
|
|
5759
5574
|
* Validates against syntax that React Compiler does not support.
|
|
5760
5575
|
* @see https://eslint-react.xyz/docs/rules/unsupported-syntax
|
|
@@ -5775,6 +5590,11 @@ export interface Rules {
|
|
|
5775
5590
|
* @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-event-listener
|
|
5776
5591
|
*/
|
|
5777
5592
|
'react/web-api-no-leaked-event-listener'?: Linter.RuleEntry<[]>;
|
|
5593
|
+
/**
|
|
5594
|
+
* Enforces that every 'fetch' in a component or custom hook has a corresponding 'AbortController' abort in the cleanup function.
|
|
5595
|
+
* @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-fetch
|
|
5596
|
+
*/
|
|
5597
|
+
'react/web-api-no-leaked-fetch'?: Linter.RuleEntry<[]>;
|
|
5778
5598
|
/**
|
|
5779
5599
|
* Enforces that every 'setInterval' in a component or custom hook has a corresponding 'clearInterval'.
|
|
5780
5600
|
* @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-interval
|
|
@@ -5790,11 +5610,6 @@ export interface Rules {
|
|
|
5790
5610
|
* @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-timeout
|
|
5791
5611
|
*/
|
|
5792
5612
|
'react/web-api-no-leaked-timeout'?: Linter.RuleEntry<[]>;
|
|
5793
|
-
/**
|
|
5794
|
-
* Disallows higher order functions that define components or hooks inside them.
|
|
5795
|
-
* @see https://eslint-react.xyz/docs/rules/component-hook-factories
|
|
5796
|
-
*/
|
|
5797
|
-
'react/x-component-hook-factories'?: Linter.RuleEntry<[]>;
|
|
5798
5613
|
/**
|
|
5799
5614
|
* Validates usage of Error Boundaries instead of try/catch for errors in child components.
|
|
5800
5615
|
* @see https://eslint-react.xyz/docs/rules/error-boundaries
|
|
@@ -5805,6 +5620,11 @@ export interface Rules {
|
|
|
5805
5620
|
* @see https://github.com/facebook/react/issues/14920
|
|
5806
5621
|
*/
|
|
5807
5622
|
'react/x-exhaustive-deps'?: Linter.RuleEntry<ReactXExhaustiveDeps>;
|
|
5623
|
+
/**
|
|
5624
|
+
* Validates against assignment/mutation of globals during render, part of ensuring that side effects must run outside of render.
|
|
5625
|
+
* @see https://eslint-react.xyz/docs/rules/globals
|
|
5626
|
+
*/
|
|
5627
|
+
'react/x-globals'?: Linter.RuleEntry<[]>;
|
|
5808
5628
|
/**
|
|
5809
5629
|
* Validates against mutating props, state, and other values that are immutable.
|
|
5810
5630
|
* @see https://eslint-react.xyz/docs/rules/immutability
|
|
@@ -5945,11 +5765,6 @@ export interface Rules {
|
|
|
5945
5765
|
* @see https://eslint-react.xyz/docs/rules/no-nested-lazy-component-declarations
|
|
5946
5766
|
*/
|
|
5947
5767
|
'react/x-no-nested-lazy-component-declarations'?: Linter.RuleEntry<[]>;
|
|
5948
|
-
/**
|
|
5949
|
-
* Disallows 'shouldComponentUpdate' when extending 'React.PureComponent'.
|
|
5950
|
-
* @see https://eslint-react.xyz/docs/rules/no-redundant-should-component-update
|
|
5951
|
-
*/
|
|
5952
|
-
'react/x-no-redundant-should-component-update'?: Linter.RuleEntry<[]>;
|
|
5953
5768
|
/**
|
|
5954
5769
|
* Disallows calling 'this.setState' in 'componentDidMount' outside functions such as callbacks.
|
|
5955
5770
|
* @see https://eslint-react.xyz/docs/rules/no-set-state-in-component-did-mount
|
|
@@ -5965,16 +5780,6 @@ export interface Rules {
|
|
|
5965
5780
|
* @see https://eslint-react.xyz/docs/rules/no-set-state-in-component-will-update
|
|
5966
5781
|
*/
|
|
5967
5782
|
'react/x-no-set-state-in-component-will-update'?: Linter.RuleEntry<[]>;
|
|
5968
|
-
/**
|
|
5969
|
-
* Disallows unnecessary usage of 'useCallback'.
|
|
5970
|
-
* @see https://eslint-react.xyz/docs/rules/no-unnecessary-use-callback
|
|
5971
|
-
*/
|
|
5972
|
-
'react/x-no-unnecessary-use-callback'?: Linter.RuleEntry<[]>;
|
|
5973
|
-
/**
|
|
5974
|
-
* Disallows unnecessary usage of 'useMemo'.
|
|
5975
|
-
* @see https://eslint-react.xyz/docs/rules/no-unnecessary-use-memo
|
|
5976
|
-
*/
|
|
5977
|
-
'react/x-no-unnecessary-use-memo'?: Linter.RuleEntry<[]>;
|
|
5978
5783
|
/**
|
|
5979
5784
|
* Enforces that a function with the 'use' prefix uses at least one Hook inside it.
|
|
5980
5785
|
* @see https://eslint-react.xyz/docs/rules/no-unnecessary-use-prefix
|
|
@@ -6016,7 +5821,7 @@ export interface Rules {
|
|
|
6016
5821
|
*/
|
|
6017
5822
|
'react/x-no-unused-props'?: Linter.RuleEntry<[]>;
|
|
6018
5823
|
/**
|
|
6019
|
-
* Warns about
|
|
5824
|
+
* Warns about state variables that are defined but never used, or only used in effects.
|
|
6020
5825
|
* @see https://eslint-react.xyz/docs/rules/no-unused-state
|
|
6021
5826
|
*/
|
|
6022
5827
|
'react/x-no-unused-state'?: Linter.RuleEntry<[]>;
|
|
@@ -6025,16 +5830,6 @@ export interface Rules {
|
|
|
6025
5830
|
* @see https://eslint-react.xyz/docs/rules/no-use-context
|
|
6026
5831
|
*/
|
|
6027
5832
|
'react/x-no-use-context'?: Linter.RuleEntry<[]>;
|
|
6028
|
-
/**
|
|
6029
|
-
* Enforces destructuring assignment for component props and context.
|
|
6030
|
-
* @see https://eslint-react.xyz/docs/rules/prefer-destructuring-assignment
|
|
6031
|
-
*/
|
|
6032
|
-
'react/x-prefer-destructuring-assignment'?: Linter.RuleEntry<[]>;
|
|
6033
|
-
/**
|
|
6034
|
-
* Enforces importing React via a namespace import.
|
|
6035
|
-
* @see https://eslint-react.xyz/docs/rules/prefer-namespace-import
|
|
6036
|
-
*/
|
|
6037
|
-
'react/x-prefer-namespace-import'?: Linter.RuleEntry<[]>;
|
|
6038
5833
|
/**
|
|
6039
5834
|
* Validates that components and hooks are pure by checking that they do not call known-impure functions during render.
|
|
6040
5835
|
* @see https://eslint-react.xyz/docs/rules/purity
|
|
@@ -6060,6 +5855,11 @@ export interface Rules {
|
|
|
6060
5855
|
* @see https://eslint-react.xyz/docs/rules/set-state-in-render
|
|
6061
5856
|
*/
|
|
6062
5857
|
'react/x-set-state-in-render'?: Linter.RuleEntry<[]>;
|
|
5858
|
+
/**
|
|
5859
|
+
* Validates that components are static, not recreated every render.
|
|
5860
|
+
* @see https://eslint-react.xyz/docs/rules/static-components
|
|
5861
|
+
*/
|
|
5862
|
+
'react/x-static-components'?: Linter.RuleEntry<[]>;
|
|
6063
5863
|
/**
|
|
6064
5864
|
* Validates against syntax that React Compiler does not support.
|
|
6065
5865
|
* @see https://eslint-react.xyz/docs/rules/unsupported-syntax
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiou/eslint-config",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "eslint config for JW",
|
|
6
6
|
"keywords": [],
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.7.1",
|
|
42
|
-
"@eslint-react/eslint-plugin": "^
|
|
42
|
+
"@eslint-react/eslint-plugin": "^5.7.1",
|
|
43
43
|
"@eslint/markdown": "^8.0.1",
|
|
44
44
|
"@next/eslint-plugin-next": "^16.2.4",
|
|
45
45
|
"@stylistic/eslint-plugin": "^5.10.0",
|
|
@@ -65,8 +65,8 @@
|
|
|
65
65
|
"jsonc-eslint-parser": "^3.1.0",
|
|
66
66
|
"local-pkg": "^1.1.2",
|
|
67
67
|
"yaml-eslint-parser": "^2.0.0",
|
|
68
|
-
"@aiou/eslint-
|
|
69
|
-
"@aiou/eslint-
|
|
68
|
+
"@aiou/eslint-plugin-progress": "0.4.0",
|
|
69
|
+
"@aiou/eslint-ignore": "0.6.1"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@rollup/plugin-alias": "4.0.3",
|
package/readme.md
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
# @aiou/eslint-config
|
|
2
|
-
*my flat eslint config*
|
|
3
|
-
|
|
4
|
-
[](https://www.npmjs.com/package/@aiou/eslint-config) [](https://github.com/JiangWeixian/eslint-config/tree/master/packages/default)
|
|
5
|
-
|
|
6
|
-
## features
|
|
7
|
-
|
|
8
|
-
- Common ignore patterns from [nodejs's gitignore](https://github.com/github/gitignore/blob/master/Node.gitignore)
|
|
9
|
-
- Support typescript, yaml, jsonc, markdown, etc..
|
|
10
|
-
- Built-in best practices react rules, react-refresh and ssr-friendly rules...
|
|
11
|
-
- Friendly fix reporter
|
|
12
|
-
|
|
13
|
-
<div align='center'>
|
|
14
|
-
|
|
15
|
-
<img src="https://user-images.githubusercontent.com/6839576/148364688-6a9fa8ac-94a3-4897-89fc-a3b64606e93c.png" width="400px" />
|
|
16
|
-
|
|
17
|
-
*▲ @aiou/eslint-plugin-progress*
|
|
18
|
-
|
|
19
|
-
</div>
|
|
20
|
-
|
|
21
|
-
## install
|
|
22
|
-
|
|
23
|
-
```console
|
|
24
|
-
npm install @aiou/eslint-config --save-dev
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## usage
|
|
28
|
-
|
|
29
|
-
in `eslint.config.mjs`
|
|
30
|
-
|
|
31
|
-
```js
|
|
32
|
-
import { aiou } from '@aiou/eslint-config'
|
|
33
|
-
|
|
34
|
-
export default await aiou()
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
### options
|
|
38
|
-
|
|
39
|
-
#### `options.ssr`
|
|
40
|
-
|
|
41
|
-
- default: `true`
|
|
42
|
-
|
|
43
|
-
enabled ssr-friendly rules
|
|
44
|
-
|
|
45
|
-
#### `options.regexp`
|
|
46
|
-
|
|
47
|
-
- default: `true`
|
|
48
|
-
|
|
49
|
-
enabled regexp rules
|
|
50
|
-
|
|
51
|
-
## rules
|
|
52
|
-
|
|
53
|
-
extends from
|
|
54
|
-
|
|
55
|
-
```console
|
|
56
|
-
eslint-config-standard
|
|
57
|
-
@eslint-community/eslint-plugin-eslint-comments
|
|
58
|
-
eslint-plugin-html
|
|
59
|
-
eslint-plugin-import-x
|
|
60
|
-
eslint-plugin-regexp (configured when regexp enabled)
|
|
61
|
-
eslint-plugin-markdown
|
|
62
|
-
eslint-plugin-simple-import-sort
|
|
63
|
-
eslint-plugin-import-newlines
|
|
64
|
-
eslint-plugin-unused-imports
|
|
65
|
-
eslint-plugin-jsonc
|
|
66
|
-
eslint-plugin-n (forked eslint-plugin-node)
|
|
67
|
-
eslint-plugin-promise
|
|
68
|
-
eslint-plugin-unicorn
|
|
69
|
-
eslint-plugin-yml
|
|
70
|
-
@eslint-react/eslint-plugin
|
|
71
|
-
eslint-plugin-react-refresh
|
|
72
|
-
@next/eslint-plugin-next (enabled when next found)
|
|
73
|
-
eslint-plugin-react-hooks
|
|
74
|
-
eslint-plugin-tailwindcss
|
|
75
|
-
@typescript-eslint/eslint-plugin
|
|
76
|
-
@stylistic/eslint-plugin
|
|
77
|
-
```
|