Skip to content

Commit da46c1f

Browse files
committed
docs: update readme of each plugin
1 parent faeb3bb commit da46c1f

File tree

6 files changed

+126
-138
lines changed

6 files changed

+126
-138
lines changed

packages/plugins/eslint-plugin-react-debug/README.md

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,37 @@ Debugging rules.
66

77
```sh
88
# npm
9-
npm install --save-dev eslint-plugin-react-dom
9+
npm install --save-dev eslint-plugin-react-debug
1010
```
1111

1212
## Setup
1313

1414
```js
15-
// @ts-check
15+
// eslint.config.js
1616

17+
// @ts-check
1718
import js from "@eslint/js";
1819
import reactDebug from "eslint-plugin-react-debug";
19-
20-
export default [
21-
js.configs.recommended,
22-
{
23-
files: ["**/*.{ts,tsx}"],
24-
plugins: {
25-
"react-debug": reactDebug,
26-
},
27-
rules: {
28-
"react-debug/class-component": "warn",
29-
"react-debug/function-component": "warn",
30-
"react-debug/hook": "warn",
31-
"react-debug/is-from-react": "off",
20+
import tseslint from "typescript-eslint";
21+
22+
export default tseslint.config({
23+
files: ["**/*.ts", "**/*.tsx"],
24+
extends: [
25+
js.configs.recommended,
26+
tseslint.configs.recommended,
27+
reactDebug.configs.all,
28+
],
29+
languageOptions: {
30+
parser: tseslint.parser,
31+
parserOptions: {
32+
projectService: true,
3233
},
3334
},
34-
];
35+
rules: {
36+
// Put rules you want to override here
37+
"react-debug/function-component": "warn",
38+
},
39+
});
3540
```
3641

3742
## Rules

packages/plugins/eslint-plugin-react-dom/README.md

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,35 +12,31 @@ npm install --save-dev eslint-plugin-react-dom
1212
## Setup
1313

1414
```js
15-
// @ts-check
15+
// eslint.config.js
1616

17+
// @ts-check
1718
import js from "@eslint/js";
18-
import reactDOM from "eslint-plugin-react-dom";
19-
20-
export default [
21-
js.configs.recommended,
22-
{
23-
files: ["**/*.{ts,tsx}"],
24-
plugins: {
25-
"react-dom": reactDOM,
26-
},
27-
rules: {
28-
// react-dom recommended rules
29-
"react-dom/no-dangerously-set-innerhtml-with-children": "error",
30-
"react-dom/no-dangerously-set-innerhtml": "warn",
31-
"react-dom/no-find-dom-node": "error",
32-
"react-dom/no-missing-button-type": "warn",
33-
"react-dom/no-missing-iframe-sandbox": "warn",
34-
"react-dom/no-namespace": "error",
35-
"react-dom/no-render-return-value": "error",
36-
"react-dom/no-script-url": "warn",
37-
"react-dom/no-unknown-property": "warn",
38-
"react-dom/no-unsafe-iframe-sandbox": "warn",
39-
"react-dom/no-unsafe-target-blank": "warn",
40-
"react-dom/no-void-elements-with-children": "warn",
19+
import reactDom from "eslint-plugin-react-dom";
20+
import tseslint from "typescript-eslint";
21+
22+
export default tseslint.config({
23+
files: ["**/*.ts", "**/*.tsx"],
24+
extends: [
25+
js.configs.recommended,
26+
tseslint.configs.recommended,
27+
reactDom.configs.recommended,
28+
],
29+
languageOptions: {
30+
parser: tseslint.parser,
31+
parserOptions: {
32+
projectService: true,
4133
},
4234
},
43-
];
35+
rules: {
36+
// Put rules you want to override here
37+
"react-dom/no-dangerously-set-innerhtml": "warn",
38+
},
39+
});
4440
```
4541

4642
## Rules

packages/plugins/eslint-plugin-react-hooks-extra/README.md

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,31 @@ npm install --save-dev eslint-plugin-react-hooks-extra
1212
## Setup
1313

1414
```js
15-
// @ts-check
15+
// eslint.config.js
1616

17+
// @ts-check
1718
import js from "@eslint/js";
1819
import reactHooksExtra from "eslint-plugin-react-hooks-extra";
19-
20-
export default [
21-
js.configs.recommended,
22-
{
23-
files: ["**/*.{ts,tsx}"],
24-
plugins: {
25-
"react-hooks-extra": reactHooksExtra,
26-
},
27-
rules: {
28-
// react-hooks-extra recommended rules
29-
"react-hooks-extra/no-direct-set-state-in-use-effect": "warn",
30-
"react-hooks-extra/no-useless-custom-hooks": "warn",
31-
"react-hooks-extra/prefer-use-state-lazy-initialization": "warn",
20+
import tseslint from "typescript-eslint";
21+
22+
export default tseslint.config({
23+
files: ["**/*.ts", "**/*.tsx"],
24+
extends: [
25+
js.configs.recommended,
26+
tseslint.configs.recommended,
27+
reactHooksExtra.configs.recommended,
28+
],
29+
languageOptions: {
30+
parser: tseslint.parser,
31+
parserOptions: {
32+
projectService: true,
3233
},
3334
},
34-
];
35+
rules: {
36+
// Put rules you want to override here
37+
"react-hooks-extra/no-useless-custom-hooks": "warn",
38+
},
39+
});
3540
```
3641

3742
## Rules

packages/plugins/eslint-plugin-react-naming-convention/README.md

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,33 @@ npm install --save-dev eslint-plugin-react-naming-convention
1212
## Setup
1313

1414
```js
15-
// @ts-check
15+
// eslint.config.js
1616

17+
// @ts-check
1718
import js from "@eslint/js";
1819
import reactNamingConvention from "eslint-plugin-react-naming-convention";
19-
20-
export default [
21-
js.configs.recommended,
22-
{
23-
files: ["**/*.{ts,tsx}"],
24-
plugins: {
25-
"react-naming-convention": reactNamingConvention,
26-
},
27-
rules: {
28-
// react-naming-convention recommended rules
29-
"react-naming-convention/filename-extension": ["warn", "as-needed"],
30-
"react-naming-convention/use-state": "warn",
20+
import tseslint from "typescript-eslint";
21+
22+
export default tseslint.config({
23+
files: ["**/*.ts", "**/*.tsx"],
24+
extends: [
25+
js.configs.recommended,
26+
tseslint.configs.recommended,
27+
],
28+
plugins: {
29+
"react-naming-convention": reactNamingConvention,
30+
},
31+
languageOptions: {
32+
parser: tseslint.parser,
33+
parserOptions: {
34+
projectService: true,
3135
},
3236
},
33-
];
37+
rules: {
38+
// Put rules you want to use here
39+
"react-naming-convention/component-name": "warn",
40+
},
41+
});
3442
```
3543

3644
## Rules

packages/plugins/eslint-plugin-react-web-api/README.md

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,31 @@ npm install --save-dev eslint-plugin-react-web-api
1212
## Setup
1313

1414
```js
15-
// @ts-check
15+
// eslint.config.js
1616

17+
// @ts-check
1718
import js from "@eslint/js";
18-
import reactWebAPI from "eslint-plugin-react-web-api";
19-
20-
export default [
21-
js.configs.recommended,
22-
{
23-
files: ["**/*.{ts,tsx}"],
24-
plugins: [
25-
"react-web-api": reactWebAPI,
26-
rules: {
27-
// react-web-api recommended rules
28-
"react-web-api/no-leaked-event-listener": "warn",
29-
"react-web-api/no-leaked-interval": "warn",
30-
"react-web-api/no-leaked-resize-observer": "warn",
31-
"react-web-api/no-leaked-timeout": "warn",
32-
}
33-
],
19+
import reactWebApi from "eslint-plugin-react-web-api";
20+
import tseslint from "typescript-eslint";
21+
22+
export default tseslint.config({
23+
files: ["**/*.ts", "**/*.tsx"],
24+
extends: [
25+
js.configs.recommended,
26+
tseslint.configs.recommended,
27+
reactWebApi.configs.recommended,
28+
],
29+
languageOptions: {
30+
parser: tseslint.parser,
31+
parserOptions: {
32+
projectService: true,
33+
},
34+
},
35+
rules: {
36+
// Put rules you want to override here
37+
"react-web-api/no-leaked-event-listener": "warn",
3438
},
35-
];
39+
});
3640
```
3741

3842
## Rules

packages/plugins/eslint-plugin-react-x/README.md

Lines changed: 20 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -12,61 +12,31 @@ npm install --save-dev eslint-plugin-react-x
1212
## Setup
1313

1414
```js
15-
// @ts-check
15+
// eslint.config.js
1616

17+
// @ts-check
1718
import js from "@eslint/js";
1819
import reactx from "eslint-plugin-react-x";
19-
20-
export default [
21-
js.configs.recommended,
22-
{
23-
files: ["**/*.{ts,tsx}"],
24-
plugins: {
25-
"react-x": reactx,
26-
},
27-
rules: {
28-
// react-x recommended rules
29-
"react-x/ensure-forward-ref-using-ref": "warn",
30-
"react-x/no-access-state-in-setstate": "error",
31-
"react-x/no-array-index-key": "warn",
32-
"react-x/no-children-count": "warn",
33-
"react-x/no-children-for-each": "warn",
34-
"react-x/no-children-map": "warn",
35-
"react-x/no-children-only": "warn",
36-
"react-x/no-children-to-array": "warn",
37-
"react-x/no-clone-element": "warn",
38-
"react-x/no-comment-textnodes": "warn",
39-
"react-x/no-component-will-mount": "error",
40-
"react-x/no-component-will-receive-props": "error",
41-
"react-x/no-component-will-update": "error",
42-
"react-x/no-context-provider": "warn",
43-
"react-x/no-create-ref": "error",
44-
"react-x/no-default-props": "error",
45-
"react-x/no-direct-mutation-state": "error",
46-
"react-x/no-duplicate-jsx-props": "warn",
47-
"react-x/no-duplicate-key": "warn",
48-
"react-x/no-forward-ref": "warn",
49-
"react-x/no-implicit-key": "warn",
50-
"react-x/no-missing-key": "error",
51-
"react-x/no-nested-components": "error",
52-
"react-x/no-prop-types": "error",
53-
"react-x/no-redundant-should-component-update": "error",
54-
"react-x/no-set-state-in-component-did-mount": "warn",
55-
"react-x/no-set-state-in-component-did-update": "warn",
56-
"react-x/no-set-state-in-component-will-update": "warn",
57-
"react-x/no-string-refs": "error",
58-
"react-x/no-unsafe-component-will-mount": "warn",
59-
"react-x/no-unsafe-component-will-receive-props": "warn",
60-
"react-x/no-unsafe-component-will-update": "warn",
61-
"react-x/no-unstable-context-value": "warn",
62-
"react-x/no-unstable-default-props": "warn",
63-
"react-x/no-unused-class-component-members": "warn",
64-
"react-x/no-unused-state": "warn",
65-
"react-x/no-use-context": "warn",
66-
"react-x/use-jsx-vars": "warn",
20+
import tseslint from "typescript-eslint";
21+
22+
export default tseslint.config({
23+
files: ["**/*.ts", "**/*.tsx"],
24+
extends: [
25+
js.configs.recommended,
26+
tseslint.configs.recommended,
27+
reactx.configs.recommended,
28+
],
29+
languageOptions: {
30+
parser: tseslint.parser,
31+
parserOptions: {
32+
projectService: true,
6733
},
6834
},
69-
];
35+
rules: {
36+
// Put rules you want to override here
37+
"react-x/prefer-shorthand-boolean": "warn",
38+
},
39+
});
7040
```
7141

7242
## Rules

0 commit comments

Comments
 (0)