@ethang/eslint-config 19.0.7 → 19.0.8
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/.github/dependabot.yml +13 -13
- package/README.md +82 -83
- package/build/update-readme.js +152 -0
- package/build/update-rules.js +70 -0
- package/build.mjs +5 -0
- package/config.react.js +1 -4
- package/eslint.config.js +683 -119
- package/package.json +12 -11
- package/setup/a11y.js +25 -0
- package/setup/barrel.js +9 -0
- package/setup/compat.js +10 -0
- package/setup/depend.js +11 -0
- package/setup/eslint.js +72 -0
- package/setup/gen-rules.js +34 -0
- package/setup/lodash.js +19 -0
- package/setup/n.js +31 -0
- package/setup/perfectionist.js +78 -0
- package/setup/sonar.js +61 -0
- package/setup/stylistic.js +62 -0
- package/setup/tailwind.js +8 -0
- package/setup/tanstack-query.js +7 -0
- package/setup/typescript-eslint.js +124 -0
- package/setup/unicorn.js +32 -0
- package/tsconfig.json +6 -3
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ethang/eslint-config",
|
|
3
|
-
"version": "19.0.
|
|
3
|
+
"version": "19.0.8",
|
|
4
4
|
"repository": {
|
|
5
5
|
"url": "git+https://github.com/eglove/eslint-config-ethang.git"
|
|
6
6
|
},
|
|
7
7
|
"main": "eslint.config.js",
|
|
8
8
|
"scripts": {
|
|
9
|
-
"lint": "
|
|
9
|
+
"lint": "prettier . -w",
|
|
10
10
|
"build": "pnpx @eslint/config-inspector build"
|
|
11
11
|
},
|
|
12
12
|
"engines": {
|
|
@@ -17,22 +17,22 @@
|
|
|
17
17
|
"license": "ISC",
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"@eslint-react/eslint-plugin": "^1.12.1",
|
|
20
|
-
"@eslint/js": "^9.9.
|
|
20
|
+
"@eslint/js": "^9.9.1",
|
|
21
21
|
"@stylistic/eslint-plugin": "^2.6.4",
|
|
22
22
|
"@tanstack/eslint-plugin-query": "^5.52.0",
|
|
23
23
|
"@typescript-eslint/parser": "^8.2.0",
|
|
24
|
-
"eslint": "^9.9.
|
|
24
|
+
"eslint": "^9.9.1",
|
|
25
25
|
"eslint-plugin-astro": "^1.2.3",
|
|
26
26
|
"eslint-plugin-barrel-files": "^2.1.0",
|
|
27
27
|
"eslint-plugin-compat": "^6.0.0",
|
|
28
|
-
"eslint-plugin-depend": "^0.
|
|
28
|
+
"eslint-plugin-depend": "^0.11.0",
|
|
29
29
|
"eslint-plugin-jsx-a11y": "^6.9.0",
|
|
30
30
|
"eslint-plugin-lodash": "^8.0.0",
|
|
31
31
|
"eslint-plugin-n": "^17.10.2",
|
|
32
32
|
"eslint-plugin-perfectionist": "^3.2.0",
|
|
33
33
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
34
34
|
"eslint-plugin-solid": "^0.14.2",
|
|
35
|
-
"eslint-plugin-sonarjs": "2.0.
|
|
35
|
+
"eslint-plugin-sonarjs": "2.0.1",
|
|
36
36
|
"eslint-plugin-tailwindcss": "^3.17.4",
|
|
37
37
|
"eslint-plugin-unicorn": "^55.0.0",
|
|
38
38
|
"typescript": "^5.5.4",
|
|
@@ -40,22 +40,22 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@eslint-react/eslint-plugin": "^1.12.1",
|
|
43
|
-
"@eslint/js": "^9.9.
|
|
43
|
+
"@eslint/js": "^9.9.1",
|
|
44
44
|
"@stylistic/eslint-plugin": "^2.6.4",
|
|
45
45
|
"@tanstack/eslint-plugin-query": "^5.52.0",
|
|
46
46
|
"@typescript-eslint/parser": "^8.2.0",
|
|
47
|
-
"eslint": "^9.9.
|
|
47
|
+
"eslint": "^9.9.1",
|
|
48
48
|
"eslint-plugin-astro": "^1.2.3",
|
|
49
49
|
"eslint-plugin-barrel-files": "^2.1.0",
|
|
50
50
|
"eslint-plugin-compat": "^6.0.0",
|
|
51
|
-
"eslint-plugin-depend": "^0.
|
|
51
|
+
"eslint-plugin-depend": "^0.11.0",
|
|
52
52
|
"eslint-plugin-jsx-a11y": "^6.9.0",
|
|
53
53
|
"eslint-plugin-lodash": "^8.0.0",
|
|
54
54
|
"eslint-plugin-n": "^17.10.2",
|
|
55
55
|
"eslint-plugin-perfectionist": "^3.2.0",
|
|
56
56
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
57
57
|
"eslint-plugin-solid": "^0.14.2",
|
|
58
|
-
"eslint-plugin-sonarjs": "2.0.
|
|
58
|
+
"eslint-plugin-sonarjs": "2.0.1",
|
|
59
59
|
"eslint-plugin-tailwindcss": "^3.17.4",
|
|
60
60
|
"eslint-plugin-unicorn": "^55.0.0",
|
|
61
61
|
"typescript": "^5.5.4",
|
|
@@ -64,6 +64,7 @@
|
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@ethang/project-builder": "^2.3.10",
|
|
66
66
|
"@tsconfig/node-lts": "^20.1.3",
|
|
67
|
-
"@tsconfig/strictest": "^2.0.5"
|
|
67
|
+
"@tsconfig/strictest": "^2.0.5",
|
|
68
|
+
"prettier": "^3.3.3"
|
|
68
69
|
}
|
|
69
70
|
}
|
package/setup/a11y.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import a11y from "eslint-plugin-jsx-a11y";
|
|
2
|
+
|
|
3
|
+
import { genRules } from "./gen-rules.js";
|
|
4
|
+
|
|
5
|
+
const ruleNames = Object.keys(a11y.rules);
|
|
6
|
+
const customRules = [
|
|
7
|
+
{
|
|
8
|
+
name: "accessible-emoji",
|
|
9
|
+
rule: "off",
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
name: "label-has-for",
|
|
13
|
+
rule: "off",
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: "media-has-caption",
|
|
17
|
+
rule: "off",
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: "no-onchange",
|
|
21
|
+
rule: "off",
|
|
22
|
+
},
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
export const a11yRules = genRules(ruleNames, customRules, "a11y");
|
package/setup/barrel.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/* eslint-disable unicorn/no-abusive-eslint-disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
import barrel from "eslint-plugin-barrel-files";
|
|
4
|
+
import { genRules } from "./gen-rules.js";
|
|
5
|
+
|
|
6
|
+
const ruleNames = Object.keys(barrel.rules);
|
|
7
|
+
const customRules = [];
|
|
8
|
+
|
|
9
|
+
export const barrelRules = genRules(ruleNames, customRules, "barrel");
|
package/setup/compat.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/* eslint-disable unicorn/no-abusive-eslint-disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
import compat from "eslint-plugin-compat";
|
|
4
|
+
|
|
5
|
+
import { genRules } from "./gen-rules.js";
|
|
6
|
+
|
|
7
|
+
const ruleNames = Object.keys(compat.rules);
|
|
8
|
+
const changedRules = [];
|
|
9
|
+
|
|
10
|
+
export const compatRules = genRules(ruleNames, changedRules, "compat");
|
package/setup/depend.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/* eslint-disable unicorn/no-abusive-eslint-disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
import depend from "eslint-plugin-depend";
|
|
4
|
+
import { genRules } from "./gen-rules.js";
|
|
5
|
+
|
|
6
|
+
const ruleNames = Object.keys(depend.rules);
|
|
7
|
+
const changedRules = [
|
|
8
|
+
{ name: "ban-dependencies", rule: ["error", { allowed: ["lodash"] }] },
|
|
9
|
+
];
|
|
10
|
+
|
|
11
|
+
export const dependRules = genRules(ruleNames, changedRules, "depend");
|
package/setup/eslint.js
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import eslint from "@eslint/js";
|
|
3
|
+
import { genRules } from "./gen-rules.js";
|
|
4
|
+
|
|
5
|
+
const ruleNames = Object.keys(eslint.configs.all.rules);
|
|
6
|
+
const changedRules = [
|
|
7
|
+
{ name: "arrow-body-style", rule: ["error", "always"] },
|
|
8
|
+
{ name: "camelcase", rule: "off" },
|
|
9
|
+
{ name: "capitalized-comments", rule: "off" },
|
|
10
|
+
{ name: "class-methods-use-this", rule: "off" },
|
|
11
|
+
{ name: "complexity", rule: "off" },
|
|
12
|
+
{ name: "consistent-return", rule: "off" },
|
|
13
|
+
{ name: "consistent-this", rule: "off" },
|
|
14
|
+
{ name: "curly", rule: "off" },
|
|
15
|
+
{ name: "default-case", rule: "off" },
|
|
16
|
+
{ name: "default-case-last", rule: "off" },
|
|
17
|
+
{ name: "default-param-last", rule: "off" },
|
|
18
|
+
{ name: "dot-notation", rule: "off" },
|
|
19
|
+
{ name: "func-names", rule: "off" },
|
|
20
|
+
{
|
|
21
|
+
name: "func-style",
|
|
22
|
+
rule: ["error", "declaration", { allowArrowFunctions: true }],
|
|
23
|
+
},
|
|
24
|
+
{ name: "id-denylist", rule: "off" },
|
|
25
|
+
{ name: "id-length", rule: "off" },
|
|
26
|
+
{ name: "id-match", rule: "off" },
|
|
27
|
+
{ name: "init-declarations", rule: "off" },
|
|
28
|
+
{ name: "max-lines", rule: "off" },
|
|
29
|
+
{ name: "max-lines-per-function", rule: "off" },
|
|
30
|
+
{ name: "max-params", rule: "off" },
|
|
31
|
+
{ name: "new-cap", rule: "off" },
|
|
32
|
+
{ name: "no-array-constructor", rule: "off" },
|
|
33
|
+
{ name: "no-duplicate-imports", rule: "off" },
|
|
34
|
+
{ name: "no-empty-function", rule: "off" },
|
|
35
|
+
{ name: "no-implicit-globals", rule: "off" },
|
|
36
|
+
{ name: "no-implied-eval", rule: "off" },
|
|
37
|
+
{ name: "no-inline-comments", rule: "off" },
|
|
38
|
+
{ name: "no-magic-numbers", rule: "off" },
|
|
39
|
+
{ name: "no-redeclare", rule: "off" },
|
|
40
|
+
{ name: "no-restricted-exports", rule: "off" },
|
|
41
|
+
{ name: "no-restricted-globals", rule: "off" },
|
|
42
|
+
{ name: "no-restricted-imports", rule: "off" },
|
|
43
|
+
{ name: "no-restricted-properties", rule: "off" },
|
|
44
|
+
{ name: "no-restricted-syntax", rule: "off" },
|
|
45
|
+
{ name: "no-shadow", rule: "off" },
|
|
46
|
+
{ name: "no-template-curly-in-string", rule: "off" },
|
|
47
|
+
{ name: "no-ternary", rule: "off" },
|
|
48
|
+
{ name: "no-throw-literal", rule: "off" },
|
|
49
|
+
{ name: "no-undef", rule: "off" },
|
|
50
|
+
{ name: "no-undefined", rule: "off" },
|
|
51
|
+
{ name: "no-underscore-dangle", rule: "off" },
|
|
52
|
+
{ name: "no-unexpected-multiline", rule: "off" },
|
|
53
|
+
{
|
|
54
|
+
name: "no-unsafe-optional-chaining",
|
|
55
|
+
rule: ["error", { disallowArithmeticOperators: true }],
|
|
56
|
+
},
|
|
57
|
+
{ name: "no-unused-expressions", rule: "off" },
|
|
58
|
+
{ name: "no-unused-vars", rule: "off" },
|
|
59
|
+
{ name: "no-use-before-define", rule: "off" },
|
|
60
|
+
{ name: "no-useless-assignment", rule: "off" },
|
|
61
|
+
{ name: "no-useless-constructor", rule: "off" },
|
|
62
|
+
{ name: "no-warning-comments", rule: "off" },
|
|
63
|
+
{ name: "one-var", rule: "off" },
|
|
64
|
+
{ name: "prefer-destructuring", rule: "off" },
|
|
65
|
+
{ name: "prefer-promise-reject-errors", rule: "off" },
|
|
66
|
+
{ name: "require-await", rule: "off" },
|
|
67
|
+
{ name: "sort-imports", rule: "off" },
|
|
68
|
+
{ name: "sort-keys", rule: "off" },
|
|
69
|
+
{ name: "yoda", rule: ["error", "always"] },
|
|
70
|
+
];
|
|
71
|
+
|
|
72
|
+
export const eslintRules = genRules(ruleNames, changedRules);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {Array<String>} ruleNames
|
|
3
|
+
* @param {Array<{name: string, rule: unknown}>} customRules
|
|
4
|
+
* @param {string?} prefix
|
|
5
|
+
* @return {Object}
|
|
6
|
+
*/
|
|
7
|
+
export const genRules = (ruleNames, customRules, prefix) => {
|
|
8
|
+
const rules = {};
|
|
9
|
+
|
|
10
|
+
for (const rule of ruleNames) {
|
|
11
|
+
if (prefix === undefined) {
|
|
12
|
+
rules[rule] = "error";
|
|
13
|
+
} else {
|
|
14
|
+
rules[`${prefix}/${rule}`] = "error";
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (customRules) {
|
|
19
|
+
for (const rule of customRules) {
|
|
20
|
+
if (ruleNames.includes(rule.name)) {
|
|
21
|
+
if (prefix === undefined) {
|
|
22
|
+
rules[rule.name] = rule.rule;
|
|
23
|
+
} else {
|
|
24
|
+
rules[`${prefix}/${rule.name}`] = rule.rule;
|
|
25
|
+
}
|
|
26
|
+
} else {
|
|
27
|
+
// eslint-disable-next-line no-console
|
|
28
|
+
console.error(`${rule.name} does not exist.`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return rules;
|
|
34
|
+
};
|
package/setup/lodash.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import lodash from "eslint-plugin-lodash";
|
|
3
|
+
import { genRules } from "./gen-rules.js";
|
|
4
|
+
|
|
5
|
+
const ruleNames = Object.keys(lodash.rules);
|
|
6
|
+
const customRules = [
|
|
7
|
+
{ name: "chain-style", rule: ["error", "as-needed"] },
|
|
8
|
+
{ name: "consistent-compose", rule: ["error", "flow"] },
|
|
9
|
+
{ name: "identity-shorthand", rule: ["error", "always"] },
|
|
10
|
+
{ name: "import-scope", rule: ["error", "method"] },
|
|
11
|
+
{ name: "matches-prop-shorthand", rule: ["error", "always"] },
|
|
12
|
+
{ name: "matches-shorthand", rule: ["error", "always", 3] },
|
|
13
|
+
{ name: "path-style", rule: ["error", "array"] },
|
|
14
|
+
{ name: "prefer-includes", rule: ["error", { includeNative: true }] },
|
|
15
|
+
{ name: "prefer-some", rule: ["error", { includeNative: true }] },
|
|
16
|
+
{ name: "prop-shorthand", rule: ["error", "always"] },
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
export const lodashRules = genRules(ruleNames, customRules, "lodash");
|
package/setup/n.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/* eslint-disable unicorn/no-abusive-eslint-disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
import n from "eslint-plugin-n";
|
|
4
|
+
import { genRules } from "./gen-rules.js";
|
|
5
|
+
|
|
6
|
+
const ruleNames = Object.keys(n.rules);
|
|
7
|
+
const changedRules = [
|
|
8
|
+
{ name: "callback-return", rule: "off" },
|
|
9
|
+
{ name: "exports-style", rule: ["error", "exports"] },
|
|
10
|
+
{ name: "file-extension-in-import", rule: "off" },
|
|
11
|
+
{ name: "global-require", rule: "off" },
|
|
12
|
+
{ name: "no-callback-literal", rule: "off" },
|
|
13
|
+
{ name: "no-missing-import", rule: "off" },
|
|
14
|
+
{ name: "no-mixed-requires", rule: "off" },
|
|
15
|
+
{ name: "no-new-require", rule: "off" },
|
|
16
|
+
{ name: "no-process-env", rule: "off" },
|
|
17
|
+
{ name: "no-process-exit", rule: "off" },
|
|
18
|
+
{ name: "no-restricted-import", rule: "off" },
|
|
19
|
+
{ name: "no-restricted-require", rule: "off" },
|
|
20
|
+
{ name: "no-sync", rule: "off" },
|
|
21
|
+
{ name: "no-unpublished-import", rule: "off" },
|
|
22
|
+
{ name: "no-unpublished-require", rule: "off" },
|
|
23
|
+
{ name: "prefer-promises/dns", rule: "off" },
|
|
24
|
+
{ name: "prefer-promises/fs", rule: "off" },
|
|
25
|
+
{ name: "process-exit-as-throw", rule: "off" },
|
|
26
|
+
{ name: "hashbang", rule: "off" },
|
|
27
|
+
{ name: "no-hide-core-modules", rule: "off" },
|
|
28
|
+
{ name: "shebang", rule: "off" },
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
export const nRules = genRules(ruleNames, changedRules, "n");
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import perfectionist from "eslint-plugin-perfectionist";
|
|
2
|
+
|
|
3
|
+
import { genRules } from "./gen-rules.js";
|
|
4
|
+
|
|
5
|
+
const ruleNames = Object.keys(perfectionist.rules);
|
|
6
|
+
const customRules = [
|
|
7
|
+
{
|
|
8
|
+
name: "sort-astro-attributes",
|
|
9
|
+
rule: [
|
|
10
|
+
"error",
|
|
11
|
+
{
|
|
12
|
+
groups: ["astro-shorthand", "shorthand", "multiline"],
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: "sort-imports",
|
|
18
|
+
rule: [
|
|
19
|
+
"error",
|
|
20
|
+
{
|
|
21
|
+
groups: [
|
|
22
|
+
"type",
|
|
23
|
+
["builtin", "external"],
|
|
24
|
+
"internal-type",
|
|
25
|
+
"internal",
|
|
26
|
+
["parent-type", "sibling-type", "index-type"],
|
|
27
|
+
["parent", "sibling", "index"],
|
|
28
|
+
"object",
|
|
29
|
+
"unknown",
|
|
30
|
+
],
|
|
31
|
+
newlinesBetween: "always",
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: "sort-jsx-props",
|
|
37
|
+
rule: ["error", { groups: ["shorthand", "multiline"] }],
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: "sort-svelte-attributes",
|
|
41
|
+
rule: [
|
|
42
|
+
"error",
|
|
43
|
+
{
|
|
44
|
+
groups: ["svelte-shorthand", "shorthand", "multiline"],
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: "sort-switch-case",
|
|
50
|
+
rule: [
|
|
51
|
+
"error",
|
|
52
|
+
{
|
|
53
|
+
order: "asc",
|
|
54
|
+
type: "alphabetical",
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: "sort-variable-declarations",
|
|
60
|
+
rule: [
|
|
61
|
+
"error",
|
|
62
|
+
{
|
|
63
|
+
order: "asc",
|
|
64
|
+
type: "alphabetical",
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: "sort-vue-attributes",
|
|
70
|
+
rule: ["error", { groups: ["shorthand", "multiline"] }],
|
|
71
|
+
},
|
|
72
|
+
];
|
|
73
|
+
|
|
74
|
+
export const perfectionistRules = genRules(
|
|
75
|
+
ruleNames,
|
|
76
|
+
customRules,
|
|
77
|
+
"perfectionist",
|
|
78
|
+
);
|
package/setup/sonar.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import sonar from "eslint-plugin-sonarjs";
|
|
3
|
+
import { genRules } from "./gen-rules.js";
|
|
4
|
+
|
|
5
|
+
const ruleNames = Object.keys(sonar.rules);
|
|
6
|
+
const customRules = [
|
|
7
|
+
{ name: "aws-s3-bucket-server-encryption", rule: "off" },
|
|
8
|
+
{ name: "arrow-function-convention", rule: "off" },
|
|
9
|
+
{ name: "brace-style", rule: "off" },
|
|
10
|
+
{ name: "conditional-indentation", rule: "off" },
|
|
11
|
+
{ name: "comment-regex", rule: "off" },
|
|
12
|
+
{ name: "cookies", rule: "off" },
|
|
13
|
+
{ name: "cyclomatic-complexity", rule: "off" },
|
|
14
|
+
{ name: "dns-prefetching", rule: "off" },
|
|
15
|
+
{ name: "encryption", rule: "off" },
|
|
16
|
+
{ name: "enforce-trailing-comma", rule: "off" },
|
|
17
|
+
{ name: "file-header", rule: "off" },
|
|
18
|
+
{
|
|
19
|
+
name: "function-name",
|
|
20
|
+
rule: [
|
|
21
|
+
"error",
|
|
22
|
+
{
|
|
23
|
+
format: "^(?:[a-z][a-zA-Z0-9]*|[A-Z][A-Z0-9]*)$",
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
{ name: "function-return-type", rule: "off" },
|
|
28
|
+
{ name: "max-union-size", rule: "off" },
|
|
29
|
+
{ name: "new-cap", rule: "off" },
|
|
30
|
+
{ name: "no-extra-semi", rule: "off" },
|
|
31
|
+
{ name: "no-implicit-dependencies", rule: "off" },
|
|
32
|
+
{ name: "no-inconsistent-returns", rule: "off" },
|
|
33
|
+
{ name: "no-redundant-parentheses", rule: "off" }, // Not working correctly, TS can handle this
|
|
34
|
+
{ name: "no-reference-error", rule: "off" }, // Not working correctly, TS can handle this
|
|
35
|
+
{ name: "no-tab", rule: "off" }, // Not working correctly, TS can handle this
|
|
36
|
+
{ name: "no-undefined-assignment", rule: "off" },
|
|
37
|
+
{ name: "process-argv", rule: "off" },
|
|
38
|
+
{ name: "regular-expr", rule: "off" },
|
|
39
|
+
{ name: "semi", rule: "off" },
|
|
40
|
+
{ name: "shorthand-property-grouping", rule: "off" }, // Conflicts with perfectionist sorting
|
|
41
|
+
{ name: "sockets", rule: "off" },
|
|
42
|
+
{ name: "sonar-no-fallthrough", rule: "off" }, // TODO v9 compatibility?
|
|
43
|
+
{ name: "sonar-no-magic-numbers", rule: "off" },
|
|
44
|
+
{ name: "standard-input", rule: "off" },
|
|
45
|
+
{ name: "switch-without-default", rule: "off" }, // @typescript-eslint/switch-exhaustiveness-check works better
|
|
46
|
+
{ name: "todo-tag", rule: "off" },
|
|
47
|
+
{ name: "useless-string-operation", rule: "off" },
|
|
48
|
+
{ name: "web-sql-database", rule: "off" },
|
|
49
|
+
{ name: "xpath", rule: "off" },
|
|
50
|
+
];
|
|
51
|
+
|
|
52
|
+
const rules = genRules(ruleNames, customRules, "sonar");
|
|
53
|
+
|
|
54
|
+
// Turn off duplicate S# rules
|
|
55
|
+
for (const key of Object.keys(rules)) {
|
|
56
|
+
if (/^sonar\/S\d+/.test(key)) {
|
|
57
|
+
rules[key] = "off";
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export const sonarRules = rules;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import stylistic from "@stylistic/eslint-plugin";
|
|
3
|
+
import { genRules } from "./gen-rules.js";
|
|
4
|
+
|
|
5
|
+
const ruleNames = Object.keys(stylistic.rules);
|
|
6
|
+
const customRules = [
|
|
7
|
+
{ name: "array-bracket-newline", rule: ["error", "consistent"] },
|
|
8
|
+
{ name: "array-element-newline", rule: ["error", "consistent"] },
|
|
9
|
+
{ name: "comma-dangle", rule: ["error", "always-multiline"] },
|
|
10
|
+
{ name: "dot-location", rule: ["error", "property"] },
|
|
11
|
+
{ name: "function-call-argument-newline", rule: ["error", "consistent"] },
|
|
12
|
+
{ name: "function-paren-newline", rule: ["error", "consistent"] },
|
|
13
|
+
{ name: "indent", rule: ["error", 2] },
|
|
14
|
+
{ name: "line-comment-position", rule: "off" },
|
|
15
|
+
{
|
|
16
|
+
name: "max-len",
|
|
17
|
+
rule: [
|
|
18
|
+
"error",
|
|
19
|
+
{
|
|
20
|
+
ignoreComments: true,
|
|
21
|
+
ignoreTrailingComments: true,
|
|
22
|
+
ignoreUrls: true,
|
|
23
|
+
ignoreStrings: true,
|
|
24
|
+
ignoreTemplateLiterals: true,
|
|
25
|
+
ignoreRegExpLiterals: true,
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
{ name: "multiline-comment-style", rule: "off" },
|
|
30
|
+
{
|
|
31
|
+
name: "no-extra-parens",
|
|
32
|
+
rule: ["error", "all", { ignoreJSX: "multi-line" }],
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: "object-curly-newline",
|
|
36
|
+
rule: ["error", { multiline: true, consistent: true }],
|
|
37
|
+
},
|
|
38
|
+
{ name: "object-curly-spacing", rule: ["error", "always"] },
|
|
39
|
+
{ name: "padded-blocks", rule: ["error", "never"] },
|
|
40
|
+
{ name: "quote-props", rule: ["error", "as-needed"] },
|
|
41
|
+
{
|
|
42
|
+
name: "space-before-function-paren",
|
|
43
|
+
rule: [
|
|
44
|
+
"error",
|
|
45
|
+
{
|
|
46
|
+
anonymous: "always",
|
|
47
|
+
named: "never",
|
|
48
|
+
asyncArrow: "always",
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
{ name: "jsx-indent", rule: "off" },
|
|
53
|
+
{ name: "jsx-indent-props", rule: ["error", 2] },
|
|
54
|
+
{ name: "jsx-newline", rule: ["error", { prevent: true }] },
|
|
55
|
+
{ name: "jsx-sort-props", rule: "off" },
|
|
56
|
+
{
|
|
57
|
+
name: "jsx-wrap-multilines",
|
|
58
|
+
rule: ["error", { declaration: "parens-new-line" }],
|
|
59
|
+
},
|
|
60
|
+
];
|
|
61
|
+
|
|
62
|
+
export const stylisticRules = genRules(ruleNames, customRules, "stylistic");
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import tailwind from "eslint-plugin-tailwindcss";
|
|
3
|
+
import { genRules } from "./gen-rules.js";
|
|
4
|
+
|
|
5
|
+
const ruleNames = Object.keys(tailwind.rules);
|
|
6
|
+
const customRules = [{ name: "no-custom-classname", rule: "off" }];
|
|
7
|
+
|
|
8
|
+
export const tailwindRules = genRules(ruleNames, customRules, "tailwind");
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import tseslint from "typescript-eslint";
|
|
2
|
+
|
|
3
|
+
import { genRules } from "./gen-rules.js";
|
|
4
|
+
|
|
5
|
+
const ruleNames = Object.keys(tseslint.plugin.rules);
|
|
6
|
+
const customRules = [
|
|
7
|
+
{
|
|
8
|
+
name: "adjacent-overload-signatures",
|
|
9
|
+
rule: "off",
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
name: "class-methods-use-this",
|
|
13
|
+
rule: "off",
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: "consistent-return",
|
|
17
|
+
rule: "off",
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: "consistent-type-definitions",
|
|
21
|
+
rule: ["error", "type"],
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: "explicit-function-return-type",
|
|
25
|
+
rule: "off",
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: "explicit-module-boundary-types",
|
|
29
|
+
rule: "off",
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: "init-declarations",
|
|
33
|
+
rule: "off",
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: "member-ordering",
|
|
37
|
+
rule: "off",
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: "naming-convention",
|
|
41
|
+
rule: "off",
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: "no-dupe-class-members",
|
|
45
|
+
rule: "off",
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: "no-empty-interface",
|
|
49
|
+
rule: "off",
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: "no-invalid-this",
|
|
53
|
+
rule: "off",
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: "no-loss-of-precision",
|
|
57
|
+
rule: "off",
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: "no-magic-numbers",
|
|
61
|
+
rule: "off",
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: "no-redeclare",
|
|
65
|
+
rule: "off",
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: "no-type-alias",
|
|
69
|
+
rule: "off",
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: "no-use-before-define",
|
|
73
|
+
rule: "off",
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
name: "no-var-requires",
|
|
77
|
+
rule: "off",
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: "parameter-properties",
|
|
81
|
+
rule: "off",
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
name: "prefer-readonly-parameter-types",
|
|
85
|
+
rule: "off",
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
name: "prefer-ts-expect-error",
|
|
89
|
+
rule: "off",
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
name: "sort-type-constituents",
|
|
93
|
+
rule: "off",
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: "typedef",
|
|
97
|
+
rule: "off",
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
name: "max-params",
|
|
101
|
+
rule: "off",
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
name: "no-unused-vars",
|
|
105
|
+
rule: [
|
|
106
|
+
"error",
|
|
107
|
+
{
|
|
108
|
+
args: "all",
|
|
109
|
+
argsIgnorePattern: "^_",
|
|
110
|
+
caughtErrors: "all",
|
|
111
|
+
caughtErrorsIgnorePattern: "^_",
|
|
112
|
+
destructuredArrayIgnorePattern: "^_",
|
|
113
|
+
ignoreRestSiblings: true,
|
|
114
|
+
varsIgnorePattern: "^_",
|
|
115
|
+
},
|
|
116
|
+
],
|
|
117
|
+
},
|
|
118
|
+
];
|
|
119
|
+
|
|
120
|
+
export const typescriptRules = genRules(
|
|
121
|
+
ruleNames,
|
|
122
|
+
customRules,
|
|
123
|
+
"@typescript-eslint",
|
|
124
|
+
);
|
package/setup/unicorn.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import unicorn from "eslint-plugin-unicorn";
|
|
2
|
+
import { genRules } from "./gen-rules.js";
|
|
3
|
+
|
|
4
|
+
const ruleNames = Object.keys(unicorn.rules);
|
|
5
|
+
const customRules = [
|
|
6
|
+
{ name: "empty-brace-spaces", rule: "off" },
|
|
7
|
+
{ name: "explicit-length-check", rule: "off" },
|
|
8
|
+
{ name: "no-keyword-prefix", rule: "off" },
|
|
9
|
+
{ name: "no-nested-ternary", rule: "off" },
|
|
10
|
+
{ name: "no-null", rule: "off" },
|
|
11
|
+
{ name: "number-literal-case", rule: "off" },
|
|
12
|
+
{ name: "template-indent", rule: "off" },
|
|
13
|
+
{ name: "import-index", rule: "off" },
|
|
14
|
+
{ name: "no-array-instanceof", rule: "off" },
|
|
15
|
+
{ name: "no-fn-reference-in-iterator", rule: "off" },
|
|
16
|
+
{ name: "no-reduce", rule: "off" },
|
|
17
|
+
{ name: "no-unsafe-regex", rule: "off" },
|
|
18
|
+
{ name: "prefer-dataset", rule: "off" },
|
|
19
|
+
{ name: "prefer-event-key", rule: "off" },
|
|
20
|
+
{ name: "prefer-exponentiation-operator", rule: "off" },
|
|
21
|
+
{ name: "prefer-flat-map", rule: "off" },
|
|
22
|
+
{ name: "prefer-node-append", rule: "off" },
|
|
23
|
+
{ name: "prefer-node-remove", rule: "off" },
|
|
24
|
+
{ name: "prefer-object-has-own", rule: "off" },
|
|
25
|
+
{ name: "prefer-replace-all", rule: "off" },
|
|
26
|
+
{ name: "prefer-starts-ends-with", rule: "off" },
|
|
27
|
+
{ name: "prefer-text-content", rule: "off" },
|
|
28
|
+
{ name: "prefer-trim-start-end", rule: "off" },
|
|
29
|
+
{ name: "regex-shorthand", rule: "off" },
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
export const unicornRules = genRules(ruleNames, customRules, "unicorn");
|