@ethang/eslint-config 19.0.10 → 19.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 +6 -3
- package/build/update-readme.js +107 -31
- package/build/update-rules.js +88 -26
- package/config.astro.js +4 -52
- package/config.react.js +4 -72
- package/config.solid.js +4 -19
- package/constants.js +1 -0
- package/eslint.config.js +1695 -1572
- package/package.json +6 -1
- package/setup/astro.js +7 -0
- package/setup/deprecated.js +105 -0
- package/setup/gen-rules.js +4 -3
- package/setup/json.js +7 -0
- package/setup/markdown.js +7 -0
- package/setup/react.js +30 -0
- package/setup/solid.js +10 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ethang/eslint-config",
|
|
3
|
-
"version": "19.0
|
|
3
|
+
"version": "19.1.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"url": "git+https://github.com/eglove/eslint-config-ethang.git"
|
|
6
6
|
},
|
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"@eslint-react/eslint-plugin": "^1.12.1",
|
|
20
20
|
"@eslint/js": "^9.9.1",
|
|
21
|
+
"@eslint/json": "^0.4.0",
|
|
22
|
+
"@eslint/markdown": "^6.0.0",
|
|
21
23
|
"@stylistic/eslint-plugin": "^2.6.4",
|
|
22
24
|
"@tanstack/eslint-plugin-query": "^5.52.0",
|
|
23
25
|
"@typescript-eslint/parser": "^8.2.0",
|
|
@@ -41,6 +43,8 @@
|
|
|
41
43
|
"dependencies": {
|
|
42
44
|
"@eslint-react/eslint-plugin": "^1.12.1",
|
|
43
45
|
"@eslint/js": "^9.9.1",
|
|
46
|
+
"@eslint/json": "^0.4.0",
|
|
47
|
+
"@eslint/markdown": "^6.0.0",
|
|
44
48
|
"@stylistic/eslint-plugin": "^2.6.4",
|
|
45
49
|
"@tanstack/eslint-plugin-query": "^5.52.0",
|
|
46
50
|
"@typescript-eslint/parser": "^8.2.0",
|
|
@@ -62,6 +66,7 @@
|
|
|
62
66
|
"typescript-eslint": "^8.2.0"
|
|
63
67
|
},
|
|
64
68
|
"devDependencies": {
|
|
69
|
+
"@ethang/markdown-generator": "^1.0.6",
|
|
65
70
|
"@ethang/project-builder": "^2.3.10",
|
|
66
71
|
"@tsconfig/node-lts": "^20.1.3",
|
|
67
72
|
"@tsconfig/strictest": "^2.0.5",
|
package/setup/astro.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import astro from "eslint-plugin-astro";
|
|
2
|
+
import { genRules } from "./gen-rules.js";
|
|
3
|
+
|
|
4
|
+
const ruleNames = Object.keys(astro.rules);
|
|
5
|
+
const customRules = [{ name: "no-set-html-directive", rule: 'off"' }];
|
|
6
|
+
|
|
7
|
+
export const astroRules = genRules(ruleNames, customRules, "astro");
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { genRules } from "./gen-rules.js";
|
|
2
|
+
|
|
3
|
+
const ruleNames = [
|
|
4
|
+
"array-bracket-newline",
|
|
5
|
+
"array-bracket-spacing",
|
|
6
|
+
"array-element-newline",
|
|
7
|
+
"arrow-parens",
|
|
8
|
+
"arrow-spacing",
|
|
9
|
+
"block-spacing",
|
|
10
|
+
"brace-style",
|
|
11
|
+
"callback-return",
|
|
12
|
+
"comma-dangle",
|
|
13
|
+
"comma-spacing",
|
|
14
|
+
"comma-style",
|
|
15
|
+
"computed-property-spacing",
|
|
16
|
+
"dot-location",
|
|
17
|
+
"eol-last",
|
|
18
|
+
"func-call-spacing",
|
|
19
|
+
"function-call-argument-newline",
|
|
20
|
+
"function-paren-newline",
|
|
21
|
+
"generator-star-spacing",
|
|
22
|
+
"global-require",
|
|
23
|
+
"handle-callback-err",
|
|
24
|
+
"id-blacklist",
|
|
25
|
+
"implicit-arrow-linebreak",
|
|
26
|
+
"indent",
|
|
27
|
+
"indent-legacy",
|
|
28
|
+
"jsx-quotes",
|
|
29
|
+
"key-spacing",
|
|
30
|
+
"keyword-spacing",
|
|
31
|
+
"line-comment-position",
|
|
32
|
+
"linebreak-style",
|
|
33
|
+
"lines-around-comment",
|
|
34
|
+
"lines-around-directive",
|
|
35
|
+
"lines-between-class-members",
|
|
36
|
+
"max-len",
|
|
37
|
+
"max-statements-per-line",
|
|
38
|
+
"multiline-comment-style",
|
|
39
|
+
"multiline-ternary",
|
|
40
|
+
"new-parens",
|
|
41
|
+
"newline-after-var",
|
|
42
|
+
"newline-before-return",
|
|
43
|
+
"newline-per-chained-call",
|
|
44
|
+
"no-buffer-constructor",
|
|
45
|
+
"no-catch-shadow",
|
|
46
|
+
"no-confusing-arrow",
|
|
47
|
+
"no-extra-parens",
|
|
48
|
+
"no-extra-semi",
|
|
49
|
+
"no-floating-decimal",
|
|
50
|
+
"no-mixed-operators",
|
|
51
|
+
"no-mixed-requires",
|
|
52
|
+
"no-mixed-spaces-and-tabs",
|
|
53
|
+
"no-multi-spaces",
|
|
54
|
+
"no-multiple-empty-lines",
|
|
55
|
+
"no-native-reassign",
|
|
56
|
+
"no-negated-in-lhs",
|
|
57
|
+
"no-new-object",
|
|
58
|
+
"no-new-require",
|
|
59
|
+
"no-new-symbol",
|
|
60
|
+
"no-path-concat",
|
|
61
|
+
"no-process-env",
|
|
62
|
+
"no-process-exit",
|
|
63
|
+
"no-restricted-modules",
|
|
64
|
+
"no-return-await",
|
|
65
|
+
"no-spaced-func",
|
|
66
|
+
"no-sync",
|
|
67
|
+
"no-tabs",
|
|
68
|
+
"no-trailing-spaces",
|
|
69
|
+
"no-whitespace-before-property",
|
|
70
|
+
"nonblock-statement-body-position",
|
|
71
|
+
"object-curly-newline",
|
|
72
|
+
"object-curly-spacing",
|
|
73
|
+
"object-property-newline",
|
|
74
|
+
"one-var-declaration-per-line",
|
|
75
|
+
"operator-linebreak",
|
|
76
|
+
"padded-blocks",
|
|
77
|
+
"padding-line-between-statements",
|
|
78
|
+
"prefer-reflect",
|
|
79
|
+
"quote-props",
|
|
80
|
+
"quotes",
|
|
81
|
+
"rest-spread-spacing",
|
|
82
|
+
"semi",
|
|
83
|
+
"semi-spacing",
|
|
84
|
+
"semi-style",
|
|
85
|
+
"space-before-blocks",
|
|
86
|
+
"space-before-function-paren",
|
|
87
|
+
"space-in-parens",
|
|
88
|
+
"space-infix-ops",
|
|
89
|
+
"space-unary-ops",
|
|
90
|
+
"spaced-comment",
|
|
91
|
+
"switch-colon-spacing",
|
|
92
|
+
"template-curly-spacing",
|
|
93
|
+
"template-tag-spacing",
|
|
94
|
+
"wrap-iife",
|
|
95
|
+
"wrap-regex",
|
|
96
|
+
"yield-star-spacing",
|
|
97
|
+
];
|
|
98
|
+
const customRules = [];
|
|
99
|
+
|
|
100
|
+
export const deprecatedRules = genRules(
|
|
101
|
+
ruleNames,
|
|
102
|
+
customRules,
|
|
103
|
+
undefined,
|
|
104
|
+
"off",
|
|
105
|
+
);
|
package/setup/gen-rules.js
CHANGED
|
@@ -2,16 +2,17 @@
|
|
|
2
2
|
* @param {Array<String>} ruleNames
|
|
3
3
|
* @param {Array<{name: string, rule: unknown}>} customRules
|
|
4
4
|
* @param {string?} prefix
|
|
5
|
+
* @param {string?} defaultOverride
|
|
5
6
|
* @return {Object}
|
|
6
7
|
*/
|
|
7
|
-
export const genRules = (ruleNames, customRules, prefix) => {
|
|
8
|
+
export const genRules = (ruleNames, customRules, prefix, defaultOverride) => {
|
|
8
9
|
const rules = {};
|
|
9
10
|
|
|
10
11
|
for (const rule of ruleNames) {
|
|
11
12
|
if (prefix === undefined) {
|
|
12
|
-
rules[rule] = "error";
|
|
13
|
+
rules[rule] = defaultOverride ?? "error";
|
|
13
14
|
} else {
|
|
14
|
-
rules[`${prefix}/${rule}`] = "error";
|
|
15
|
+
rules[`${prefix}/${rule}`] = defaultOverride ?? "error";
|
|
15
16
|
}
|
|
16
17
|
}
|
|
17
18
|
|
package/setup/json.js
ADDED
package/setup/react.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import react from "@eslint-react/eslint-plugin";
|
|
2
|
+
import reactHooks from "eslint-plugin-react-hooks";
|
|
3
|
+
import { genRules } from "./gen-rules.js";
|
|
4
|
+
|
|
5
|
+
const reactRuleNames = Object.keys(react.rules);
|
|
6
|
+
const customReactRules = [
|
|
7
|
+
{ name: "avoid-shorthand-boolean", rule: "off" },
|
|
8
|
+
{ name: "avoid-shorthand-fragment", rule: "off" },
|
|
9
|
+
{ name: "debug/class-component", rule: "off" },
|
|
10
|
+
{ name: "debug/function-component", rule: "off" },
|
|
11
|
+
{ name: "debug/is-from-react", rule: "off" },
|
|
12
|
+
{ name: "debug/react-hooks", rule: "off" },
|
|
13
|
+
{
|
|
14
|
+
name: "naming-convention/filename",
|
|
15
|
+
rule: ["error", { rule: "kebab-case" }],
|
|
16
|
+
},
|
|
17
|
+
];
|
|
18
|
+
const reactGen = genRules(reactRuleNames, customReactRules, "react");
|
|
19
|
+
|
|
20
|
+
const reactHookRuleNames = Object.keys(reactHooks.rules);
|
|
21
|
+
const customHookRules = [
|
|
22
|
+
{ name: "exhaustive-deps", rule: "off" }, // TODO fix w/ v9 compatibility
|
|
23
|
+
{ name: "rules-of-hooks", rule: "off" }, // TODO fix w/ v9 compatibility
|
|
24
|
+
];
|
|
25
|
+
const hookGen = genRules(reactHookRuleNames, customHookRules, "react-hooks");
|
|
26
|
+
|
|
27
|
+
export const reactRules = {
|
|
28
|
+
...hookGen,
|
|
29
|
+
...reactGen,
|
|
30
|
+
};
|
package/setup/solid.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import solid from "eslint-plugin-solid";
|
|
2
|
+
import { genRules } from "./gen-rules.js";
|
|
3
|
+
|
|
4
|
+
const ruleNames = Object.keys(solid.rules);
|
|
5
|
+
const customRules = [
|
|
6
|
+
{ name: "no-proxy-apis", rule: "off" },
|
|
7
|
+
{ name: "prefer-classlist", rule: "off" },
|
|
8
|
+
];
|
|
9
|
+
|
|
10
|
+
export const solidRules = genRules(ruleNames, customRules, "solid");
|