@ethang/eslint-config 18.0.1 → 18.1.0
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 +84 -0
- package/eslint.config.js +10 -1
- package/package.json +11 -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
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import react from "@eslint-react/eslint-plugin";
|
|
2
|
+
import reactHooks from "eslint-plugin-react-hooks";
|
|
3
|
+
import tseslint from "typescript-eslint";
|
|
4
|
+
|
|
5
|
+
import { ignores, languageOptions } from "./eslint.config.js";
|
|
6
|
+
|
|
7
|
+
export default tseslint.config({
|
|
8
|
+
files: ["**/*.{jsx,tsx}"],
|
|
9
|
+
ignores,
|
|
10
|
+
languageOptions,
|
|
11
|
+
plugins: {
|
|
12
|
+
react,
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
14
|
+
"react-hooks": reactHooks,
|
|
15
|
+
},
|
|
16
|
+
rules: {
|
|
17
|
+
"react-hooks/exhaustive-deps": "error",
|
|
18
|
+
"react-hooks/rules-of-hooks": "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",
|
|
41
|
+
"react/no-access-state-in-setstate": "error",
|
|
42
|
+
"react/no-array-index-key": "error",
|
|
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",
|
|
47
|
+
"react/no-children-prop": "error",
|
|
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",
|
|
57
|
+
"react/no-direct-mutation-state": "error",
|
|
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",
|
|
65
|
+
"react/no-redundant-should-component-update": "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
|
+
"react/no-string-refs": "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",
|
|
76
|
+
"react/no-unused-state": "error",
|
|
77
|
+
"react/no-useless-fragment": "error",
|
|
78
|
+
"react/prefer-destructuring-assignment": "error",
|
|
79
|
+
"react/prefer-read-only-props": "error",
|
|
80
|
+
|
|
81
|
+
"react/prefer-shorthand-boolean": "error",
|
|
82
|
+
"react/prefer-shorthand-fragment": "error",
|
|
83
|
+
},
|
|
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,13 @@ 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: ["**/*.{js,ts,mjs,jsx,tsx}"],
|
|
24
25
|
ignores,
|
|
25
26
|
languageOptions,
|
|
26
27
|
plugins: {
|
|
27
28
|
"@typescript-eslint": tseslint.plugin,
|
|
28
29
|
a11y,
|
|
30
|
+
barrel,
|
|
31
|
+
depend,
|
|
29
32
|
n,
|
|
30
33
|
perfectionist,
|
|
31
34
|
sonar,
|
|
@@ -33,6 +36,12 @@ export default tseslint.config(eslintPluginPrettier, {
|
|
|
33
36
|
"@tanstack/query": tanstack,
|
|
34
37
|
},
|
|
35
38
|
rules: {
|
|
39
|
+
"depend/ban-dependencies": "error",
|
|
40
|
+
"barrel/avoid-barrel-files": "error",
|
|
41
|
+
"barrel/avoid-importing-barrel-files": "error",
|
|
42
|
+
"barrel/avoid-namespace-import": "error",
|
|
43
|
+
"barrel/avoid-re-export-all": "error",
|
|
44
|
+
|
|
36
45
|
"accessor-pairs": "error",
|
|
37
46
|
"array-callback-return": "error",
|
|
38
47
|
"arrow-body-style": ["error", "always"],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ethang/eslint-config",
|
|
3
|
-
"version": "18.0
|
|
3
|
+
"version": "18.1.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"url": "git+https://github.com/eglove/eslint-config-ethang.git"
|
|
6
6
|
},
|
|
@@ -16,16 +16,21 @@
|
|
|
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",
|
|
28
31
|
"eslint-plugin-prettier": "^5.2.1",
|
|
32
|
+
"eslint-plugin-react": "^7.35.0",
|
|
33
|
+
"eslint-plugin-react-hooks": "^4.6.2",
|
|
29
34
|
"eslint-plugin-sonarjs": "1.0.4",
|
|
30
35
|
"eslint-plugin-unicorn": "^55.0.0",
|
|
31
36
|
"prettier": "^3.3.3",
|
|
@@ -33,16 +38,21 @@
|
|
|
33
38
|
"typescript-eslint": "^8.0.0"
|
|
34
39
|
},
|
|
35
40
|
"dependencies": {
|
|
41
|
+
"@eslint-react/eslint-plugin": "^1.8.2",
|
|
36
42
|
"@eslint/js": "^9.8.0",
|
|
37
43
|
"@tanstack/eslint-plugin-query": "^5.51.15",
|
|
38
44
|
"@typescript-eslint/parser": "^8.0.0",
|
|
39
45
|
"eslint": "^9.8.0",
|
|
40
46
|
"eslint-config-prettier": "^9.1.0",
|
|
41
47
|
"eslint-plugin-astro": "^1.2.3",
|
|
48
|
+
"eslint-plugin-barrel-files": "^2.1.0",
|
|
49
|
+
"eslint-plugin-depend": "^0.9.0",
|
|
42
50
|
"eslint-plugin-jsx-a11y": "^6.9.0",
|
|
43
51
|
"eslint-plugin-n": "^17.10.1",
|
|
44
52
|
"eslint-plugin-perfectionist": "^3.1.0",
|
|
45
53
|
"eslint-plugin-prettier": "^5.2.1",
|
|
54
|
+
"eslint-plugin-react": "^7.35.0",
|
|
55
|
+
"eslint-plugin-react-hooks": "^4.6.2",
|
|
46
56
|
"eslint-plugin-sonarjs": "1.0.4",
|
|
47
57
|
"eslint-plugin-unicorn": "^55.0.0",
|
|
48
58
|
"prettier": "^3.3.3",
|