@shayanthenerd/eslint-config 0.11.1 → 0.12.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/configs/base.mjs +43 -0
- package/dist/configs/{css.js → css.mjs} +6 -6
- package/dist/configs/{cypress.js → cypress.mjs} +6 -5
- package/dist/configs/{html.js → html.mjs} +7 -5
- package/dist/configs/importX.mjs +26 -0
- package/dist/configs/{oxlintOverrides.js → oxlintOverrides.mjs} +14 -14
- package/dist/configs/{perfectionist.js → perfectionist.mjs} +5 -5
- package/dist/configs/{playwright.js → playwright.mjs} +6 -5
- package/dist/configs/{restrictedExports.js → restrictedExports.mjs} +1 -1
- package/dist/configs/{storybook.js → storybook.mjs} +5 -6
- package/dist/configs/{stylistic.js → stylistic.mjs} +7 -7
- package/dist/configs/{tailwind.js → tailwind.mjs} +19 -16
- package/dist/configs/typescript.mjs +34 -0
- package/dist/configs/{vitest.js → vitest.mjs} +5 -5
- package/dist/configs/vue.mjs +45 -0
- package/dist/configs/{vueComponentNames.js → vueComponentNames.mjs} +1 -1
- package/dist/configs/{vueServerComponents.js → vueServerComponents.mjs} +1 -1
- package/dist/{index.d.ts → index.d.mts} +3 -3
- package/dist/index.mjs +75 -0
- package/dist/oxlint.config.jsonc +1 -0
- package/dist/rules/{css.js → css.mjs} +14 -5
- package/dist/rules/cypress.mjs +18 -0
- package/dist/rules/{html.js → html.mjs} +47 -25
- package/dist/rules/{importX.js → importX.mjs} +25 -23
- package/dist/rules/{javascript.js → javascript.mjs} +167 -115
- package/dist/rules/{perfectionist.js → perfectionist.mjs} +2 -2
- package/dist/rules/playwright.mjs +54 -0
- package/dist/rules/storybook.mjs +25 -0
- package/dist/rules/{stylistic.js → stylistic.mjs} +106 -57
- package/dist/rules/{tailwind.js → tailwind.mjs} +15 -14
- package/dist/rules/typescript.mjs +173 -0
- package/dist/rules/{vitest.js → vitest.mjs} +57 -28
- package/dist/rules/vue.mjs +361 -0
- package/dist/rules/{vueAccessibility.js → vueAccessibility.mjs} +23 -9
- package/dist/types/configOptions/{base.d.ts → base.d.mts} +2 -2
- package/dist/types/configOptions/{css.d.ts → css.d.mts} +2 -2
- package/dist/types/configOptions/{html.d.ts → html.d.mts} +2 -2
- package/dist/types/configOptions/{importX.d.ts → importX.d.mts} +1 -1
- package/dist/types/configOptions/{perfectionist.d.ts → perfectionist.d.mts} +2 -2
- package/dist/types/configOptions/{stylistic.d.ts → stylistic.d.mts} +2 -2
- package/dist/types/configOptions/{tailwind.d.ts → tailwind.d.mts} +2 -2
- package/dist/types/configOptions/{test.d.ts → test.d.mts} +2 -2
- package/dist/types/configOptions/{typescript.d.ts → typescript.d.mts} +2 -2
- package/dist/types/configOptions/{vue.d.ts → vue.d.mts} +3 -3
- package/dist/types/configOptions/{vueAccessibility.d.ts → vueAccessibility.d.mts} +1 -1
- package/dist/types/{eslint-schema.d.ts → eslint-schema.d.mts} +24 -33
- package/dist/types/{eslintRules.d.ts → eslintRules.d.mts} +2 -2
- package/dist/types/{index.d.ts → index.d.mts} +12 -12
- package/dist/utils/ignores/{getIgnorePatterns.js → getIgnorePatterns.mjs} +2 -2
- package/dist/utils/{isPackageDetected.js → isPackageDetected.mjs} +1 -1
- package/dist/utils/options/{enableDetectedConfigs.js → enableDetectedConfigs.mjs} +2 -2
- package/dist/utils/options/{mergeWithDefaults.js → mergeWithDefaults.mjs} +3 -3
- package/package.json +30 -31
- package/dist/configs/base.js +0 -44
- package/dist/configs/importX.js +0 -23
- package/dist/configs/typescript.js +0 -31
- package/dist/configs/vue.js +0 -33
- package/dist/index.js +0 -74
- package/dist/rules/cypress.js +0 -14
- package/dist/rules/playwright.js +0 -26
- package/dist/rules/storybook.js +0 -14
- package/dist/rules/typescript.js +0 -63
- package/dist/rules/vue.js +0 -186
- /package/dist/{prettier.config.d.ts → prettier.config.d.mts} +0 -0
- /package/dist/{prettier.config.js → prettier.config.mjs} +0 -0
- /package/dist/types/configOptions/{nuxt.d.ts → nuxt.d.mts} +0 -0
- /package/dist/types/{helpers.d.ts → helpers.d.mts} +0 -0
- /package/dist/utils/{globs.js → globs.mjs} +0 -0
- /package/dist/utils/ignores/{defaultIgnorePatterns.js → defaultIgnorePatterns.mjs} +0 -0
- /package/dist/utils/ignores/{resolveGitignorePatterns.js → resolveGitignorePatterns.mjs} +0 -0
- /package/dist/utils/{isEmptyString.js → isEmptyString.mjs} +0 -0
- /package/dist/utils/{isEnabled.js → isEnabled.mjs} +0 -0
- /package/dist/utils/options/{defaultOptions.js → defaultOptions.mjs} +0 -0
- /package/dist/utils/vue/{getRestrictedVueElements.js → getRestrictedVueElements.mjs} +0 -0
- /package/dist/utils/vue/{getRestrictedVueInputs.js → getRestrictedVueInputs.mjs} +0 -0
|
@@ -1,52 +1,74 @@
|
|
|
1
|
-
import { isEnabled } from "../utils/isEnabled.
|
|
2
|
-
import { defaultOptions } from "../utils/options/defaultOptions.
|
|
1
|
+
import { isEnabled } from "../utils/isEnabled.mjs";
|
|
2
|
+
import { defaultOptions } from "../utils/options/defaultOptions.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/rules/html.ts
|
|
5
5
|
function getHTMLRules(options) {
|
|
6
|
-
const { html, stylistic } = options.configs;
|
|
6
|
+
const { html, tailwind, stylistic } = options.configs;
|
|
7
7
|
const { useBaseline, idNamingConvention } = isEnabled(html) ? html : defaultOptions.configs.html;
|
|
8
8
|
const { indent, useTabs, maxAttributesPerLine, maxConsecutiveEmptyLines, selfCloseVoidHTMLElements } = isEnabled(stylistic) ? stylistic : defaultOptions.configs.stylistic;
|
|
9
|
-
|
|
10
|
-
"
|
|
11
|
-
"@html-eslint/no-target-blank": "error",
|
|
9
|
+
const htmlRules = {
|
|
10
|
+
"@html-eslint/no-duplicate-attrs": "error",
|
|
12
11
|
"@html-eslint/no-duplicate-class": "warn",
|
|
12
|
+
"@html-eslint/no-duplicate-id": "error",
|
|
13
|
+
"@html-eslint/no-duplicate-in-head": "error",
|
|
14
|
+
"@html-eslint/no-ineffective-attrs": "warn",
|
|
15
|
+
"@html-eslint/no-invalid-entity": "error",
|
|
16
|
+
"@html-eslint/no-nested-interactive": "error",
|
|
17
|
+
"@html-eslint/no-obsolete-tags": "error",
|
|
18
|
+
"@html-eslint/no-script-style-type": "warn",
|
|
19
|
+
"@html-eslint/no-target-blank": "warn",
|
|
20
|
+
"@html-eslint/prefer-https": "warn",
|
|
13
21
|
"@html-eslint/require-button-type": "error",
|
|
14
|
-
"@html-eslint/
|
|
15
|
-
"@html-eslint/no-script-style-type": "error",
|
|
16
|
-
"@html-eslint/require-meta-charset": "error",
|
|
17
|
-
"@html-eslint/quotes": [
|
|
18
|
-
"warn",
|
|
19
|
-
"double",
|
|
20
|
-
{ enforceTemplatedAttrValue: true }
|
|
21
|
-
],
|
|
22
|
-
"@html-eslint/use-baseline": useBaseline ? ["warn", { available: useBaseline }] : "off",
|
|
23
|
-
"@html-eslint/require-closing-tags": ["error", {
|
|
22
|
+
"@html-eslint/require-closing-tags": ["warn", {
|
|
24
23
|
selfClosingCustomPatterns: ["-"],
|
|
25
24
|
selfClosing: selfCloseVoidHTMLElements
|
|
26
25
|
}],
|
|
26
|
+
"@html-eslint/require-doctype": "error",
|
|
27
|
+
"@html-eslint/require-explicit-size": "warn",
|
|
28
|
+
"@html-eslint/require-li-container": "error",
|
|
29
|
+
"@html-eslint/require-meta-charset": "error",
|
|
30
|
+
"@html-eslint/use-baseline": useBaseline ? ["warn", { available: useBaseline }] : "off",
|
|
31
|
+
"@html-eslint/no-multiple-h1": "error",
|
|
32
|
+
"@html-eslint/require-lang": "error",
|
|
27
33
|
"@html-eslint/require-meta-description": "error",
|
|
28
34
|
"@html-eslint/require-open-graph-protocol": "error",
|
|
35
|
+
"@html-eslint/require-title": "error",
|
|
29
36
|
"@html-eslint/no-abstract-roles": "error",
|
|
30
37
|
"@html-eslint/no-accesskey-attrs": "error",
|
|
31
|
-
"@html-eslint/require-frame-title": "error",
|
|
32
38
|
"@html-eslint/no-aria-hidden-body": "error",
|
|
39
|
+
"@html-eslint/no-aria-hidden-on-focusable": "error",
|
|
40
|
+
"@html-eslint/no-empty-headings": "error",
|
|
41
|
+
"@html-eslint/no-heading-inside-button": "error",
|
|
42
|
+
"@html-eslint/no-invalid-role": "error",
|
|
43
|
+
"@html-eslint/no-non-scalable-viewport": "error",
|
|
33
44
|
"@html-eslint/no-positive-tabindex": "error",
|
|
34
|
-
"@html-eslint/require-meta-viewport": "error",
|
|
35
45
|
"@html-eslint/no-skip-heading-levels": "error",
|
|
36
|
-
"@html-eslint/
|
|
37
|
-
"@html-eslint/
|
|
38
|
-
"@html-eslint/
|
|
39
|
-
"@html-eslint/
|
|
40
|
-
"@html-eslint/element-newline": ["warn", { inline: ["$inline"] }],
|
|
46
|
+
"@html-eslint/require-frame-title": "error",
|
|
47
|
+
"@html-eslint/require-img-alt": "error",
|
|
48
|
+
"@html-eslint/require-input-label": "error",
|
|
49
|
+
"@html-eslint/require-meta-viewport": "error",
|
|
41
50
|
"@html-eslint/attrs-newline": ["warn", { ifAttrsMoreThan: maxAttributesPerLine }],
|
|
42
|
-
"@html-eslint/
|
|
51
|
+
"@html-eslint/element-newline": ["warn", { inline: ["$inline"] }],
|
|
52
|
+
"@html-eslint/id-naming-convention": ["warn", idNamingConvention],
|
|
53
|
+
"@html-eslint/indent": ["warn", useTabs ? "tab" : indent],
|
|
54
|
+
"@html-eslint/lowercase": "warn",
|
|
43
55
|
"@html-eslint/no-extra-spacing-attrs": ["warn", {
|
|
44
56
|
disallowTabs: true,
|
|
45
57
|
disallowMissing: true,
|
|
46
58
|
disallowInAssignment: true,
|
|
47
59
|
enforceBeforeSelfClose: true
|
|
48
|
-
}]
|
|
60
|
+
}],
|
|
61
|
+
"@html-eslint/no-extra-spacing-text": ["warn", { skip: ["pre"] }],
|
|
62
|
+
"@html-eslint/no-multiple-empty-lines": ["warn", { max: maxConsecutiveEmptyLines }],
|
|
63
|
+
"@html-eslint/no-trailing-spaces": "warn",
|
|
64
|
+
"@html-eslint/quotes": [
|
|
65
|
+
"warn",
|
|
66
|
+
"double",
|
|
67
|
+
{ enforceTemplatedAttrValue: true }
|
|
68
|
+
]
|
|
49
69
|
};
|
|
70
|
+
if (isEnabled(tailwind)) htmlRules["better-tailwindcss/no-duplicate-classes"] = "off";
|
|
71
|
+
return htmlRules;
|
|
50
72
|
}
|
|
51
73
|
|
|
52
74
|
//#endregion
|
|
@@ -1,42 +1,44 @@
|
|
|
1
|
-
import { isEnabled } from "../utils/isEnabled.
|
|
2
|
-
import { defaultOptions } from "../utils/options/defaultOptions.
|
|
1
|
+
import { isEnabled } from "../utils/isEnabled.mjs";
|
|
2
|
+
import { defaultOptions } from "../utils/options/defaultOptions.mjs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
|
|
5
5
|
//#region src/rules/importX.ts
|
|
6
6
|
function getImportXRules(options) {
|
|
7
7
|
const { packageDir, configs: { importX, typescript } } = options;
|
|
8
|
+
const isTypeScriptEnabled = isEnabled(typescript);
|
|
8
9
|
const { removeUnusedImports } = isEnabled(importX) ? importX : defaultOptions.configs.importX;
|
|
9
10
|
return {
|
|
10
11
|
"unused-imports/no-unused-imports": removeUnusedImports ? "warn" : "off",
|
|
11
|
-
"import-x/
|
|
12
|
-
"import-x/no-commonjs": "error",
|
|
13
|
-
"import-x/exports-last": "warn",
|
|
12
|
+
"import-x/export": isTypeScriptEnabled ? "off" : "error",
|
|
14
13
|
"import-x/no-deprecated": "warn",
|
|
15
|
-
"import-x/group-exports": "warn",
|
|
16
|
-
"import-x/no-self-import": "error",
|
|
17
|
-
"import-x/no-absolute-path": "warn",
|
|
18
|
-
"import-x/no-named-default": "error",
|
|
19
|
-
"import-x/no-mutable-exports": "error",
|
|
20
14
|
"import-x/no-empty-named-blocks": "error",
|
|
21
|
-
"import-x/no-
|
|
22
|
-
|
|
15
|
+
"import-x/no-extraneous-dependencies": ["error", {
|
|
16
|
+
includeTypes: true,
|
|
17
|
+
packageDir: path.resolve(packageDir)
|
|
18
|
+
}],
|
|
19
|
+
"import-x/no-mutable-exports": "error",
|
|
20
|
+
"import-x/no-named-as-default": "error",
|
|
23
21
|
"import-x/no-named-as-default-member": "off",
|
|
24
|
-
"import-x/
|
|
25
|
-
"import-x/
|
|
26
|
-
"import-x/
|
|
27
|
-
"import-x/
|
|
28
|
-
"import-x/
|
|
29
|
-
"import-x/no-unresolved": typescript ? "off" : "error",
|
|
22
|
+
"import-x/no-amd": "error",
|
|
23
|
+
"import-x/no-commonjs": "error",
|
|
24
|
+
"import-x/no-import-module-exports": "error",
|
|
25
|
+
"import-x/named": isTypeScriptEnabled ? "off" : "error",
|
|
26
|
+
"import-x/default": isTypeScriptEnabled ? "off" : "error",
|
|
30
27
|
"import-x/namespace": ["error", { allowComputed: true }],
|
|
31
|
-
"import-x/no-
|
|
28
|
+
"import-x/no-absolute-path": "warn",
|
|
32
29
|
"import-x/no-cycle": ["error", {
|
|
33
30
|
maxDepth: 1,
|
|
34
31
|
ignoreExternal: true
|
|
35
32
|
}],
|
|
36
|
-
"import-x/no-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
"import-x/no-self-import": "error",
|
|
34
|
+
"import-x/no-unresolved": isTypeScriptEnabled ? "off" : "error",
|
|
35
|
+
"import-x/no-useless-path-segments": "error",
|
|
36
|
+
"import-x/consistent-type-specifier-style": "warn",
|
|
37
|
+
"import-x/exports-last": "warn",
|
|
38
|
+
"import-x/first": ["warn", "disable-absolute-first"],
|
|
39
|
+
"import-x/group-exports": "warn",
|
|
40
|
+
"import-x/no-duplicates": ["error", { considerQueryString: true }],
|
|
41
|
+
"import-x/no-named-default": "error"
|
|
40
42
|
};
|
|
41
43
|
}
|
|
42
44
|
|
|
@@ -2,130 +2,95 @@
|
|
|
2
2
|
function getJavaScriptRules(options) {
|
|
3
3
|
const { maxDepth, functionStyle, maxNestedCallbacks, preferNamedExports } = options.configs.base;
|
|
4
4
|
return {
|
|
5
|
-
"no-self-compare": "warn",
|
|
6
|
-
"no-await-in-loop": "error",
|
|
7
|
-
"no-unassigned-vars": "error",
|
|
8
|
-
"no-unreachable-loop": "warn",
|
|
9
|
-
"no-inner-declarations": "warn",
|
|
10
|
-
"require-atomic-updates": "warn",
|
|
11
5
|
"array-callback-return": "error",
|
|
12
|
-
"
|
|
13
|
-
"
|
|
6
|
+
"constructor-super": "error",
|
|
7
|
+
"for-direction": "error",
|
|
8
|
+
"getter-return": "error",
|
|
14
9
|
"no-async-promise-executor": "error",
|
|
10
|
+
"no-await-in-loop": "error",
|
|
11
|
+
"no-case-declarations": "error",
|
|
12
|
+
"no-class-assign": "error",
|
|
13
|
+
"no-compare-neg-zero": "error",
|
|
14
|
+
"no-cond-assign": "error",
|
|
15
|
+
"no-const-assign": "error",
|
|
16
|
+
"no-constant-binary-expression": "error",
|
|
17
|
+
"no-constant-condition": "error",
|
|
18
|
+
"no-constructor-return": "error",
|
|
19
|
+
"no-control-regex": "error",
|
|
20
|
+
"no-debugger": "error",
|
|
21
|
+
"no-delete-var": "error",
|
|
22
|
+
"no-dupe-args": "error",
|
|
23
|
+
"no-dupe-class-members": "error",
|
|
24
|
+
"no-dupe-else-if": "error",
|
|
25
|
+
"no-dupe-keys": "error",
|
|
26
|
+
"no-duplicate-case": "error",
|
|
27
|
+
"no-duplicate-imports": ["error", {
|
|
28
|
+
includeExports: true,
|
|
29
|
+
allowSeparateTypeImports: true
|
|
30
|
+
}],
|
|
31
|
+
"no-empty-character-class": "error",
|
|
32
|
+
"no-empty-pattern": "error",
|
|
33
|
+
"no-empty-static-block": "error",
|
|
34
|
+
"no-ex-assign": "error",
|
|
35
|
+
"no-fallthrough": "error",
|
|
36
|
+
"no-func-assign": "error",
|
|
37
|
+
"no-global-assign": "error",
|
|
38
|
+
"no-import-assign": "error",
|
|
39
|
+
"no-inner-declarations": "warn",
|
|
40
|
+
"no-invalid-regexp": "error",
|
|
41
|
+
"no-irregular-whitespace": "warn",
|
|
42
|
+
"no-loss-of-precision": "error",
|
|
43
|
+
"no-misleading-character-class": "error",
|
|
15
44
|
"no-promise-executor-return": "error",
|
|
45
|
+
"no-self-compare": "warn",
|
|
16
46
|
"no-template-curly-in-string": "error",
|
|
47
|
+
"no-unassigned-vars": "error",
|
|
17
48
|
"no-unmodified-loop-condition": "error",
|
|
18
|
-
"
|
|
19
|
-
"no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
|
|
49
|
+
"no-unreachable-loop": "warn",
|
|
20
50
|
"no-unsafe-negation": ["error", { enforceForOrderingRelations: true }],
|
|
21
51
|
"no-unsafe-optional-chaining": ["error", { disallowArithmeticOperators: true }],
|
|
52
|
+
"no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
|
|
22
53
|
"no-use-before-define": ["error", {
|
|
23
54
|
functions: false,
|
|
24
55
|
ignoreTypeReferences: false
|
|
25
56
|
}],
|
|
26
|
-
"no-
|
|
27
|
-
|
|
28
|
-
|
|
57
|
+
"no-useless-assignment": "error",
|
|
58
|
+
"require-atomic-updates": "warn",
|
|
59
|
+
"use-isnan": ["error", { enforceForIndexOf: true }],
|
|
60
|
+
"valid-typeof": "error",
|
|
61
|
+
"accessor-pairs": "error",
|
|
62
|
+
"block-scoped-var": "warn",
|
|
63
|
+
"camelcase": ["warn", {
|
|
64
|
+
properties: "never",
|
|
65
|
+
ignoreImports: true,
|
|
66
|
+
ignoreDestructuring: true
|
|
29
67
|
}],
|
|
30
|
-
"
|
|
31
|
-
"strict": "error",
|
|
32
|
-
"no-var": "error",
|
|
33
|
-
"eqeqeq": "error",
|
|
34
|
-
"no-new": "error",
|
|
35
|
-
"new-cap": "warn",
|
|
36
|
-
"no-eval": "error",
|
|
37
|
-
"no-void": "error",
|
|
38
|
-
"no-proto": "warn",
|
|
39
|
-
"no-empty": "warn",
|
|
40
|
-
"no-caller": "error",
|
|
41
|
-
"no-eq-null": "warn",
|
|
68
|
+
"class-methods-use-this": "error",
|
|
42
69
|
"complexity": "warn",
|
|
43
|
-
"
|
|
44
|
-
"no-redeclare": "off",
|
|
45
|
-
"no-iterator": "warn",
|
|
46
|
-
"no-continue": "warn",
|
|
47
|
-
"no-new-func": "error",
|
|
48
|
-
"guard-for-in": "warn",
|
|
49
|
-
"no-loop-func": "warn",
|
|
50
|
-
"default-case": "warn",
|
|
51
|
-
"no-lonely-if": "error",
|
|
52
|
-
"no-label-var": "error",
|
|
53
|
-
"no-multi-str": "error",
|
|
54
|
-
"prefer-const": "error",
|
|
55
|
-
"require-await": "warn",
|
|
56
|
-
"dot-notation": "error",
|
|
57
|
-
"no-script-url": "error",
|
|
58
|
-
"no-undef-init": "error",
|
|
59
|
-
"no-extra-bind": "error",
|
|
60
|
-
"prefer-spread": "error",
|
|
61
|
-
"no-lone-blocks": "error",
|
|
62
|
-
"no-extra-label": "error",
|
|
63
|
-
"accessor-pairs": "error",
|
|
64
|
-
"prefer-template": "warn",
|
|
65
|
-
"no-invalid-this": "error",
|
|
66
|
-
"no-useless-call": "error",
|
|
67
|
-
"no-implied-eval": "error",
|
|
70
|
+
"consistent-return": "error",
|
|
68
71
|
"consistent-this": "error",
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"block-scoped-var": "warn",
|
|
72
|
-
"object-shorthand": "warn",
|
|
73
|
-
"no-throw-literal": "error",
|
|
74
|
-
"no-extend-native": "error",
|
|
72
|
+
"curly": ["warn", "multi-line"],
|
|
73
|
+
"default-case": "warn",
|
|
75
74
|
"default-case-last": "warn",
|
|
76
|
-
"no-nested-ternary": "warn",
|
|
77
|
-
"no-useless-return": "error",
|
|
78
|
-
"init-declarations": "error",
|
|
79
|
-
"consistent-return": "error",
|
|
80
|
-
"no-useless-concat": "error",
|
|
81
|
-
"no-param-reassign": "error",
|
|
82
|
-
"no-useless-rename": "error",
|
|
83
75
|
"default-param-last": "warn",
|
|
84
|
-
"
|
|
76
|
+
"dot-notation": "warn",
|
|
77
|
+
"eqeqeq": "error",
|
|
85
78
|
"func-name-matching": "warn",
|
|
86
|
-
"prefer-rest-params": "error",
|
|
87
|
-
"operator-assignment": "error",
|
|
88
|
-
"no-unneeded-ternary": "error",
|
|
89
|
-
"no-implicit-globals": "error",
|
|
90
|
-
"prefer-destructuring": "warn",
|
|
91
|
-
"no-implicit-coercion": "error",
|
|
92
|
-
"no-array-constructor": "error",
|
|
93
|
-
"prefer-object-spread": "error",
|
|
94
|
-
"radix": ["error", "as-needed"],
|
|
95
|
-
"curly": ["warn", "multi-line"],
|
|
96
|
-
"max-depth": ["warn", maxDepth],
|
|
97
|
-
"preserve-caught-error": "warn",
|
|
98
|
-
"no-object-constructor": "error",
|
|
99
|
-
"prefer-object-has-own": "error",
|
|
100
|
-
"no-useless-constructor": "error",
|
|
101
|
-
"class-methods-use-this": "error",
|
|
102
|
-
"prefer-numeric-literals": "error",
|
|
103
|
-
"no-useless-computed-key": "error",
|
|
104
|
-
"prefer-named-capture-group": "warn",
|
|
105
|
-
"no-return-assign": ["error", "always"],
|
|
106
|
-
"prefer-exponentiation-operator": "error",
|
|
107
|
-
"no-bitwise": ["error", { int32Hint: true }],
|
|
108
|
-
"max-params": ["warn", { countVoidThis: true }],
|
|
109
|
-
"logical-assignment-operators": ["error", "always"],
|
|
110
|
-
"max-nested-callbacks": ["warn", maxNestedCallbacks],
|
|
111
|
-
"no-sequences": ["error", { allowInParentheses: false }],
|
|
112
|
-
"no-multi-assign": ["error", { ignoreNonDeclaration: true }],
|
|
113
|
-
"no-plusplus": ["error", { allowForLoopAfterthoughts: true }],
|
|
114
|
-
"prefer-arrow-callback": ["error", { allowUnboundThis: true }],
|
|
115
|
-
"no-shadow-restricted-names": ["warn", { reportGlobalThis: true }],
|
|
116
79
|
"func-style": [
|
|
117
80
|
"warn",
|
|
118
81
|
functionStyle,
|
|
119
82
|
{ allowTypeAnnotation: true }
|
|
120
83
|
],
|
|
121
|
-
"
|
|
122
|
-
"
|
|
123
|
-
"
|
|
124
|
-
"
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
84
|
+
"guard-for-in": "warn",
|
|
85
|
+
"init-declarations": "error",
|
|
86
|
+
"logical-assignment-operators": ["error", "always"],
|
|
87
|
+
"max-depth": ["warn", maxDepth],
|
|
88
|
+
"max-nested-callbacks": ["warn", maxNestedCallbacks],
|
|
89
|
+
"max-params": ["warn", { countVoidThis: true }],
|
|
90
|
+
"new-cap": "warn",
|
|
91
|
+
"no-array-constructor": "error",
|
|
92
|
+
"no-bitwise": ["error", { int32Hint: true }],
|
|
93
|
+
"no-caller": "error",
|
|
129
94
|
"no-console": ["warn", { allow: [
|
|
130
95
|
"info",
|
|
131
96
|
"warn",
|
|
@@ -135,6 +100,58 @@ function getJavaScriptRules(options) {
|
|
|
135
100
|
"groupEnd",
|
|
136
101
|
"groupCollapsed"
|
|
137
102
|
] }],
|
|
103
|
+
"no-continue": "warn",
|
|
104
|
+
"no-empty": "warn",
|
|
105
|
+
"no-empty-function": ["error", { allow: [
|
|
106
|
+
"overrideMethods",
|
|
107
|
+
"decoratedFunctions",
|
|
108
|
+
"privateConstructors",
|
|
109
|
+
"protectedConstructors"
|
|
110
|
+
] }],
|
|
111
|
+
"no-eq-null": "warn",
|
|
112
|
+
"no-eval": "error",
|
|
113
|
+
"no-extend-native": "error",
|
|
114
|
+
"no-extra-bind": "error",
|
|
115
|
+
"no-extra-boolean-cast": ["error", { enforceForInnerExpressions: true }],
|
|
116
|
+
"no-extra-label": "error",
|
|
117
|
+
"no-implicit-coercion": "error",
|
|
118
|
+
"no-implicit-globals": "error",
|
|
119
|
+
"no-implied-eval": "error",
|
|
120
|
+
"no-invalid-this": "error",
|
|
121
|
+
"no-iterator": "warn",
|
|
122
|
+
"no-label-var": "error",
|
|
123
|
+
"no-lone-blocks": "error",
|
|
124
|
+
"no-lonely-if": "error",
|
|
125
|
+
"no-loop-func": "warn",
|
|
126
|
+
"no-multi-assign": ["error", { ignoreNonDeclaration: true }],
|
|
127
|
+
"no-multi-str": "error",
|
|
128
|
+
"no-nested-ternary": "warn",
|
|
129
|
+
"no-new": "error",
|
|
130
|
+
"no-new-func": "error",
|
|
131
|
+
"no-new-native-nonconstructor": "error",
|
|
132
|
+
"no-new-wrappers": "error",
|
|
133
|
+
"no-nonoctal-decimal-escape": "error",
|
|
134
|
+
"no-obj-calls": "error",
|
|
135
|
+
"no-object-constructor": "error",
|
|
136
|
+
"no-octal": "error",
|
|
137
|
+
"no-octal-escape": "error",
|
|
138
|
+
"no-param-reassign": "error",
|
|
139
|
+
"no-plusplus": ["error", { allowForLoopAfterthoughts: true }],
|
|
140
|
+
"no-proto": "warn",
|
|
141
|
+
"no-prototype-builtins": "error",
|
|
142
|
+
"no-redeclare": "off",
|
|
143
|
+
"no-regex-spaces": "error",
|
|
144
|
+
"no-restricted-exports": [preferNamedExports ? "error" : "off", { restrictDefaultExports: {
|
|
145
|
+
named: true,
|
|
146
|
+
namedFrom: true,
|
|
147
|
+
defaultFrom: true,
|
|
148
|
+
namespaceFrom: true
|
|
149
|
+
} }],
|
|
150
|
+
"no-return-assign": ["error", "always"],
|
|
151
|
+
"no-script-url": "error",
|
|
152
|
+
"no-self-assign": "error",
|
|
153
|
+
"no-sequences": ["error", { allowInParentheses: false }],
|
|
154
|
+
"no-setter-return": "error",
|
|
138
155
|
"no-shadow": ["error", {
|
|
139
156
|
hoist: "all",
|
|
140
157
|
allow: ["name"],
|
|
@@ -142,24 +159,59 @@ function getJavaScriptRules(options) {
|
|
|
142
159
|
ignoreTypeValueShadow: false,
|
|
143
160
|
ignoreFunctionTypeParameterNameValueShadow: false
|
|
144
161
|
}],
|
|
145
|
-
"no-restricted-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
"no-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
"protectedConstructors"
|
|
156
|
-
] }],
|
|
162
|
+
"no-shadow-restricted-names": ["warn", { reportGlobalThis: true }],
|
|
163
|
+
"no-sparse-arrays": "error",
|
|
164
|
+
"no-this-before-super": "error",
|
|
165
|
+
"no-throw-literal": "error",
|
|
166
|
+
"no-undef": "error",
|
|
167
|
+
"no-undef-init": "error",
|
|
168
|
+
"no-unexpected-multiline": "error",
|
|
169
|
+
"no-unneeded-ternary": "error",
|
|
170
|
+
"no-unreachable": "error",
|
|
171
|
+
"no-unsafe-finally": "error",
|
|
157
172
|
"no-unused-expressions": ["error", {
|
|
158
173
|
allowTernary: true,
|
|
159
174
|
enforceForJSX: true,
|
|
160
175
|
allowShortCircuit: true,
|
|
161
176
|
allowTaggedTemplates: true
|
|
162
|
-
}]
|
|
177
|
+
}],
|
|
178
|
+
"no-unused-labels": "error",
|
|
179
|
+
"no-unused-private-class-members": "error",
|
|
180
|
+
"no-useless-backreference": "error",
|
|
181
|
+
"no-useless-call": "error",
|
|
182
|
+
"no-useless-catch": "error",
|
|
183
|
+
"no-useless-computed-key": "error",
|
|
184
|
+
"no-useless-concat": "error",
|
|
185
|
+
"no-useless-constructor": "error",
|
|
186
|
+
"no-useless-escape": "error",
|
|
187
|
+
"no-useless-rename": "error",
|
|
188
|
+
"no-useless-return": "error",
|
|
189
|
+
"no-var": "error",
|
|
190
|
+
"no-void": "error",
|
|
191
|
+
"no-with": "error",
|
|
192
|
+
"object-shorthand": "warn",
|
|
193
|
+
"operator-assignment": "error",
|
|
194
|
+
"prefer-arrow-callback": ["warn", { allowUnboundThis: true }],
|
|
195
|
+
"prefer-const": "error",
|
|
196
|
+
"prefer-destructuring": "warn",
|
|
197
|
+
"prefer-exponentiation-operator": "warn",
|
|
198
|
+
"prefer-named-capture-group": "warn",
|
|
199
|
+
"prefer-numeric-literals": "warn",
|
|
200
|
+
"prefer-object-has-own": "warn",
|
|
201
|
+
"prefer-object-spread": "warn",
|
|
202
|
+
"prefer-promise-reject-errors": ["warn", { allowEmptyReject: true }],
|
|
203
|
+
"prefer-regex-literals": ["warn", { disallowRedundantWrapping: true }],
|
|
204
|
+
"prefer-rest-params": "warn",
|
|
205
|
+
"prefer-spread": "warn",
|
|
206
|
+
"prefer-template": "warn",
|
|
207
|
+
"preserve-caught-error": "warn",
|
|
208
|
+
"radix": ["error", "as-needed"],
|
|
209
|
+
"require-await": "warn",
|
|
210
|
+
"require-yield": "error",
|
|
211
|
+
"sort-imports": "off",
|
|
212
|
+
"strict": "error",
|
|
213
|
+
"symbol-description": "warn",
|
|
214
|
+
"yoda": "warn"
|
|
163
215
|
};
|
|
164
216
|
}
|
|
165
217
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isEnabled } from "../utils/isEnabled.
|
|
2
|
-
import { defaultOptions } from "../utils/options/defaultOptions.
|
|
1
|
+
import { isEnabled } from "../utils/isEnabled.mjs";
|
|
2
|
+
import { defaultOptions } from "../utils/options/defaultOptions.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/rules/perfectionist.ts
|
|
5
5
|
function getPerfectionistRules(options) {
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
//#region src/rules/playwright.ts
|
|
2
|
+
function getPlaywrightRules(options) {
|
|
3
|
+
const { maxNestedDescribe } = options.configs.test;
|
|
4
|
+
return {
|
|
5
|
+
"playwright/expect-expect": "error",
|
|
6
|
+
"playwright/max-nested-describe": ["warn", { max: maxNestedDescribe }],
|
|
7
|
+
"playwright/missing-playwright-await": "error",
|
|
8
|
+
"playwright/no-commented-out-tests": "error",
|
|
9
|
+
"playwright/no-conditional-expect": "error",
|
|
10
|
+
"playwright/no-conditional-in-test": "error",
|
|
11
|
+
"playwright/no-duplicate-hooks": "error",
|
|
12
|
+
"playwright/no-element-handle": "warn",
|
|
13
|
+
"playwright/no-eval": "error",
|
|
14
|
+
"playwright/no-focused-test": "error",
|
|
15
|
+
"playwright/no-force-option": "warn",
|
|
16
|
+
"playwright/no-get-by-title": "warn",
|
|
17
|
+
"playwright/no-nested-step": "warn",
|
|
18
|
+
"playwright/no-networkidle": "error",
|
|
19
|
+
"playwright/no-page-pause": "error",
|
|
20
|
+
"playwright/no-raw-locators": "warn",
|
|
21
|
+
"playwright/no-skipped-test": "error",
|
|
22
|
+
"playwright/no-slowed-test": "warn",
|
|
23
|
+
"playwright/no-standalone-expect": "error",
|
|
24
|
+
"playwright/no-unsafe-references": "error",
|
|
25
|
+
"playwright/no-unused-locators": "warn",
|
|
26
|
+
"playwright/no-useless-await": "warn",
|
|
27
|
+
"playwright/no-useless-not": "warn",
|
|
28
|
+
"playwright/no-wait-for-selector": "warn",
|
|
29
|
+
"playwright/no-wait-for-timeout": "error",
|
|
30
|
+
"playwright/prefer-comparison-matcher": "warn",
|
|
31
|
+
"playwright/prefer-equality-matcher": "warn",
|
|
32
|
+
"playwright/prefer-hooks-in-order": "warn",
|
|
33
|
+
"playwright/prefer-hooks-on-top": "warn",
|
|
34
|
+
"playwright/prefer-lowercase-title": ["warn", { ignoreTopLevelDescribe: true }],
|
|
35
|
+
"playwright/prefer-native-locators": "warn",
|
|
36
|
+
"playwright/prefer-locator": "error",
|
|
37
|
+
"playwright/prefer-strict-equal": "warn",
|
|
38
|
+
"playwright/prefer-to-be": "warn",
|
|
39
|
+
"playwright/prefer-to-contain": "warn",
|
|
40
|
+
"playwright/prefer-to-have-count": "warn",
|
|
41
|
+
"playwright/prefer-to-have-length": "warn",
|
|
42
|
+
"playwright/prefer-web-first-assertions": "warn",
|
|
43
|
+
"playwright/require-hook": "error",
|
|
44
|
+
"playwright/require-to-throw-message": "error",
|
|
45
|
+
"playwright/valid-describe-callback": "error",
|
|
46
|
+
"playwright/valid-expect-in-promise": "error",
|
|
47
|
+
"playwright/valid-expect": "error",
|
|
48
|
+
"playwright/valid-title": "error",
|
|
49
|
+
"playwright/valid-test-tags": "error"
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
//#endregion
|
|
54
|
+
export { getPlaywrightRules };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
|
|
3
|
+
//#region src/rules/storybook.ts
|
|
4
|
+
function getStorybookRules(options) {
|
|
5
|
+
return {
|
|
6
|
+
"storybook/await-interactions": "error",
|
|
7
|
+
"storybook/context-in-play-function": "error",
|
|
8
|
+
"storybook/csf-component": "error",
|
|
9
|
+
"storybook/default-exports": "error",
|
|
10
|
+
"storybook/hierarchy-separator": "error",
|
|
11
|
+
"storybook/meta-inline-properties": "warn",
|
|
12
|
+
"storybook/meta-satisfies-type": "warn",
|
|
13
|
+
"storybook/no-redundant-story-name": "warn",
|
|
14
|
+
"storybook/no-renderer-packages": "error",
|
|
15
|
+
"storybook/no-stories-of": "error",
|
|
16
|
+
"storybook/no-uninstalled-addons": ["error", { packageJsonLocation: path.resolve(options.packageDir, "package.json") }],
|
|
17
|
+
"storybook/prefer-pascal-case": "warn",
|
|
18
|
+
"storybook/story-exports": "error",
|
|
19
|
+
"storybook/use-storybook-expect": "error",
|
|
20
|
+
"storybook/use-storybook-testing-library": "error"
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
export { getStorybookRules };
|