@ethang/eslint-config 18.0.2 → 18.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 +10 -8
- package/config.react.js +56 -69
- package/eslint.config.js +11 -1
- package/package.json +7 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[View Config](https://eslint-config-ethang.pages.dev/rules)
|
|
4
4
|
|
|
5
|
-
*
|
|
5
|
+
* 474 errored rules.
|
|
6
6
|
* 142 rules from vanilla EsLint
|
|
7
7
|
* 113 rules from [sindresorhus/eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn)
|
|
8
8
|
* 104 rules from [@typescript/eslint](https://github.com/typescript-eslint/typescript-eslint)
|
|
@@ -10,16 +10,18 @@
|
|
|
10
10
|
* 32 rules from [eslint-plugin-sonarjs](https://github.com/SonarSource/eslint-plugin-sonarjs)
|
|
11
11
|
* 20 rules from [eslint-plugin-n](https://github.com/eslint-community/eslint-plugin-n/tree/67bbfdf3c6862dcbfe455a4afbd83fa60f9d1ea4)
|
|
12
12
|
* 19 rules from [eslint-plugin-perfectionist](https://github.com/azat-io/eslint-plugin-perfectionist)
|
|
13
|
+
* 4 rules from [eslint-plugin-barrel-files](https://github.com/thepassle/eslint-plugin-barrel-files)
|
|
13
14
|
* 3 rules from [@tanstack/eslint-plugin-query](https://tanstack.com/query/latest/docs/eslint/eslint-plugin-query)
|
|
15
|
+
* 1 rule from [eslint-plugin-depend](https://github.com/es-tooling/eslint-plugin-depend/tree/main)
|
|
14
16
|
* Includes Prettier built-in (do NOT use this with a separate Prettier config.)
|
|
15
17
|
|
|
16
18
|
# Add Even More!
|
|
17
19
|
* 51 rules for **Astro**
|
|
18
|
-
*
|
|
20
|
+
* `import configAstro from "@ethang/eslint-config/config.astro.js";`
|
|
19
21
|
* 51 rules from [eslint-plugin-astro](https://github.com/ota-meshi/eslint-plugin-astro)
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
22
|
+
* 72 rules for **React**
|
|
23
|
+
* `import configReact from "@ethang/eslint-config/config.react.js";`
|
|
24
|
+
* 70 rules from [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react)
|
|
23
25
|
* 2 rules from [eslint-plugin-react-hooks](https://github.com/facebook/react/tree/main/packages/eslint-plugin-react-hooks)
|
|
24
26
|
|
|
25
27
|
# Install
|
|
@@ -35,10 +37,10 @@ In **eslint.config.js**
|
|
|
35
37
|
```js
|
|
36
38
|
import config from "@ethang/eslint-config/eslint.config.js";
|
|
37
39
|
import tseslint from "typescript-eslint";
|
|
38
|
-
import
|
|
40
|
+
import configAstro from "@ethang/eslint-config/config.astro.js"; // OPTIONAL
|
|
41
|
+
import configReact from "@ethang/eslint-config/config.react.js"; // OPTIONAL
|
|
39
42
|
|
|
40
|
-
export default tseslint.config(...config, ...astroConfig, {
|
|
41
|
-
ignores: ["dist/"], // Your ignores directories
|
|
43
|
+
export default tseslint.config(...config, ...astroConfig, ...reactConfig, {
|
|
42
44
|
languageOptions: {
|
|
43
45
|
parserOptions: {
|
|
44
46
|
project: true,
|
package/config.react.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import react from "eslint-plugin
|
|
1
|
+
import react from "@eslint-react/eslint-plugin";
|
|
2
2
|
import reactHooks from "eslint-plugin-react-hooks";
|
|
3
3
|
import tseslint from "typescript-eslint";
|
|
4
4
|
|
|
@@ -9,7 +9,6 @@ export default tseslint.config({
|
|
|
9
9
|
ignores,
|
|
10
10
|
languageOptions,
|
|
11
11
|
plugins: {
|
|
12
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
13
12
|
react,
|
|
14
13
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
15
14
|
"react-hooks": reactHooks,
|
|
@@ -17,81 +16,69 @@ export default tseslint.config({
|
|
|
17
16
|
rules: {
|
|
18
17
|
"react-hooks/exhaustive-deps": "error",
|
|
19
18
|
"react-hooks/rules-of-hooks": "error",
|
|
20
|
-
"react/
|
|
21
|
-
"react/
|
|
22
|
-
"react/
|
|
23
|
-
"react/
|
|
24
|
-
"react/
|
|
25
|
-
"react/
|
|
26
|
-
"react/
|
|
27
|
-
"react/
|
|
28
|
-
"react/
|
|
29
|
-
"react/iframe-
|
|
30
|
-
"react/
|
|
31
|
-
"react/
|
|
32
|
-
"react/
|
|
33
|
-
"react/
|
|
34
|
-
"react/
|
|
35
|
-
"react/
|
|
36
|
-
"react/
|
|
37
|
-
"react/
|
|
38
|
-
"react/
|
|
39
|
-
"react/
|
|
40
|
-
"react/
|
|
41
|
-
"react/
|
|
42
|
-
"react/jsx-no-script-url": "error",
|
|
43
|
-
"react/jsx-no-target-blank": "error",
|
|
44
|
-
"react/jsx-no-undef": "error",
|
|
45
|
-
"react/jsx-no-useless-fragment": "error",
|
|
46
|
-
"react/jsx-pascal-case": "error",
|
|
47
|
-
"react/jsx-props-no-spread-multi": "error",
|
|
48
|
-
"react/jsx-uses-react": "error",
|
|
49
|
-
"react/jsx-uses-vars": "error",
|
|
19
|
+
"react/dom/no-children-in-void-dom-elements": "error",
|
|
20
|
+
"react/dom/no-dangerously-set-innerhtml": "error",
|
|
21
|
+
"react/dom/no-dangerously-set-innerhtml-with-children": "error",
|
|
22
|
+
"react/dom/no-find-dom-node": "error",
|
|
23
|
+
"react/dom/no-missing-button-type": "error",
|
|
24
|
+
"react/dom/no-missing-iframe-sandbox": "error",
|
|
25
|
+
"react/dom/no-namespace": "error",
|
|
26
|
+
"react/dom/no-render-return-value": "error",
|
|
27
|
+
"react/dom/no-script-url": "error",
|
|
28
|
+
"react/dom/no-unsafe-iframe-sandbox": "error",
|
|
29
|
+
"react/dom/no-unsafe-target-blank": "error",
|
|
30
|
+
"react/ensure-forward-ref-using-ref": "error",
|
|
31
|
+
"react/hooks-extra/ensure-custom-hooks-using-other-hooks": "error",
|
|
32
|
+
"react/hooks-extra/ensure-use-callback-has-non-empty-deps": "error",
|
|
33
|
+
"react/hooks-extra/ensure-use-memo-has-non-empty-deps": "error",
|
|
34
|
+
"react/hooks-extra/no-direct-set-state-in-use-effect": "error",
|
|
35
|
+
"react/hooks-extra/no-direct-set-state-in-use-layout-effect": "error",
|
|
36
|
+
"react/hooks-extra/prefer-use-state-lazy-initialization": "error",
|
|
37
|
+
"react/naming-convention/component-name": "error",
|
|
38
|
+
"react/naming-convention/filename": ["error", { rule: "kebab-case" }],
|
|
39
|
+
"react/naming-convention/filename-extension": "error",
|
|
40
|
+
"react/naming-convention/use-state": "error",
|
|
50
41
|
"react/no-access-state-in-setstate": "error",
|
|
51
|
-
"react/no-adjacent-inline-elements": "error",
|
|
52
42
|
"react/no-array-index-key": "error",
|
|
53
|
-
"react/no-
|
|
43
|
+
"react/no-children-count": "error",
|
|
44
|
+
"react/no-children-for-each": "error",
|
|
45
|
+
"react/no-children-map": "error",
|
|
46
|
+
"react/no-children-only": "error",
|
|
54
47
|
"react/no-children-prop": "error",
|
|
55
|
-
"react/no-
|
|
56
|
-
"react/no-
|
|
57
|
-
"react/no-
|
|
58
|
-
"react/no-
|
|
48
|
+
"react/no-children-to-array": "error",
|
|
49
|
+
"react/no-class-component": "error",
|
|
50
|
+
"react/no-clone-element": "error",
|
|
51
|
+
"react/no-comment-textnodes": "error",
|
|
52
|
+
"react/no-component-will-mount": "error",
|
|
53
|
+
"react/no-component-will-receive-props": "error",
|
|
54
|
+
"react/no-component-will-update": "error",
|
|
55
|
+
"react/no-create-ref": "error",
|
|
56
|
+
"react/no-default-props": "error",
|
|
59
57
|
"react/no-direct-mutation-state": "error",
|
|
60
|
-
"react/no-
|
|
61
|
-
"react/no-
|
|
62
|
-
"react/no-
|
|
63
|
-
"react/no-
|
|
64
|
-
"react/no-
|
|
65
|
-
"react/no-
|
|
58
|
+
"react/no-duplicate-key": "error",
|
|
59
|
+
"react/no-implicit-key": "error",
|
|
60
|
+
"react/no-leaked-conditional-rendering": "error",
|
|
61
|
+
"react/no-missing-component-display-name": "error",
|
|
62
|
+
"react/no-missing-key": "error",
|
|
63
|
+
"react/no-nested-components": "error",
|
|
64
|
+
"react/no-prop-types": "error",
|
|
66
65
|
"react/no-redundant-should-component-update": "error",
|
|
67
|
-
"react/no-
|
|
68
|
-
"react/no-set-state": "error",
|
|
66
|
+
"react/no-set-state-in-component-did-mount": "error",
|
|
67
|
+
"react/no-set-state-in-component-did-update": "error",
|
|
68
|
+
"react/no-set-state-in-component-will-update": "error",
|
|
69
69
|
"react/no-string-refs": "error",
|
|
70
|
-
"react/no-
|
|
71
|
-
"react/no-
|
|
72
|
-
"react/no-
|
|
73
|
-
"react/no-
|
|
74
|
-
"react/no-
|
|
75
|
-
"react/no-
|
|
76
|
-
"react/no-unused-class-component-methods": "error",
|
|
77
|
-
"react/no-unused-prop-types": "error",
|
|
70
|
+
"react/no-unsafe-component-will-mount": "error",
|
|
71
|
+
"react/no-unsafe-component-will-receive-props": "error",
|
|
72
|
+
"react/no-unsafe-component-will-update": "error",
|
|
73
|
+
"react/no-unstable-context-value": "error",
|
|
74
|
+
"react/no-unstable-default-props": "error",
|
|
75
|
+
"react/no-unused-class-component-members": "error",
|
|
78
76
|
"react/no-unused-state": "error",
|
|
79
|
-
"react/no-
|
|
80
|
-
"react/prefer-
|
|
81
|
-
"react/prefer-exact-props": "error",
|
|
77
|
+
"react/no-useless-fragment": "error",
|
|
78
|
+
"react/prefer-destructuring-assignment": "error",
|
|
82
79
|
"react/prefer-read-only-props": "error",
|
|
83
|
-
"react/prefer-stateless-function": "error",
|
|
84
|
-
"react/prop-types": "error",
|
|
85
|
-
"react/require-optimization": "error",
|
|
86
|
-
"react/require-render-return": "error",
|
|
87
|
-
"react/self-closing-comp": "error",
|
|
88
|
-
"react/sort-comp": "error",
|
|
89
|
-
"react/sort-default-props": "error",
|
|
90
|
-
"react/sort-prop-types": "error",
|
|
91
|
-
"react/state-in-constructor": "error",
|
|
92
|
-
"react/static-property-placement": "error",
|
|
93
80
|
|
|
94
|
-
"react/
|
|
95
|
-
"react/
|
|
81
|
+
"react/prefer-shorthand-boolean": "error",
|
|
82
|
+
"react/prefer-shorthand-fragment": "error",
|
|
96
83
|
},
|
|
97
84
|
});
|
package/eslint.config.js
CHANGED
|
@@ -8,6 +8,8 @@ import tseslint from "typescript-eslint";
|
|
|
8
8
|
import sonar from "eslint-plugin-sonarjs";
|
|
9
9
|
import tanstack from "@tanstack/eslint-plugin-query";
|
|
10
10
|
import perfectionist from "eslint-plugin-perfectionist";
|
|
11
|
+
import depend from "eslint-plugin-depend";
|
|
12
|
+
import barrel from "eslint-plugin-barrel-files";
|
|
11
13
|
|
|
12
14
|
export const languageOptions = {
|
|
13
15
|
parser,
|
|
@@ -20,12 +22,14 @@ export const languageOptions = {
|
|
|
20
22
|
export const ignores = ["eslint.config.js", "node_modules", "dist"];
|
|
21
23
|
|
|
22
24
|
export default tseslint.config(eslintPluginPrettier, {
|
|
23
|
-
files: ["
|
|
25
|
+
files: ["**/*"],
|
|
24
26
|
ignores,
|
|
25
27
|
languageOptions,
|
|
26
28
|
plugins: {
|
|
27
29
|
"@typescript-eslint": tseslint.plugin,
|
|
28
30
|
a11y,
|
|
31
|
+
barrel,
|
|
32
|
+
depend,
|
|
29
33
|
n,
|
|
30
34
|
perfectionist,
|
|
31
35
|
sonar,
|
|
@@ -33,6 +37,12 @@ export default tseslint.config(eslintPluginPrettier, {
|
|
|
33
37
|
"@tanstack/query": tanstack,
|
|
34
38
|
},
|
|
35
39
|
rules: {
|
|
40
|
+
"depend/ban-dependencies": "error",
|
|
41
|
+
"barrel/avoid-barrel-files": "error",
|
|
42
|
+
"barrel/avoid-importing-barrel-files": "error",
|
|
43
|
+
"barrel/avoid-namespace-import": "error",
|
|
44
|
+
"barrel/avoid-re-export-all": "error",
|
|
45
|
+
|
|
36
46
|
"accessor-pairs": "error",
|
|
37
47
|
"array-callback-return": "error",
|
|
38
48
|
"arrow-body-style": ["error", "always"],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ethang/eslint-config",
|
|
3
|
-
"version": "18.
|
|
3
|
+
"version": "18.1.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"url": "git+https://github.com/eglove/eslint-config-ethang.git"
|
|
6
6
|
},
|
|
@@ -16,12 +16,15 @@
|
|
|
16
16
|
"author": "Ethan Glover",
|
|
17
17
|
"license": "ISC",
|
|
18
18
|
"peerDependencies": {
|
|
19
|
+
"@eslint-react/eslint-plugin": "^1.8.2",
|
|
19
20
|
"@eslint/js": "^9.8.0",
|
|
20
21
|
"@tanstack/eslint-plugin-query": "^5.51.15",
|
|
21
22
|
"@typescript-eslint/parser": "^8.0.0",
|
|
22
23
|
"eslint": "^9.8.0",
|
|
23
24
|
"eslint-config-prettier": "^9.1.0",
|
|
24
25
|
"eslint-plugin-astro": "^1.2.3",
|
|
26
|
+
"eslint-plugin-barrel-files": "^2.1.0",
|
|
27
|
+
"eslint-plugin-depend": "^0.9.0",
|
|
25
28
|
"eslint-plugin-jsx-a11y": "^6.9.0",
|
|
26
29
|
"eslint-plugin-n": "^17.10.1",
|
|
27
30
|
"eslint-plugin-perfectionist": "^3.1.0",
|
|
@@ -35,12 +38,15 @@
|
|
|
35
38
|
"typescript-eslint": "^8.0.0"
|
|
36
39
|
},
|
|
37
40
|
"dependencies": {
|
|
41
|
+
"@eslint-react/eslint-plugin": "^1.8.2",
|
|
38
42
|
"@eslint/js": "^9.8.0",
|
|
39
43
|
"@tanstack/eslint-plugin-query": "^5.51.15",
|
|
40
44
|
"@typescript-eslint/parser": "^8.0.0",
|
|
41
45
|
"eslint": "^9.8.0",
|
|
42
46
|
"eslint-config-prettier": "^9.1.0",
|
|
43
47
|
"eslint-plugin-astro": "^1.2.3",
|
|
48
|
+
"eslint-plugin-barrel-files": "^2.1.0",
|
|
49
|
+
"eslint-plugin-depend": "^0.9.0",
|
|
44
50
|
"eslint-plugin-jsx-a11y": "^6.9.0",
|
|
45
51
|
"eslint-plugin-n": "^17.10.1",
|
|
46
52
|
"eslint-plugin-perfectionist": "^3.1.0",
|