@shayanthenerd/eslint-config 0.29.4 → 0.30.1
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 +167 -105
- package/dist/configs/astro.mjs +1 -1
- package/dist/configs/{base.mjs → javascript.mjs} +4 -4
- package/dist/configs/typescript.mjs +4 -4
- package/dist/configs/vue.mjs +5 -1
- package/dist/helpers/globs.mjs +9 -9
- package/dist/helpers/options/defaultOptions.mjs +21 -21
- package/dist/helpers/options/enableDetectedConfigs.mjs +4 -4
- package/dist/index.mjs +10 -10
- package/dist/rules/astro.mjs +5 -3
- package/dist/rules/baseline.mjs +2 -2
- package/dist/rules/css.mjs +4 -4
- package/dist/rules/html.mjs +6 -4
- package/dist/rules/importX.mjs +5 -5
- package/dist/rules/javascript.mjs +31 -31
- package/dist/rules/markdown.mjs +1 -1
- package/dist/rules/packageJson.mjs +1 -1
- package/dist/rules/perfectionist.mjs +1 -1
- package/dist/rules/react.mjs +3 -3
- package/dist/rules/tailwind.mjs +3 -3
- package/dist/rules/typescript.mjs +21 -7
- package/dist/rules/unicorn.mjs +2 -3
- package/dist/rules/vue.mjs +42 -42
- package/dist/types/eslint-schema.d.mts +5 -1
- package/dist/types/eslintRules.d.mts +3 -3
- package/dist/types/index.d.mts +13 -13
- package/dist/types/options/react.d.mts +1 -1
- package/dist/types/options/typescript.d.mts +2 -2
- package/dist/types/options/vue.d.mts +1 -1
- package/package.json +21 -14
package/dist/rules/astro.mjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
+
import { isEnabled } from "../utils/isEnabled.mjs";
|
|
1
2
|
//#region src/rules/astro.ts
|
|
2
3
|
const astroRules = {
|
|
3
|
-
"import-x/exports-last": "off",
|
|
4
|
-
"@stylistic/jsx-one-expression-per-line": "off",
|
|
5
4
|
"astro/missing-client-only-directive-value": "error",
|
|
6
5
|
"astro/no-conflict-set-directives": "error",
|
|
7
6
|
"astro/no-deprecated-astro-canonicalurl": "error",
|
|
@@ -54,7 +53,10 @@ const astroRules = {
|
|
|
54
53
|
"astro/jsx-a11y/scope": "error",
|
|
55
54
|
"astro/jsx-a11y/tabindex-no-positive": "warn"
|
|
56
55
|
};
|
|
57
|
-
function getAstroRules() {
|
|
56
|
+
function getAstroRules(options) {
|
|
57
|
+
const { importX, stylistic } = options.configs;
|
|
58
|
+
if (isEnabled(importX)) astroRules["import-x/exports-last"] = "off";
|
|
59
|
+
if (isEnabled(stylistic)) astroRules["@stylistic/jsx-one-expression-per-line"] = "off";
|
|
58
60
|
return astroRules;
|
|
59
61
|
}
|
|
60
62
|
//#endregion
|
package/dist/rules/baseline.mjs
CHANGED
|
@@ -2,8 +2,8 @@ import { isEnabled } from "../utils/isEnabled.mjs";
|
|
|
2
2
|
import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
|
|
3
3
|
//#region src/rules/baseline.ts
|
|
4
4
|
function getBaselineRules(options) {
|
|
5
|
-
const
|
|
6
|
-
const { baseline, javascript: { ignoredFeatures: userIgnoredFeatures, ignoredNodeTypes: userIgnoredNodeTypes } } = isEnabled(
|
|
5
|
+
const baselineOption = options.configs.baseline;
|
|
6
|
+
const { baseline, javascript: { ignoredFeatures: userIgnoredFeatures, ignoredNodeTypes: userIgnoredNodeTypes } } = isEnabled(baselineOption) ? baselineOption : defaultOptions.configs.baseline;
|
|
7
7
|
return {
|
|
8
8
|
"baseline-js/no-atomics-pause": "warn",
|
|
9
9
|
"baseline-js/no-bigint64array": "warn",
|
package/dist/rules/css.mjs
CHANGED
|
@@ -46,8 +46,8 @@ const allowedPhysicalProperties = [
|
|
|
46
46
|
"contain-intrinsic-height"
|
|
47
47
|
];
|
|
48
48
|
function getCssRules(options) {
|
|
49
|
-
const { unicorn, tailwind,
|
|
50
|
-
const { allowedAtRules: userAllowedAtRules, allowedFunctions: userAllowedFunctions, allowedMediaConditions: userAllowedMediaConditions, allowedProperties: userAllowedProperties, allowedPropertyValues: userAllowedPropertyValues, allowedSelectors: userAllowedSelectors, allowedUnits: userAllowedUnits } = isEnabled(
|
|
49
|
+
const { unicorn, tailwind, baseline } = options.configs;
|
|
50
|
+
const { allowedAtRules: userAllowedAtRules, allowedFunctions: userAllowedFunctions, allowedMediaConditions: userAllowedMediaConditions, allowedProperties: userAllowedProperties, allowedPropertyValues: userAllowedPropertyValues, allowedSelectors: userAllowedSelectors, allowedUnits: userAllowedUnits } = isEnabled(baseline) ? baseline.css : defaultOptions.configs.baseline.css;
|
|
51
51
|
const cssRules = {
|
|
52
52
|
"css/font-family-fallbacks": "warn",
|
|
53
53
|
"css/no-duplicate-imports": "error",
|
|
@@ -76,8 +76,8 @@ function getCssRules(options) {
|
|
|
76
76
|
"ric",
|
|
77
77
|
"rlh"
|
|
78
78
|
] }],
|
|
79
|
-
"css/use-baseline": isEnabled(
|
|
80
|
-
available:
|
|
79
|
+
"css/use-baseline": isEnabled(baseline) ? ["warn", {
|
|
80
|
+
available: baseline.baseline,
|
|
81
81
|
allowAtRules: userAllowedAtRules,
|
|
82
82
|
allowFunctions: userAllowedFunctions,
|
|
83
83
|
allowMediaConditions: userAllowedMediaConditions,
|
package/dist/rules/html.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { isEnabled } from "../utils/isEnabled.mjs";
|
|
|
2
2
|
import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
|
|
3
3
|
//#region src/rules/html.ts
|
|
4
4
|
function getHtmlRules(options) {
|
|
5
|
-
const { html, unicorn, tailwind, stylistic,
|
|
5
|
+
const { html, unicorn, tailwind, stylistic, baseline } = options.configs;
|
|
6
6
|
const { idNamingConvention } = isEnabled(html) ? html : defaultOptions.configs.html;
|
|
7
7
|
const { indent, maxLineLength, maxAttributesPerLine, maxConsecutiveEmptyLines, selfCloseVoidHtmlElements } = isEnabled(stylistic) ? stylistic : defaultOptions.configs.stylistic;
|
|
8
8
|
const htmlRules = {
|
|
@@ -32,7 +32,7 @@ function getHtmlRules(options) {
|
|
|
32
32
|
"@html-eslint/require-li-container": "error",
|
|
33
33
|
"@html-eslint/require-meta-charset": "error",
|
|
34
34
|
"@html-eslint/svg-require-viewbox": "error",
|
|
35
|
-
"@html-eslint/use-baseline": isEnabled(
|
|
35
|
+
"@html-eslint/use-baseline": isEnabled(baseline) ? ["warn", { available: baseline.baseline }] : "off",
|
|
36
36
|
"@html-eslint/no-multiple-h1": "error",
|
|
37
37
|
"@html-eslint/require-lang": "error",
|
|
38
38
|
"@html-eslint/require-meta-description": "error",
|
|
@@ -53,7 +53,9 @@ function getHtmlRules(options) {
|
|
|
53
53
|
"@html-eslint/require-frame-title": "error",
|
|
54
54
|
"@html-eslint/require-img-alt": "error",
|
|
55
55
|
"@html-eslint/require-input-label": "error",
|
|
56
|
-
"@html-eslint/require-meta-viewport": "error"
|
|
56
|
+
"@html-eslint/require-meta-viewport": "error"
|
|
57
|
+
};
|
|
58
|
+
if (isEnabled(stylistic)) Object.assign(htmlRules, {
|
|
57
59
|
"@html-eslint/attrs-newline": ["warn", {
|
|
58
60
|
maxLen: maxLineLength,
|
|
59
61
|
ifAttrsMoreThan: maxAttributesPerLine
|
|
@@ -76,7 +78,7 @@ function getHtmlRules(options) {
|
|
|
76
78
|
"double",
|
|
77
79
|
{ enforceTemplatedAttrValue: true }
|
|
78
80
|
]
|
|
79
|
-
};
|
|
81
|
+
});
|
|
80
82
|
if (isEnabled(tailwind)) htmlRules["better-tailwindcss/no-duplicate-classes"] = "off";
|
|
81
83
|
if (isEnabled(unicorn)) htmlRules["unicorn/no-invalid-file-input-accept"] = "error";
|
|
82
84
|
return htmlRules;
|
package/dist/rules/importX.mjs
CHANGED
|
@@ -3,9 +3,9 @@ import path from "node:path";
|
|
|
3
3
|
//#region src/rules/importX.ts
|
|
4
4
|
function getImportXRules(options) {
|
|
5
5
|
const { packageDir, configs: { typescript } } = options;
|
|
6
|
-
const
|
|
6
|
+
const isTypescriptEnabled = isEnabled(typescript);
|
|
7
7
|
return {
|
|
8
|
-
"import-x/export":
|
|
8
|
+
"import-x/export": isTypescriptEnabled ? "off" : "error",
|
|
9
9
|
"import-x/no-deprecated": "warn",
|
|
10
10
|
"import-x/no-empty-named-blocks": "error",
|
|
11
11
|
"import-x/no-extraneous-dependencies": ["error", {
|
|
@@ -17,8 +17,8 @@ function getImportXRules(options) {
|
|
|
17
17
|
"import-x/no-amd": "error",
|
|
18
18
|
"import-x/no-commonjs": "error",
|
|
19
19
|
"import-x/no-import-module-exports": "error",
|
|
20
|
-
"import-x/named":
|
|
21
|
-
"import-x/default":
|
|
20
|
+
"import-x/named": isTypescriptEnabled ? "off" : "error",
|
|
21
|
+
"import-x/default": isTypescriptEnabled ? "off" : "error",
|
|
22
22
|
"import-x/namespace": ["error", { allowComputed: true }],
|
|
23
23
|
"import-x/no-absolute-path": "warn",
|
|
24
24
|
"import-x/no-cycle": ["error", {
|
|
@@ -26,7 +26,7 @@ function getImportXRules(options) {
|
|
|
26
26
|
ignoreExternal: true
|
|
27
27
|
}],
|
|
28
28
|
"import-x/no-self-import": "error",
|
|
29
|
-
"import-x/no-unresolved":
|
|
29
|
+
"import-x/no-unresolved": isTypescriptEnabled ? "off" : "error",
|
|
30
30
|
"import-x/no-useless-path-segments": "error",
|
|
31
31
|
"import-x/consistent-type-specifier-style": "warn",
|
|
32
32
|
"import-x/exports-last": "warn",
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
import { isEnabled } from "../utils/isEnabled.mjs";
|
|
2
2
|
//#region src/rules/javascript.ts
|
|
3
3
|
function getJavaScriptRules(options) {
|
|
4
|
-
const { unicorn, typescript,
|
|
4
|
+
const { unicorn, typescript, javascript: { maxDepth, maxNestedCallbacks } } = options.configs;
|
|
5
5
|
const isUnicornEnabled = isEnabled(unicorn);
|
|
6
|
-
const
|
|
6
|
+
const isTypescriptEnabled = isEnabled(typescript);
|
|
7
7
|
return {
|
|
8
8
|
"array-callback-return": "error",
|
|
9
|
-
"constructor-super":
|
|
9
|
+
"constructor-super": isTypescriptEnabled ? "off" : "error",
|
|
10
10
|
"for-direction": "error",
|
|
11
|
-
"getter-return":
|
|
11
|
+
"getter-return": isTypescriptEnabled ? "off" : ["error", { allowImplicit: true }],
|
|
12
12
|
"no-async-promise-executor": "error",
|
|
13
13
|
"no-await-in-loop": "error",
|
|
14
14
|
"no-case-declarations": "error",
|
|
15
|
-
"no-class-assign":
|
|
15
|
+
"no-class-assign": isTypescriptEnabled ? "off" : "error",
|
|
16
16
|
"no-compare-neg-zero": "error",
|
|
17
17
|
"no-cond-assign": "error",
|
|
18
|
-
"no-const-assign":
|
|
18
|
+
"no-const-assign": isTypescriptEnabled ? "off" : "error",
|
|
19
19
|
"no-constant-binary-expression": ["error", { checkRelationalComparisons: true }],
|
|
20
20
|
"no-constant-condition": "error",
|
|
21
21
|
"no-constructor-return": "error",
|
|
22
22
|
"no-control-regex": "error",
|
|
23
23
|
"no-debugger": "error",
|
|
24
24
|
"no-delete-var": "error",
|
|
25
|
-
"no-dupe-args":
|
|
26
|
-
"no-dupe-class-members":
|
|
25
|
+
"no-dupe-args": isTypescriptEnabled ? "off" : "error",
|
|
26
|
+
"no-dupe-class-members": isTypescriptEnabled ? "off" : "error",
|
|
27
27
|
"no-dupe-else-if": "error",
|
|
28
|
-
"no-dupe-keys":
|
|
28
|
+
"no-dupe-keys": isTypescriptEnabled ? "off" : "error",
|
|
29
29
|
"no-duplicate-case": "error",
|
|
30
30
|
"no-duplicate-imports": ["error", {
|
|
31
31
|
includeExports: true,
|
|
@@ -36,9 +36,9 @@ function getJavaScriptRules(options) {
|
|
|
36
36
|
"no-empty-static-block": "error",
|
|
37
37
|
"no-ex-assign": "error",
|
|
38
38
|
"no-fallthrough": "error",
|
|
39
|
-
"no-func-assign":
|
|
39
|
+
"no-func-assign": isTypescriptEnabled ? "off" : "error",
|
|
40
40
|
"no-global-assign": "error",
|
|
41
|
-
"no-import-assign":
|
|
41
|
+
"no-import-assign": isTypescriptEnabled ? "off" : "error",
|
|
42
42
|
"no-inner-declarations": "warn",
|
|
43
43
|
"no-invalid-regexp": "error",
|
|
44
44
|
"no-irregular-whitespace": "warn",
|
|
@@ -48,11 +48,11 @@ function getJavaScriptRules(options) {
|
|
|
48
48
|
"no-self-compare": "warn",
|
|
49
49
|
"no-template-curly-in-string": "error",
|
|
50
50
|
"no-unassigned-vars": "error",
|
|
51
|
-
"no-unmodified-loop-condition": "
|
|
51
|
+
"no-unmodified-loop-condition": ["warn", { checkConditionalExpressions: true }],
|
|
52
52
|
"no-unreachable-loop": "warn",
|
|
53
|
-
"no-unsafe-negation":
|
|
53
|
+
"no-unsafe-negation": isTypescriptEnabled ? "off" : ["error", { enforceForOrderingRelations: true }],
|
|
54
54
|
"no-unsafe-optional-chaining": ["error", { disallowArithmeticOperators: true }],
|
|
55
|
-
"no-unused-vars": [
|
|
55
|
+
"no-unused-vars": [isTypescriptEnabled ? "off" : "error", {
|
|
56
56
|
args: "all",
|
|
57
57
|
argsIgnorePattern: "^_",
|
|
58
58
|
varsIgnorePattern: "^_",
|
|
@@ -79,13 +79,13 @@ function getJavaScriptRules(options) {
|
|
|
79
79
|
ignoreClassesWithImplements: "public-fields"
|
|
80
80
|
}],
|
|
81
81
|
"complexity": "warn",
|
|
82
|
-
"consistent-return":
|
|
82
|
+
"consistent-return": isTypescriptEnabled ? "off" : "error",
|
|
83
83
|
"consistent-this": "error",
|
|
84
84
|
"curly": "warn",
|
|
85
|
-
"default-case":
|
|
85
|
+
"default-case": isTypescriptEnabled ? "off" : "warn",
|
|
86
86
|
"default-case-last": "warn",
|
|
87
|
-
"default-param-last":
|
|
88
|
-
"dot-notation":
|
|
87
|
+
"default-param-last": isTypescriptEnabled ? "off" : "warn",
|
|
88
|
+
"dot-notation": isTypescriptEnabled ? "off" : "warn",
|
|
89
89
|
"eqeqeq": "error",
|
|
90
90
|
"func-name-matching": "warn",
|
|
91
91
|
"func-names": ["warn", "as-needed"],
|
|
@@ -112,7 +112,7 @@ function getJavaScriptRules(options) {
|
|
|
112
112
|
"groupEnd",
|
|
113
113
|
"groupCollapsed"
|
|
114
114
|
] }],
|
|
115
|
-
"no-empty": "warn",
|
|
115
|
+
"no-empty": ["warn", { allowEmptyCatch: true }],
|
|
116
116
|
"no-empty-function": ["error", { allow: [
|
|
117
117
|
"overrideMethods",
|
|
118
118
|
"decoratedFunctions",
|
|
@@ -127,8 +127,8 @@ function getJavaScriptRules(options) {
|
|
|
127
127
|
"no-extra-label": "error",
|
|
128
128
|
"no-implicit-coercion": "error",
|
|
129
129
|
"no-implicit-globals": "error",
|
|
130
|
-
"no-implied-eval":
|
|
131
|
-
"no-invalid-this":
|
|
130
|
+
"no-implied-eval": isTypescriptEnabled ? "off" : "error",
|
|
131
|
+
"no-invalid-this": isTypescriptEnabled ? "off" : "error",
|
|
132
132
|
"no-iterator": "warn",
|
|
133
133
|
"no-label-var": "error",
|
|
134
134
|
"no-lone-blocks": "error",
|
|
@@ -140,10 +140,10 @@ function getJavaScriptRules(options) {
|
|
|
140
140
|
"no-nested-ternary": isUnicornEnabled ? "off" : "warn",
|
|
141
141
|
"no-new": "error",
|
|
142
142
|
"no-new-func": "error",
|
|
143
|
-
"no-new-native-nonconstructor":
|
|
143
|
+
"no-new-native-nonconstructor": isTypescriptEnabled || isUnicornEnabled ? "off" : "error",
|
|
144
144
|
"no-new-wrappers": "error",
|
|
145
145
|
"no-nonoctal-decimal-escape": "error",
|
|
146
|
-
"no-obj-calls":
|
|
146
|
+
"no-obj-calls": isTypescriptEnabled ? "off" : "error",
|
|
147
147
|
"no-object-constructor": "error",
|
|
148
148
|
"no-octal": "error",
|
|
149
149
|
"no-octal-escape": "error",
|
|
@@ -156,7 +156,7 @@ function getJavaScriptRules(options) {
|
|
|
156
156
|
"no-script-url": "error",
|
|
157
157
|
"no-self-assign": "error",
|
|
158
158
|
"no-sequences": ["error", { allowInParentheses: false }],
|
|
159
|
-
"no-setter-return":
|
|
159
|
+
"no-setter-return": isTypescriptEnabled ? "off" : "error",
|
|
160
160
|
"no-shadow": ["error", {
|
|
161
161
|
hoist: "all",
|
|
162
162
|
builtinGlobals: true,
|
|
@@ -170,13 +170,13 @@ function getJavaScriptRules(options) {
|
|
|
170
170
|
}],
|
|
171
171
|
"no-shadow-restricted-names": "warn",
|
|
172
172
|
"no-sparse-arrays": "error",
|
|
173
|
-
"no-this-before-super":
|
|
173
|
+
"no-this-before-super": isTypescriptEnabled ? "off" : "error",
|
|
174
174
|
"no-throw-literal": "error",
|
|
175
|
-
"no-undef":
|
|
175
|
+
"no-undef": isTypescriptEnabled ? "off" : "error",
|
|
176
176
|
"no-undef-init": "error",
|
|
177
177
|
"no-unexpected-multiline": "error",
|
|
178
178
|
"no-unneeded-ternary": "error",
|
|
179
|
-
"no-unreachable":
|
|
179
|
+
"no-unreachable": isTypescriptEnabled ? "off" : "error",
|
|
180
180
|
"no-unsafe-finally": "error",
|
|
181
181
|
"no-unused-expressions": ["error", {
|
|
182
182
|
allowTernary: true,
|
|
@@ -185,7 +185,7 @@ function getJavaScriptRules(options) {
|
|
|
185
185
|
allowTaggedTemplates: true
|
|
186
186
|
}],
|
|
187
187
|
"no-unused-labels": "error",
|
|
188
|
-
"no-unused-private-class-members":
|
|
188
|
+
"no-unused-private-class-members": isTypescriptEnabled ? "off" : "error",
|
|
189
189
|
"no-useless-backreference": "error",
|
|
190
190
|
"no-useless-call": "error",
|
|
191
191
|
"no-useless-catch": "error",
|
|
@@ -202,7 +202,7 @@ function getJavaScriptRules(options) {
|
|
|
202
202
|
"operator-assignment": "warn",
|
|
203
203
|
"prefer-arrow-callback": ["warn", { allowUnboundThis: true }],
|
|
204
204
|
"prefer-const": "error",
|
|
205
|
-
"prefer-destructuring":
|
|
205
|
+
"prefer-destructuring": isTypescriptEnabled ? "off" : ["warn", {
|
|
206
206
|
object: true,
|
|
207
207
|
array: false
|
|
208
208
|
}],
|
|
@@ -211,14 +211,14 @@ function getJavaScriptRules(options) {
|
|
|
211
211
|
"prefer-numeric-literals": "warn",
|
|
212
212
|
"prefer-object-has-own": "warn",
|
|
213
213
|
"prefer-object-spread": "warn",
|
|
214
|
-
"prefer-promise-reject-errors":
|
|
214
|
+
"prefer-promise-reject-errors": isTypescriptEnabled ? "off" : ["warn", { allowEmptyReject: true }],
|
|
215
215
|
"prefer-regex-literals": ["warn", { disallowRedundantWrapping: true }],
|
|
216
216
|
"prefer-rest-params": "warn",
|
|
217
217
|
"prefer-spread": "warn",
|
|
218
218
|
"prefer-template": "warn",
|
|
219
219
|
"preserve-caught-error": "warn",
|
|
220
220
|
"radix": "warn",
|
|
221
|
-
"require-await":
|
|
221
|
+
"require-await": isTypescriptEnabled ? "off" : "warn",
|
|
222
222
|
"require-yield": "error",
|
|
223
223
|
"strict": "error",
|
|
224
224
|
"symbol-description": "warn",
|
package/dist/rules/markdown.mjs
CHANGED
|
@@ -45,7 +45,7 @@ function getMarkdownRules(options) {
|
|
|
45
45
|
"markdown/no-space-in-emphasis": ["warn", { checkStrikethrough: !isCommonMark }],
|
|
46
46
|
"markdown/no-unused-definitions": isCommonMark ? "off" : "warn",
|
|
47
47
|
"markdown/require-alt-text": "warn",
|
|
48
|
-
"markdown/table-column-count":
|
|
48
|
+
"markdown/table-column-count": isCommonMark ? "off" : ["error", { checkMissingCells: true }]
|
|
49
49
|
};
|
|
50
50
|
if (isEnabled(unicorn)) markdownRules["unicorn/no-missing-local-resource"] = "error";
|
|
51
51
|
return markdownRules;
|
|
@@ -12,7 +12,7 @@ const packageJsonRules = {
|
|
|
12
12
|
"package-json/require-bugs": "warn",
|
|
13
13
|
"package-json/require-description": ["warn", { ignorePrivate: true }],
|
|
14
14
|
"package-json/require-devEngines": "warn",
|
|
15
|
-
"package-json/require-engines": "warn",
|
|
15
|
+
"package-json/require-engines": ["warn", { ignorePrivate: true }],
|
|
16
16
|
"package-json/require-exports": ["error", { ignorePrivate: true }],
|
|
17
17
|
"package-json/require-files": ["error", { ignorePrivate: true }],
|
|
18
18
|
"package-json/require-homepage": "warn",
|
|
@@ -121,7 +121,7 @@ function getPerfectionistRules(options) {
|
|
|
121
121
|
"perfectionist/sort-named-imports": "warn",
|
|
122
122
|
"perfectionist/sort-named-exports": "warn",
|
|
123
123
|
"perfectionist/sort-imports": ["warn", {
|
|
124
|
-
environment: env === "bun" ?
|
|
124
|
+
environment: env === "bun" ? env : "node",
|
|
125
125
|
tsconfig: tsConfig || { rootDir: "" },
|
|
126
126
|
sortSideEffects: true,
|
|
127
127
|
fallbackSort: {
|
package/dist/rules/react.mjs
CHANGED
|
@@ -14,7 +14,7 @@ const commonCallees = [
|
|
|
14
14
|
"ctl"
|
|
15
15
|
];
|
|
16
16
|
function getReactRules(options) {
|
|
17
|
-
const { react, unicorn, tailwind,
|
|
17
|
+
const { react, unicorn, tailwind, baseline, stylistic } = options.configs;
|
|
18
18
|
const { imageComponents: userImageComponents, anchorComponents: userAnchorComponents, headingComponents: userHeadingComponents } = isEnabled(react) && isEnabled(react.accessibility) ? react.accessibility : defaultOptions.configs.react.accessibility;
|
|
19
19
|
const jsxA11yRules = {
|
|
20
20
|
"jsx-a11y/alt-text": ["error", { img: userImageComponents }],
|
|
@@ -146,11 +146,11 @@ function getReactRules(options) {
|
|
|
146
146
|
"@eslint-react/naming-convention-ref-name": "warn",
|
|
147
147
|
/*** @html-eslint/react ***/
|
|
148
148
|
"@html-eslint/react/no-invalid-attr-value": "error",
|
|
149
|
-
"@html-eslint/react/use-baseline": isEnabled(
|
|
149
|
+
"@html-eslint/react/use-baseline": isEnabled(baseline) ? ["warn", { available: baseline.baseline }] : "off",
|
|
150
150
|
"@html-eslint/react/no-ineffective-attrs": "warn",
|
|
151
151
|
"@html-eslint/react/no-obsolete-attrs": "error",
|
|
152
152
|
"@html-eslint/react/no-obsolete-tags": "error",
|
|
153
|
-
"@html-eslint/react/classname-spacing": ["warn", { callees: commonCallees }],
|
|
153
|
+
"@html-eslint/react/classname-spacing": isEnabled(stylistic) ? ["warn", { callees: commonCallees }] : "off",
|
|
154
154
|
"@html-eslint/react/no-duplicate-classname": ["warn", { callees: commonCallees }]
|
|
155
155
|
};
|
|
156
156
|
if (isEnabled(tailwind)) reactAndHtmlReactRules["better-tailwindcss/no-duplicate-classes"] = "off";
|
package/dist/rules/tailwind.mjs
CHANGED
|
@@ -36,20 +36,20 @@ function getTailwindRules(options) {
|
|
|
36
36
|
return {
|
|
37
37
|
"better-tailwindcss/enforce-canonical-classes": "warn",
|
|
38
38
|
"better-tailwindcss/enforce-consistent-class-order": "warn",
|
|
39
|
-
"better-tailwindcss/enforce-consistent-line-wrapping":
|
|
39
|
+
"better-tailwindcss/enforce-consistent-line-wrapping": multilineSort && isEnabled(stylistic) ? ["warn", {
|
|
40
40
|
indent,
|
|
41
41
|
tabWidth: indent,
|
|
42
42
|
strictness: "loose",
|
|
43
43
|
preferSingleLine: true,
|
|
44
44
|
printWidth: maxLineLength
|
|
45
|
-
}],
|
|
45
|
+
}] : "off",
|
|
46
46
|
"better-tailwindcss/enforce-consistent-variant-order": "warn",
|
|
47
47
|
"better-tailwindcss/enforce-logical-properties": ["warn", { ignore: nonLogicalTailwindUtilityPatterns }],
|
|
48
48
|
"better-tailwindcss/no-concatenated-classes": "error",
|
|
49
49
|
"better-tailwindcss/no-conflicting-classes": "error",
|
|
50
50
|
"better-tailwindcss/no-deprecated-classes": "error",
|
|
51
51
|
"better-tailwindcss/no-duplicate-classes": "error",
|
|
52
|
-
"better-tailwindcss/no-unknown-classes":
|
|
52
|
+
"better-tailwindcss/no-unknown-classes": isTailwindV4 ? ["warn", { ignore: userIgnoredUnknownClasses }] : "off",
|
|
53
53
|
"better-tailwindcss/no-unnecessary-whitespace": "warn"
|
|
54
54
|
};
|
|
55
55
|
}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { isEnabled } from "../utils/isEnabled.mjs";
|
|
2
2
|
import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
|
|
3
|
-
import { getJavaScriptRules } from "./javascript.mjs";
|
|
4
3
|
//#region src/rules/typescript.ts
|
|
5
|
-
function
|
|
4
|
+
function getTypescriptRules(options) {
|
|
6
5
|
const { typescript } = options.configs;
|
|
7
6
|
const { removeUnusedImports, typeDefinitionStyle, methodSignatureStyle } = isEnabled(typescript) ? typescript : defaultOptions.configs.typescript;
|
|
8
|
-
const noUnusedVarsOptions = getJavaScriptRules(options)["no-unused-vars"][1];
|
|
9
|
-
const preferDestructuringOptions = getJavaScriptRules(options)["prefer-destructuring"][1];
|
|
10
7
|
return {
|
|
11
8
|
"@typescript-eslint/await-thenable": "error",
|
|
12
9
|
"@typescript-eslint/ban-ts-comment": ["warn", { "ts-expect-error": { descriptionFormat: "^ -- .+ $" } }],
|
|
@@ -58,7 +55,11 @@ function getTypeScriptRules(options) {
|
|
|
58
55
|
"@typescript-eslint/no-unsafe-return": "error",
|
|
59
56
|
"@typescript-eslint/no-unsafe-unary-minus": "error",
|
|
60
57
|
"@typescript-eslint/no-unused-vars": ["error", {
|
|
61
|
-
|
|
58
|
+
args: "all",
|
|
59
|
+
argsIgnorePattern: "^_",
|
|
60
|
+
varsIgnorePattern: "^_",
|
|
61
|
+
caughtErrorsIgnorePattern: "^_",
|
|
62
|
+
destructuredArrayIgnorePattern: "^_",
|
|
62
63
|
enableAutofixRemoval: { imports: removeUnusedImports }
|
|
63
64
|
}],
|
|
64
65
|
"@typescript-eslint/no-useless-default-assignment": "warn",
|
|
@@ -99,7 +100,10 @@ function getTypeScriptRules(options) {
|
|
|
99
100
|
"@typescript-eslint/prefer-regexp-exec": "warn",
|
|
100
101
|
"@typescript-eslint/prefer-string-starts-ends-with": "warn",
|
|
101
102
|
"@typescript-eslint/default-param-last": "warn",
|
|
102
|
-
"@typescript-eslint/prefer-destructuring": ["warn",
|
|
103
|
+
"@typescript-eslint/prefer-destructuring": ["warn", {
|
|
104
|
+
object: true,
|
|
105
|
+
array: false
|
|
106
|
+
}],
|
|
103
107
|
"@typescript-eslint/promise-function-async": "error",
|
|
104
108
|
"@typescript-eslint/consistent-type-imports": "warn",
|
|
105
109
|
"@typescript-eslint/no-useless-empty-export": "error",
|
|
@@ -116,6 +120,16 @@ function getTypeScriptRules(options) {
|
|
|
116
120
|
"@typescript-eslint/method-signature-style": ["warn", methodSignatureStyle],
|
|
117
121
|
"@typescript-eslint/naming-convention": [
|
|
118
122
|
"warn",
|
|
123
|
+
{
|
|
124
|
+
selector: "variable",
|
|
125
|
+
modifiers: ["destructured"],
|
|
126
|
+
format: [
|
|
127
|
+
"camelCase",
|
|
128
|
+
"PascalCase",
|
|
129
|
+
"UPPER_CASE"
|
|
130
|
+
],
|
|
131
|
+
leadingUnderscore: "allow"
|
|
132
|
+
},
|
|
119
133
|
{
|
|
120
134
|
selector: "variable",
|
|
121
135
|
format: [
|
|
@@ -146,4 +160,4 @@ function getTypeScriptRules(options) {
|
|
|
146
160
|
};
|
|
147
161
|
}
|
|
148
162
|
//#endregion
|
|
149
|
-
export {
|
|
163
|
+
export { getTypescriptRules };
|
package/dist/rules/unicorn.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { isEnabled } from "../utils/isEnabled.mjs";
|
|
|
2
2
|
import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
|
|
3
3
|
//#region src/rules/unicorn.ts
|
|
4
4
|
function getUnicornRules(options) {
|
|
5
|
-
const { unicorn } = options.configs;
|
|
5
|
+
const { unicorn, stylistic } = options.configs;
|
|
6
6
|
const { functionStyle } = isEnabled(unicorn) ? unicorn : defaultOptions.configs.unicorn;
|
|
7
7
|
return {
|
|
8
8
|
"unicorn/better-dom-traversing": "warn",
|
|
@@ -23,7 +23,7 @@ function getUnicornRules(options) {
|
|
|
23
23
|
"unicorn/consistent-tuple-labels": "warn",
|
|
24
24
|
"unicorn/custom-error-definition": "error",
|
|
25
25
|
"unicorn/dom-node-dataset": "warn",
|
|
26
|
-
"unicorn/empty-brace-spaces": "warn",
|
|
26
|
+
"unicorn/empty-brace-spaces": isEnabled(stylistic) ? "warn" : "off",
|
|
27
27
|
"unicorn/error-message": "error",
|
|
28
28
|
"unicorn/escape-case": "warn",
|
|
29
29
|
"unicorn/explicit-length-check": "warn",
|
|
@@ -257,7 +257,6 @@ function getUnicornRules(options) {
|
|
|
257
257
|
"unicorn/require-module-specifiers": "error",
|
|
258
258
|
"unicorn/require-number-to-fixed-digits-argument": "warn",
|
|
259
259
|
"unicorn/require-passive-events": "warn",
|
|
260
|
-
"unicorn/require-post-message-target-origin": "error",
|
|
261
260
|
"unicorn/require-proxy-trap-boolean-return": "error",
|
|
262
261
|
"unicorn/switch-case-braces": "warn",
|
|
263
262
|
"unicorn/switch-case-break-position": "error",
|
package/dist/rules/vue.mjs
CHANGED
|
@@ -144,21 +144,21 @@ function getVueRules(options) {
|
|
|
144
144
|
"vue/valid-v-text": "error",
|
|
145
145
|
"vue/attribute-hyphenation": ["warn", attributeHyphenation],
|
|
146
146
|
"vue/component-definition-name-casing": "warn",
|
|
147
|
-
"vue/first-attribute-linebreak": "warn",
|
|
148
|
-
"vue/html-closing-bracket-newline": "warn",
|
|
149
|
-
"vue/html-closing-bracket-spacing": "warn",
|
|
147
|
+
"vue/first-attribute-linebreak": isEnabled(stylistic) ? "warn" : "off",
|
|
148
|
+
"vue/html-closing-bracket-newline": isEnabled(stylistic) ? "warn" : "off",
|
|
149
|
+
"vue/html-closing-bracket-spacing": isEnabled(stylistic) ? "warn" : "off",
|
|
150
150
|
"vue/html-end-tags": "warn",
|
|
151
|
-
"vue/html-indent": ["warn", indent],
|
|
152
|
-
"vue/html-quotes": "warn",
|
|
153
|
-
"vue/html-self-closing": ["error", { html: {
|
|
151
|
+
"vue/html-indent": isEnabled(stylistic) ? ["warn", indent] : "off",
|
|
152
|
+
"vue/html-quotes": isEnabled(stylistic) ? "warn" : "off",
|
|
153
|
+
"vue/html-self-closing": isEnabled(stylistic) ? ["error", { html: {
|
|
154
154
|
normal: "never",
|
|
155
155
|
void: selfCloseVoidHtmlElements
|
|
156
|
-
} }],
|
|
157
|
-
"vue/max-attributes-per-line": ["warn", { singleline: { max: maxAttributesPerLine } }],
|
|
158
|
-
"vue/multiline-html-element-content-newline": "warn",
|
|
159
|
-
"vue/mustache-interpolation-spacing": "warn",
|
|
160
|
-
"vue/no-multi-spaces": "warn",
|
|
161
|
-
"vue/no-spaces-around-equal-signs-in-attribute": "warn",
|
|
156
|
+
} }] : "off",
|
|
157
|
+
"vue/max-attributes-per-line": isEnabled(stylistic) ? ["warn", { singleline: { max: maxAttributesPerLine } }] : "off",
|
|
158
|
+
"vue/multiline-html-element-content-newline": isEnabled(stylistic) ? "warn" : "off",
|
|
159
|
+
"vue/mustache-interpolation-spacing": isEnabled(stylistic) ? "warn" : "off",
|
|
160
|
+
"vue/no-multi-spaces": isEnabled(stylistic) ? "warn" : "off",
|
|
161
|
+
"vue/no-spaces-around-equal-signs-in-attribute": isEnabled(stylistic) ? "warn" : "off",
|
|
162
162
|
"vue/no-template-shadow": "error",
|
|
163
163
|
"vue/one-component-per-file": "error",
|
|
164
164
|
"vue/prop-name-casing": "warn",
|
|
@@ -182,29 +182,29 @@ function getVueRules(options) {
|
|
|
182
182
|
"vue/no-v-html": ["warn", { ignorePattern: "^html" }],
|
|
183
183
|
"vue/order-in-components": "warn",
|
|
184
184
|
"vue/this-in-template": "warn",
|
|
185
|
-
"vue/array-bracket-newline": ["warn", "consistent"],
|
|
186
|
-
"vue/array-bracket-spacing": "warn",
|
|
187
|
-
"vue/arrow-spacing": "warn",
|
|
188
|
-
"vue/block-spacing": "warn",
|
|
189
|
-
"vue/brace-style": [
|
|
185
|
+
"vue/array-bracket-newline": isEnabled(stylistic) ? ["warn", "consistent"] : "off",
|
|
186
|
+
"vue/array-bracket-spacing": isEnabled(stylistic) ? "warn" : "off",
|
|
187
|
+
"vue/arrow-spacing": isEnabled(stylistic) ? "warn" : "off",
|
|
188
|
+
"vue/block-spacing": isEnabled(stylistic) ? "warn" : "off",
|
|
189
|
+
"vue/brace-style": isEnabled(stylistic) ? [
|
|
190
190
|
"warn",
|
|
191
191
|
"1tbs",
|
|
192
192
|
{ allowSingleLine: true }
|
|
193
|
-
],
|
|
193
|
+
] : "off",
|
|
194
194
|
"vue/camelcase": ["warn", {
|
|
195
195
|
properties: "never",
|
|
196
196
|
ignoreImports: true,
|
|
197
197
|
ignoreDestructuring: true
|
|
198
198
|
}],
|
|
199
|
-
"vue/comma-dangle": ["warn", trailingComma],
|
|
200
|
-
"vue/comma-spacing": "warn",
|
|
201
|
-
"vue/comma-style": "warn",
|
|
199
|
+
"vue/comma-dangle": isEnabled(stylistic) ? ["warn", trailingComma] : "off",
|
|
200
|
+
"vue/comma-spacing": isEnabled(stylistic) ? "warn" : "off",
|
|
201
|
+
"vue/comma-style": isEnabled(stylistic) ? "warn" : "off",
|
|
202
202
|
"vue/dot-notation": "warn",
|
|
203
203
|
"vue/eqeqeq": "error",
|
|
204
|
-
"vue/func-call-spacing": "warn",
|
|
205
|
-
"vue/key-spacing": "warn",
|
|
206
|
-
"vue/keyword-spacing": "warn",
|
|
207
|
-
"vue/max-len": ["warn", {
|
|
204
|
+
"vue/func-call-spacing": isEnabled(stylistic) ? "warn" : "off",
|
|
205
|
+
"vue/key-spacing": isEnabled(stylistic) ? "warn" : "off",
|
|
206
|
+
"vue/keyword-spacing": isEnabled(stylistic) ? "warn" : "off",
|
|
207
|
+
"vue/max-len": isEnabled(stylistic) ? ["warn", {
|
|
208
208
|
tabWidth: indent,
|
|
209
209
|
code: maxLineLength,
|
|
210
210
|
template: templateMaxLineLength,
|
|
@@ -217,8 +217,8 @@ function getVueRules(options) {
|
|
|
217
217
|
ignoreTemplateLiterals: true,
|
|
218
218
|
ignoreHTMLTextContents: true,
|
|
219
219
|
ignoreHTMLAttributeValues: true
|
|
220
|
-
}],
|
|
221
|
-
"vue/multiline-ternary": ["warn", "always-multiline"],
|
|
220
|
+
}] : "off",
|
|
221
|
+
"vue/multiline-ternary": isEnabled(stylistic) ? ["warn", "always-multiline"] : "off",
|
|
222
222
|
"vue/no-console": ["warn", { allow: [
|
|
223
223
|
"info",
|
|
224
224
|
"warn",
|
|
@@ -235,15 +235,15 @@ function getVueRules(options) {
|
|
|
235
235
|
"vue/no-loss-of-precision": "error",
|
|
236
236
|
"vue/no-sparse-arrays": "error",
|
|
237
237
|
"vue/no-useless-concat": "error",
|
|
238
|
-
"vue/object-curly-newline": ["warn", {
|
|
238
|
+
"vue/object-curly-newline": isEnabled(stylistic) ? ["warn", {
|
|
239
239
|
multiline: true,
|
|
240
240
|
consistent: true
|
|
241
|
-
}],
|
|
242
|
-
"vue/object-curly-spacing": ["warn", "always"],
|
|
243
|
-
"vue/object-property-newline": ["warn", { allowAllPropertiesOnSameLine: true }],
|
|
241
|
+
}] : "off",
|
|
242
|
+
"vue/object-curly-spacing": isEnabled(stylistic) ? ["warn", "always"] : "off",
|
|
243
|
+
"vue/object-property-newline": isEnabled(stylistic) ? ["warn", { allowAllPropertiesOnSameLine: true }] : "off",
|
|
244
244
|
"vue/object-shorthand": "warn",
|
|
245
|
-
"vue/operator-linebreak": [
|
|
246
|
-
"
|
|
245
|
+
"vue/operator-linebreak": isEnabled(stylistic) ? [
|
|
246
|
+
"warn",
|
|
247
247
|
"none",
|
|
248
248
|
{ overrides: {
|
|
249
249
|
"=": "after",
|
|
@@ -252,13 +252,13 @@ function getVueRules(options) {
|
|
|
252
252
|
"|": "before",
|
|
253
253
|
"&": "before"
|
|
254
254
|
} }
|
|
255
|
-
],
|
|
255
|
+
] : "off",
|
|
256
256
|
"vue/prefer-template": "warn",
|
|
257
|
-
"vue/quote-props": ["warn", "consistent-as-needed"],
|
|
258
|
-
"vue/space-in-parens": "warn",
|
|
259
|
-
"vue/space-infix-ops": "warn",
|
|
260
|
-
"vue/space-unary-ops": "warn",
|
|
261
|
-
"vue/template-curly-spacing": "warn",
|
|
257
|
+
"vue/quote-props": isEnabled(stylistic) ? ["warn", "consistent-as-needed"] : "off",
|
|
258
|
+
"vue/space-in-parens": isEnabled(stylistic) ? "warn" : "off",
|
|
259
|
+
"vue/space-infix-ops": isEnabled(stylistic) ? "warn" : "off",
|
|
260
|
+
"vue/space-unary-ops": isEnabled(stylistic) ? "warn" : "off",
|
|
261
|
+
"vue/template-curly-spacing": isEnabled(stylistic) ? "warn" : "off",
|
|
262
262
|
"vue/block-lang": ["error", {
|
|
263
263
|
script: { lang: blockLang.script },
|
|
264
264
|
style: {
|
|
@@ -287,9 +287,9 @@ function getVueRules(options) {
|
|
|
287
287
|
"vue/define-props-destructuring": ["warn", { destructure: destructureProps }],
|
|
288
288
|
"vue/enforce-style-attribute": ["error", { allow: allowedStyleAttributes }],
|
|
289
289
|
"vue/html-button-has-type": "error",
|
|
290
|
-
"vue/html-comment-content-newline": "warn",
|
|
291
|
-
"vue/html-comment-content-spacing": "warn",
|
|
292
|
-
"vue/html-comment-indent": ["warn", indent],
|
|
290
|
+
"vue/html-comment-content-newline": isEnabled(stylistic) ? "warn" : "off",
|
|
291
|
+
"vue/html-comment-content-spacing": isEnabled(stylistic) ? "warn" : "off",
|
|
292
|
+
"vue/html-comment-indent": isEnabled(stylistic) ? ["warn", indent] : "off",
|
|
293
293
|
"vue/match-component-file-name": ["error", {
|
|
294
294
|
shouldMatchCase: true,
|
|
295
295
|
extensions: isEnabled(typescript) ? [
|
|
@@ -4740,7 +4740,7 @@ interface ESLintSchema {
|
|
|
4740
4740
|
* Disallow unmodified loop conditions
|
|
4741
4741
|
* @see https://eslint.org/docs/latest/rules/no-unmodified-loop-condition
|
|
4742
4742
|
*/
|
|
4743
|
-
'no-unmodified-loop-condition'?: Linter.RuleEntry<
|
|
4743
|
+
'no-unmodified-loop-condition'?: Linter.RuleEntry<NoUnmodifiedLoopCondition>;
|
|
4744
4744
|
/**
|
|
4745
4745
|
* Disallow ternary operators when simpler alternatives exist
|
|
4746
4746
|
* @see https://eslint.org/docs/latest/rules/no-unneeded-ternary
|
|
@@ -18088,6 +18088,10 @@ type NoUnderscoreDangle = [] | [{
|
|
|
18088
18088
|
allowInArrayDestructuring?: boolean;
|
|
18089
18089
|
allowInObjectDestructuring?: boolean;
|
|
18090
18090
|
}];
|
|
18091
|
+
// ----- no-unmodified-loop-condition -----
|
|
18092
|
+
type NoUnmodifiedLoopCondition = [] | [{
|
|
18093
|
+
checkConditionalExpressions?: boolean;
|
|
18094
|
+
}];
|
|
18091
18095
|
// ----- no-unneeded-ternary -----
|
|
18092
18096
|
type NoUnneededTernary = [] | [{
|
|
18093
18097
|
defaultAssignment?: boolean;
|