@ethang/eslint-config 24.0.2 → 24.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/{dist/README.md → README.md} +3 -3
- package/eslint.config.js +2 -28
- package/eslint.config.js.map +1 -0
- package/package.json +10 -10
- package/build.ts +0 -48
- package/dist/eslint.config.js +0 -2
- package/dist/eslint.config.js.map +0 -1
- package/dist/package.json +0 -67
- package/src/README.md +0 -132
- package/src/build/create-config-file.ts +0 -70
- package/src/build/create-config.ts +0 -98
- package/src/build/get-react-version.ts +0 -19
- package/src/build/list-utilities.ts +0 -137
- package/src/build/rule-list.ts +0 -283
- package/src/build/update-readme.ts +0 -259
- package/src/build/update-rules.ts +0 -173
- package/src/config.angular.js +0 -122
- package/src/config.astro.js +0 -69
- package/src/config.html.js +0 -73
- package/src/config.react.js +0 -111
- package/src/config.solid.js +0 -34
- package/src/config.storybook.js +0 -31
- package/src/config.tailwind.js +0 -28
- package/src/constants.js +0 -16
- package/src/eslint.config.js +0 -1075
- package/src/eslint.html.js +0 -73
- package/src/setup/a11y.ts +0 -19
- package/src/setup/angular.ts +0 -36
- package/src/setup/astro.ts +0 -14
- package/src/setup/compat.ts +0 -13
- package/src/setup/cspell.ts +0 -100
- package/src/setup/css.ts +0 -15
- package/src/setup/eslint.ts +0 -250
- package/src/setup/gen-rules.ts +0 -85
- package/src/setup/html.ts +0 -17
- package/src/setup/json.ts +0 -17
- package/src/setup/lodash.ts +0 -59
- package/src/setup/markdown.ts +0 -16
- package/src/setup/perfectionist.ts +0 -49
- package/src/setup/react.ts +0 -37
- package/src/setup/solid.ts +0 -21
- package/src/setup/sonar.ts +0 -40
- package/src/setup/storybook.ts +0 -10
- package/src/setup/tailwind.ts +0 -12
- package/src/setup/tanstack-query.ts +0 -8
- package/src/setup/tanstack-router.ts +0 -8
- package/src/setup/typescript-eslint.ts +0 -114
- package/src/setup/unicorn.ts +0 -38
- package/src/tsconfig.json +0 -3
- package/tsconfig.json +0 -3
- /package/{dist/chunk-WK3YS7OG.js → chunk-WK3YS7OG.js} +0 -0
- /package/{dist/chunk-WK3YS7OG.js.map → chunk-WK3YS7OG.js.map} +0 -0
- /package/{dist/config.angular.d.ts → config.angular.d.ts} +0 -0
- /package/{dist/config.angular.js → config.angular.js} +0 -0
- /package/{dist/config.angular.js.map → config.angular.js.map} +0 -0
- /package/{dist/config.astro.d.ts → config.astro.d.ts} +0 -0
- /package/{dist/config.astro.js → config.astro.js} +0 -0
- /package/{dist/config.astro.js.map → config.astro.js.map} +0 -0
- /package/{dist/config.html.d.ts → config.html.d.ts} +0 -0
- /package/{dist/config.html.js → config.html.js} +0 -0
- /package/{dist/config.html.js.map → config.html.js.map} +0 -0
- /package/{dist/config.react.d.ts → config.react.d.ts} +0 -0
- /package/{dist/config.react.js → config.react.js} +0 -0
- /package/{dist/config.react.js.map → config.react.js.map} +0 -0
- /package/{dist/config.solid.d.ts → config.solid.d.ts} +0 -0
- /package/{dist/config.solid.js → config.solid.js} +0 -0
- /package/{dist/config.solid.js.map → config.solid.js.map} +0 -0
- /package/{dist/config.storybook.d.ts → config.storybook.d.ts} +0 -0
- /package/{dist/config.storybook.js → config.storybook.js} +0 -0
- /package/{dist/config.storybook.js.map → config.storybook.js.map} +0 -0
- /package/{dist/config.tailwind.d.ts → config.tailwind.d.ts} +0 -0
- /package/{dist/config.tailwind.js → config.tailwind.js} +0 -0
- /package/{dist/config.tailwind.js.map → config.tailwind.js.map} +0 -0
- /package/{dist/constants.js → constants.js} +0 -0
- /package/{dist/constants.js.map → constants.js.map} +0 -0
- /package/{dist/eslint.config.d.ts → eslint.config.d.ts} +0 -0
package/src/eslint.html.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import html from "@html-eslint/eslint-plugin";
|
|
2
|
-
// @ts-nocheck
|
|
3
|
-
import { defineConfig } from "eslint/config";
|
|
4
|
-
|
|
5
|
-
import { ignores, languageOptions } from "./constants.js";
|
|
6
|
-
|
|
7
|
-
export default defineConfig({
|
|
8
|
-
files: ["**/*.html"],
|
|
9
|
-
ignores,
|
|
10
|
-
language: "html/html",
|
|
11
|
-
languageOptions,
|
|
12
|
-
plugins: {
|
|
13
|
-
html,
|
|
14
|
-
},
|
|
15
|
-
rules: {
|
|
16
|
-
"html/attrs-newline": "off",
|
|
17
|
-
"html/element-newline": "off",
|
|
18
|
-
"html/id-naming-convention": "error",
|
|
19
|
-
"html/indent": "off",
|
|
20
|
-
"html/lowercase": "error",
|
|
21
|
-
"html/max-element-depth": "error",
|
|
22
|
-
"html/no-abstract-roles": "error",
|
|
23
|
-
"html/no-accesskey-attrs": "error",
|
|
24
|
-
"html/no-aria-hidden-body": "error",
|
|
25
|
-
"html/no-aria-hidden-on-focusable": "error",
|
|
26
|
-
"html/no-duplicate-attrs": "error",
|
|
27
|
-
"html/no-duplicate-class": "error",
|
|
28
|
-
"html/no-duplicate-id": "error",
|
|
29
|
-
"html/no-duplicate-in-head": "error",
|
|
30
|
-
"html/no-empty-headings": "error",
|
|
31
|
-
"html/no-extra-spacing-attrs": "off",
|
|
32
|
-
"html/no-extra-spacing-text": "error",
|
|
33
|
-
"html/no-heading-inside-button": "error",
|
|
34
|
-
"html/no-ineffective-attrs": "error",
|
|
35
|
-
"html/no-inline-styles": "error",
|
|
36
|
-
"html/no-invalid-entity": "error",
|
|
37
|
-
"html/no-invalid-role": "error",
|
|
38
|
-
"html/no-multiple-empty-lines": "error",
|
|
39
|
-
"html/no-multiple-h1": "error",
|
|
40
|
-
"html/no-nested-interactive": "error",
|
|
41
|
-
"html/no-non-scalable-viewport": "error",
|
|
42
|
-
"html/no-obsolete-tags": "error",
|
|
43
|
-
"html/no-positive-tabindex": "error",
|
|
44
|
-
"html/no-restricted-attr-values": "error",
|
|
45
|
-
"html/no-restricted-attrs": "error",
|
|
46
|
-
"html/no-restricted-tags": "error",
|
|
47
|
-
"html/no-script-style-type": "error",
|
|
48
|
-
"html/no-skip-heading-levels": "error",
|
|
49
|
-
"html/no-target-blank": "error",
|
|
50
|
-
"html/no-trailing-spaces": "error",
|
|
51
|
-
"html/no-whitespace-only-children": "error",
|
|
52
|
-
"html/prefer-https": "error",
|
|
53
|
-
"html/quotes": "error",
|
|
54
|
-
"html/require-attrs": "error",
|
|
55
|
-
"html/require-button-type": "error",
|
|
56
|
-
"html/require-closing-tags": "off",
|
|
57
|
-
"html/require-doctype": "error",
|
|
58
|
-
"html/require-explicit-size": "error",
|
|
59
|
-
"html/require-form-method": "error",
|
|
60
|
-
"html/require-frame-title": "error",
|
|
61
|
-
"html/require-img-alt": "error",
|
|
62
|
-
"html/require-input-label": "error",
|
|
63
|
-
"html/require-lang": "error",
|
|
64
|
-
"html/require-li-container": "error",
|
|
65
|
-
"html/require-meta-charset": "error",
|
|
66
|
-
"html/require-meta-description": "error",
|
|
67
|
-
"html/require-meta-viewport": "error",
|
|
68
|
-
"html/require-open-graph-protocol": "error",
|
|
69
|
-
"html/require-title": "error",
|
|
70
|
-
"html/sort-attrs": "error",
|
|
71
|
-
"html/use-baseline": "error",
|
|
72
|
-
},
|
|
73
|
-
});
|
package/src/setup/a11y.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import a11y from "eslint-plugin-jsx-a11y";
|
|
2
|
-
import keys from "lodash/keys.js";
|
|
3
|
-
|
|
4
|
-
import { genRules, getNonDeprecatedRules } from "./gen-rules.ts";
|
|
5
|
-
|
|
6
|
-
const ruleNames = keys(getNonDeprecatedRules(a11y.rules ?? {}));
|
|
7
|
-
const customRules = [
|
|
8
|
-
{
|
|
9
|
-
// throws false positives
|
|
10
|
-
name: "control-has-associated-label",
|
|
11
|
-
rule: "off",
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
name: "media-has-caption",
|
|
15
|
-
rule: "off",
|
|
16
|
-
},
|
|
17
|
-
];
|
|
18
|
-
|
|
19
|
-
export const a11yRules = genRules(ruleNames, customRules, "a11y");
|
package/src/setup/angular.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import angularTS from "@angular-eslint/eslint-plugin";
|
|
2
|
-
import angularTemplate from "@angular-eslint/eslint-plugin-template";
|
|
3
|
-
import keys from "lodash/keys.js";
|
|
4
|
-
|
|
5
|
-
import { genRules, getNonDeprecatedRules } from "./gen-rules.js";
|
|
6
|
-
|
|
7
|
-
const tsRuleNames = keys(getNonDeprecatedRules(angularTS.rules));
|
|
8
|
-
const templateRuleNames = keys(getNonDeprecatedRules(angularTemplate.rules));
|
|
9
|
-
|
|
10
|
-
const customTsRules = [
|
|
11
|
-
{
|
|
12
|
-
name: "directive-selector",
|
|
13
|
-
rule: ["error", { prefix: "app", style: "camelCase", type: "attribute" }],
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
name: "component-selector",
|
|
17
|
-
rule: ["error", { prefix: "app", style: "kebab-case", type: "element" }],
|
|
18
|
-
},
|
|
19
|
-
];
|
|
20
|
-
|
|
21
|
-
const customTemplateRules = [
|
|
22
|
-
{ name: "i18n", rule: "off" },
|
|
23
|
-
{ name: "no-call-expression", rule: "off" },
|
|
24
|
-
{ name: "prefer-ngsrc", rule: "warn" },
|
|
25
|
-
];
|
|
26
|
-
|
|
27
|
-
export const angularTsRules = genRules(
|
|
28
|
-
tsRuleNames,
|
|
29
|
-
customTsRules,
|
|
30
|
-
"@angular-eslint",
|
|
31
|
-
);
|
|
32
|
-
export const angularTemplateRules = genRules(
|
|
33
|
-
templateRuleNames,
|
|
34
|
-
customTemplateRules,
|
|
35
|
-
"@angular-eslint/template",
|
|
36
|
-
);
|
package/src/setup/astro.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import astro from "eslint-plugin-astro";
|
|
2
|
-
import keys from "lodash/keys.js";
|
|
3
|
-
|
|
4
|
-
import { genRules, getNonDeprecatedRules } from "./gen-rules.ts";
|
|
5
|
-
|
|
6
|
-
const ruleNames = keys(getNonDeprecatedRules(astro.rules));
|
|
7
|
-
const customRules = [
|
|
8
|
-
{
|
|
9
|
-
name: "no-set-html-directive",
|
|
10
|
-
rule: "off",
|
|
11
|
-
},
|
|
12
|
-
];
|
|
13
|
-
|
|
14
|
-
export const astroRules = genRules(ruleNames, customRules, "astro");
|
package/src/setup/compat.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import compat from "eslint-plugin-compat";
|
|
2
|
-
import keys from "lodash/keys.js";
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
type CustomRules,
|
|
6
|
-
genRules,
|
|
7
|
-
getNonDeprecatedRules,
|
|
8
|
-
} from "./gen-rules.ts";
|
|
9
|
-
|
|
10
|
-
const ruleNames = keys(getNonDeprecatedRules(compat.rules));
|
|
11
|
-
const changedRules: CustomRules = [];
|
|
12
|
-
|
|
13
|
-
export const compatRules = genRules(ruleNames, changedRules, "compat");
|
package/src/setup/cspell.ts
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import cspell from "@cspell/eslint-plugin";
|
|
2
|
-
import keys from "lodash/keys.js";
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
type CustomRules,
|
|
6
|
-
genRules,
|
|
7
|
-
getNonDeprecatedRules,
|
|
8
|
-
} from "./gen-rules.js";
|
|
9
|
-
|
|
10
|
-
const ruleNames = keys(getNonDeprecatedRules(cspell.rules));
|
|
11
|
-
|
|
12
|
-
const customRules: CustomRules = [
|
|
13
|
-
{
|
|
14
|
-
name: "spellchecker",
|
|
15
|
-
rule: [
|
|
16
|
-
"error",
|
|
17
|
-
{
|
|
18
|
-
cspell: {
|
|
19
|
-
words: [
|
|
20
|
-
"tauri",
|
|
21
|
-
"Applynetic",
|
|
22
|
-
"julianday",
|
|
23
|
-
"typicode",
|
|
24
|
-
"toolbelt",
|
|
25
|
-
"taze",
|
|
26
|
-
"ethang",
|
|
27
|
-
"TSESTree",
|
|
28
|
-
"Boop",
|
|
29
|
-
"cldr",
|
|
30
|
-
"astro",
|
|
31
|
-
"laravel",
|
|
32
|
-
"qwik",
|
|
33
|
-
"sitecore",
|
|
34
|
-
"uswds",
|
|
35
|
-
"mediat",
|
|
36
|
-
"Packt",
|
|
37
|
-
"Academind",
|
|
38
|
-
"Udemy",
|
|
39
|
-
"Colte",
|
|
40
|
-
"Bootcamp",
|
|
41
|
-
"HTMX",
|
|
42
|
-
"MERN",
|
|
43
|
-
"Nuxt",
|
|
44
|
-
"Credly",
|
|
45
|
-
"Sterett",
|
|
46
|
-
"Beyonder",
|
|
47
|
-
"hotspot",
|
|
48
|
-
"lqip",
|
|
49
|
-
"Hawn",
|
|
50
|
-
"nextui",
|
|
51
|
-
"speculationrules",
|
|
52
|
-
"zustand",
|
|
53
|
-
"vinxi",
|
|
54
|
-
"datasource",
|
|
55
|
-
"turso",
|
|
56
|
-
"supabase",
|
|
57
|
-
"solidjs",
|
|
58
|
-
"labelledby",
|
|
59
|
-
"svix",
|
|
60
|
-
"blockqoute",
|
|
61
|
-
"cortexjs",
|
|
62
|
-
"mathrm",
|
|
63
|
-
"nums",
|
|
64
|
-
"lifecycles",
|
|
65
|
-
"krausest",
|
|
66
|
-
"Signalis",
|
|
67
|
-
"Plass",
|
|
68
|
-
"Iteree",
|
|
69
|
-
"Sonner",
|
|
70
|
-
"cmdk",
|
|
71
|
-
"ngsw",
|
|
72
|
-
"dexie",
|
|
73
|
-
"leetcode",
|
|
74
|
-
"ngsrc",
|
|
75
|
-
"sindresorhus",
|
|
76
|
-
"rogan",
|
|
77
|
-
"heroui",
|
|
78
|
-
"millis",
|
|
79
|
-
"duckdb",
|
|
80
|
-
"pthread",
|
|
81
|
-
"remeda",
|
|
82
|
-
"radash",
|
|
83
|
-
"noto",
|
|
84
|
-
"nosniff",
|
|
85
|
-
"SAMEORIGIN",
|
|
86
|
-
"starcoder",
|
|
87
|
-
"logprobs",
|
|
88
|
-
"sealioning",
|
|
89
|
-
"swebok",
|
|
90
|
-
"pluralsight",
|
|
91
|
-
"skillset",
|
|
92
|
-
"junie",
|
|
93
|
-
],
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
|
-
],
|
|
97
|
-
},
|
|
98
|
-
];
|
|
99
|
-
|
|
100
|
-
export const cspellRules = genRules(ruleNames, customRules, "cspell");
|
package/src/setup/css.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import css from "@eslint/css";
|
|
2
|
-
import keys from "lodash/keys.js";
|
|
3
|
-
|
|
4
|
-
import { genRules, getNonDeprecatedRules } from "./gen-rules.js";
|
|
5
|
-
|
|
6
|
-
const ruleNames = keys(getNonDeprecatedRules(css.rules));
|
|
7
|
-
|
|
8
|
-
export const cssRules = genRules(
|
|
9
|
-
ruleNames,
|
|
10
|
-
[
|
|
11
|
-
{ name: "no-invalid-at-rules", rule: "off" },
|
|
12
|
-
{ name: "use-baseline", rule: ["error", { available: "newly" }] },
|
|
13
|
-
],
|
|
14
|
-
"css",
|
|
15
|
-
);
|
package/src/setup/eslint.ts
DELETED
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
import eslint from "@eslint/js";
|
|
2
|
-
import keys from "lodash/keys.js";
|
|
3
|
-
|
|
4
|
-
import { type CustomRules, genRules } from "./gen-rules.ts";
|
|
5
|
-
|
|
6
|
-
const ruleNames = keys(eslint.configs.all.rules);
|
|
7
|
-
const customRules = [
|
|
8
|
-
{
|
|
9
|
-
name: "arrow-body-style",
|
|
10
|
-
rule: ["error", "always"],
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
name: "camelcase",
|
|
14
|
-
rule: "off",
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
name: "capitalized-comments",
|
|
18
|
-
rule: "off",
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
name: "class-methods-use-this",
|
|
22
|
-
rule: "off",
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
name: "complexity",
|
|
26
|
-
rule: "off",
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
name: "consistent-return",
|
|
30
|
-
rule: "off",
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
name: "consistent-this",
|
|
34
|
-
rule: "off",
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
name: "curly",
|
|
38
|
-
rule: "off",
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
name: "default-case",
|
|
42
|
-
rule: "off",
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
name: "default-case-last",
|
|
46
|
-
rule: "off",
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
name: "default-param-last",
|
|
50
|
-
rule: "off",
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
name: "dot-notation",
|
|
54
|
-
rule: "off",
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
name: "func-names",
|
|
58
|
-
rule: "off",
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
name: "func-style",
|
|
62
|
-
rule: ["error", "declaration", { allowArrowFunctions: true }],
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
name: "id-denylist",
|
|
66
|
-
rule: "off",
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
name: "id-length",
|
|
70
|
-
rule: "off",
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
name: "id-match",
|
|
74
|
-
rule: "off",
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
name: "init-declarations",
|
|
78
|
-
rule: "off",
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
name: "max-lines",
|
|
82
|
-
rule: "off",
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
name: "max-lines-per-function",
|
|
86
|
-
rule: "off",
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
name: "max-params",
|
|
90
|
-
rule: "off",
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
name: "max-statements",
|
|
94
|
-
rule: "off",
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
name: "new-cap",
|
|
98
|
-
rule: "off",
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
name: "no-array-constructor",
|
|
102
|
-
rule: "off",
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
name: "no-dupe-class-members",
|
|
106
|
-
rule: "off",
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
name: "no-empty-function",
|
|
110
|
-
rule: "off",
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
name: "no-implicit-globals",
|
|
114
|
-
rule: "off",
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
name: "no-implied-eval",
|
|
118
|
-
rule: "off",
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
name: "no-inline-comments",
|
|
122
|
-
rule: "off",
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
name: "no-magic-numbers",
|
|
126
|
-
rule: "off",
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
name: "no-redeclare",
|
|
130
|
-
rule: "off",
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
name: "no-restricted-exports",
|
|
134
|
-
rule: "off",
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
name: "no-restricted-globals",
|
|
138
|
-
rule: "off",
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
name: "no-restricted-imports",
|
|
142
|
-
rule: "off",
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
name: "no-restricted-properties",
|
|
146
|
-
rule: "off",
|
|
147
|
-
},
|
|
148
|
-
{
|
|
149
|
-
name: "no-restricted-syntax",
|
|
150
|
-
rule: "off",
|
|
151
|
-
},
|
|
152
|
-
{
|
|
153
|
-
name: "no-shadow",
|
|
154
|
-
rule: "off",
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
name: "no-template-curly-in-string",
|
|
158
|
-
rule: "off",
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
name: "no-ternary",
|
|
162
|
-
rule: "off",
|
|
163
|
-
},
|
|
164
|
-
{
|
|
165
|
-
name: "no-throw-literal",
|
|
166
|
-
rule: "off",
|
|
167
|
-
},
|
|
168
|
-
{
|
|
169
|
-
name: "no-undef",
|
|
170
|
-
rule: "off",
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
name: "no-undefined",
|
|
174
|
-
rule: "off",
|
|
175
|
-
},
|
|
176
|
-
{
|
|
177
|
-
name: "no-underscore-dangle",
|
|
178
|
-
rule: "off",
|
|
179
|
-
},
|
|
180
|
-
{
|
|
181
|
-
name: "no-unexpected-multiline",
|
|
182
|
-
rule: "off",
|
|
183
|
-
},
|
|
184
|
-
{
|
|
185
|
-
name: "no-unsafe-optional-chaining",
|
|
186
|
-
rule: ["error", { disallowArithmeticOperators: true }],
|
|
187
|
-
},
|
|
188
|
-
{
|
|
189
|
-
name: "no-unused-expressions",
|
|
190
|
-
rule: "off",
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
name: "no-unused-vars",
|
|
194
|
-
rule: "off",
|
|
195
|
-
},
|
|
196
|
-
{
|
|
197
|
-
name: "no-use-before-define",
|
|
198
|
-
rule: "off",
|
|
199
|
-
},
|
|
200
|
-
{
|
|
201
|
-
name: "no-useless-assignment",
|
|
202
|
-
rule: "off",
|
|
203
|
-
},
|
|
204
|
-
{
|
|
205
|
-
name: "no-useless-constructor",
|
|
206
|
-
rule: "off",
|
|
207
|
-
},
|
|
208
|
-
{
|
|
209
|
-
name: "no-warning-comments",
|
|
210
|
-
rule: "off",
|
|
211
|
-
},
|
|
212
|
-
{
|
|
213
|
-
name: "one-var",
|
|
214
|
-
rule: "off",
|
|
215
|
-
},
|
|
216
|
-
{
|
|
217
|
-
name: "prefer-arrow-callback",
|
|
218
|
-
rule: "off",
|
|
219
|
-
},
|
|
220
|
-
{
|
|
221
|
-
name: "prefer-destructuring",
|
|
222
|
-
rule: "off",
|
|
223
|
-
},
|
|
224
|
-
{
|
|
225
|
-
name: "prefer-promise-reject-errors",
|
|
226
|
-
rule: "off",
|
|
227
|
-
},
|
|
228
|
-
{
|
|
229
|
-
name: "require-await",
|
|
230
|
-
rule: "off",
|
|
231
|
-
},
|
|
232
|
-
{
|
|
233
|
-
name: "sort-imports",
|
|
234
|
-
rule: "off",
|
|
235
|
-
},
|
|
236
|
-
{
|
|
237
|
-
name: "sort-keys",
|
|
238
|
-
rule: "off",
|
|
239
|
-
},
|
|
240
|
-
{
|
|
241
|
-
name: "yoda",
|
|
242
|
-
rule: ["error", "always"],
|
|
243
|
-
},
|
|
244
|
-
];
|
|
245
|
-
|
|
246
|
-
export const eslintRules = genRules(
|
|
247
|
-
ruleNames,
|
|
248
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
249
|
-
customRules as unknown as CustomRules,
|
|
250
|
-
);
|
package/src/setup/gen-rules.ts
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import type { Linter, Rule } from "eslint";
|
|
2
|
-
|
|
3
|
-
import get from "lodash/get.js";
|
|
4
|
-
import includes from "lodash/includes.js";
|
|
5
|
-
import isNil from "lodash/isNil.js";
|
|
6
|
-
|
|
7
|
-
export type EsLintRules = Record<string, Rule.RuleModule>;
|
|
8
|
-
|
|
9
|
-
export const getNonDeprecatedRules = (rules: unknown) => {
|
|
10
|
-
const filtered: EsLintRules = {};
|
|
11
|
-
|
|
12
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
13
|
-
for (const [key, value] of Object.entries(rules as EsLintRules)) {
|
|
14
|
-
const deprecated = get(value, ["meta", "deprecated"]);
|
|
15
|
-
|
|
16
|
-
if (false === deprecated || isNil(deprecated)) {
|
|
17
|
-
filtered[key] = value;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return filtered;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export type CustomRules = {
|
|
25
|
-
name: string;
|
|
26
|
-
rule: CustomRule;
|
|
27
|
-
}[];
|
|
28
|
-
|
|
29
|
-
type CustomRule = (Record<string, unknown> | string)[] | string;
|
|
30
|
-
|
|
31
|
-
const getRuleStrings = (
|
|
32
|
-
ruleNames: string[],
|
|
33
|
-
defaultOverride: string,
|
|
34
|
-
prefix?: string,
|
|
35
|
-
) => {
|
|
36
|
-
const rules: Record<string, unknown> = {};
|
|
37
|
-
|
|
38
|
-
for (const rule of ruleNames) {
|
|
39
|
-
if (prefix === undefined) {
|
|
40
|
-
rules[rule] = isNil(defaultOverride) ? "error" : defaultOverride;
|
|
41
|
-
} else {
|
|
42
|
-
rules[`${prefix}/${rule}`] = isNil(defaultOverride)
|
|
43
|
-
? "error"
|
|
44
|
-
: defaultOverride;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return rules;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export const genRules = (
|
|
52
|
-
ruleNames: string[],
|
|
53
|
-
customRules?: CustomRules,
|
|
54
|
-
prefix?: string,
|
|
55
|
-
defaultOverride = "error",
|
|
56
|
-
) => {
|
|
57
|
-
const rules = getRuleStrings(ruleNames, defaultOverride, prefix);
|
|
58
|
-
|
|
59
|
-
if (!isNil(customRules)) {
|
|
60
|
-
for (const rule of customRules) {
|
|
61
|
-
if (includes(ruleNames, rule.name)) {
|
|
62
|
-
// eslint-disable-next-line sonar/nested-control-flow
|
|
63
|
-
if (prefix === undefined) {
|
|
64
|
-
rules[rule.name] = rule.rule;
|
|
65
|
-
} else {
|
|
66
|
-
rules[`${prefix}/${rule.name}`] = rule.rule;
|
|
67
|
-
}
|
|
68
|
-
} else {
|
|
69
|
-
globalThis.console.error(
|
|
70
|
-
`${rule.name} in ${prefix ?? "(unknown prefix)"} does not exist.`,
|
|
71
|
-
);
|
|
72
|
-
throw new Error(
|
|
73
|
-
`${rule.name} in ${prefix ?? "(unknown prefix)"} does not exist.`,
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
80
|
-
return Object.fromEntries(
|
|
81
|
-
Object.entries(rules).toSorted(([a], [b]) => {
|
|
82
|
-
return a.localeCompare(b);
|
|
83
|
-
}),
|
|
84
|
-
) as Linter.RulesRecord;
|
|
85
|
-
};
|
package/src/setup/html.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import html from "@html-eslint/eslint-plugin";
|
|
2
|
-
import get from "lodash/get.js";
|
|
3
|
-
import keys from "lodash/keys.js";
|
|
4
|
-
|
|
5
|
-
import { genRules } from "./gen-rules.ts";
|
|
6
|
-
|
|
7
|
-
const ruleNames = keys(get(html, ["rules"], []));
|
|
8
|
-
|
|
9
|
-
const customRules = [
|
|
10
|
-
{ name: "indent", rule: "off" },
|
|
11
|
-
{ name: "no-extra-spacing-attrs", rule: "off" },
|
|
12
|
-
{ name: "attrs-newline", rule: "off" },
|
|
13
|
-
{ name: "require-closing-tags", rule: "off" },
|
|
14
|
-
{ name: "element-newline", rule: "off" },
|
|
15
|
-
];
|
|
16
|
-
|
|
17
|
-
export const htmlRules = genRules(ruleNames, customRules, "html");
|
package/src/setup/json.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import json from "@eslint/json";
|
|
2
|
-
import keys from "lodash/keys.js";
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
type CustomRules,
|
|
6
|
-
type EsLintRules,
|
|
7
|
-
genRules,
|
|
8
|
-
getNonDeprecatedRules,
|
|
9
|
-
} from "./gen-rules.ts";
|
|
10
|
-
|
|
11
|
-
const ruleNames = keys(
|
|
12
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
13
|
-
getNonDeprecatedRules(json.rules as unknown as EsLintRules),
|
|
14
|
-
);
|
|
15
|
-
const customRules: CustomRules = [];
|
|
16
|
-
|
|
17
|
-
export const jsonRules = genRules(ruleNames, customRules, "json");
|
package/src/setup/lodash.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
// @ts-expect-error no types
|
|
2
|
-
import lodash from "eslint-plugin-lodash";
|
|
3
|
-
import keys from "lodash/keys.js";
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
type EsLintRules,
|
|
7
|
-
genRules,
|
|
8
|
-
getNonDeprecatedRules,
|
|
9
|
-
} from "./gen-rules.ts";
|
|
10
|
-
|
|
11
|
-
const ruleNames = keys(
|
|
12
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion,@typescript-eslint/no-unsafe-member-access
|
|
13
|
-
getNonDeprecatedRules(lodash.rules as unknown as EsLintRules),
|
|
14
|
-
);
|
|
15
|
-
const customRules = [
|
|
16
|
-
{
|
|
17
|
-
name: "chain-style",
|
|
18
|
-
rule: [2, "as-needed"],
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
name: "consistent-compose",
|
|
22
|
-
rule: [2, "flow"],
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
name: "identity-shorthand",
|
|
26
|
-
rule: [2, "always"],
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
name: "import-scope",
|
|
30
|
-
rule: [2, "method"],
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
name: "matches-prop-shorthand",
|
|
34
|
-
rule: [2, "always"],
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
name: "matches-shorthand",
|
|
38
|
-
rule: [2, "always", 3],
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
name: "path-style",
|
|
42
|
-
rule: [2, "array"],
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
name: "prefer-includes",
|
|
46
|
-
rule: [2, { includeNative: true }],
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
name: "prefer-some",
|
|
50
|
-
rule: [2, { includeNative: true }],
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
name: "prop-shorthand",
|
|
54
|
-
rule: [2, "always"],
|
|
55
|
-
},
|
|
56
|
-
];
|
|
57
|
-
|
|
58
|
-
// @ts-expect-error loose types
|
|
59
|
-
export const lodashRules = genRules(ruleNames, customRules, "lodash");
|