@shayanthenerd/eslint-config 0.25.0 → 0.26.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 +71 -58
- package/dist/configs/base.mjs +1 -1
- package/dist/configs/baseline.mjs +22 -0
- package/dist/configs/css.mjs +6 -6
- package/dist/configs/html.mjs +7 -7
- package/dist/configs/next.mjs +20 -0
- package/dist/configs/react.mjs +29 -0
- package/dist/helpers/globs.mjs +2 -1
- package/dist/helpers/ignores/defaultIgnorePatterns.mjs +2 -0
- package/dist/helpers/isPackageDetected.mjs +1 -1
- package/dist/helpers/options/defaultOptions.mjs +47 -8
- package/dist/helpers/options/enableDetectedConfigs.mjs +6 -1
- package/dist/index.mjs +11 -5
- package/dist/prettier.config.mjs +1 -1
- package/dist/rules/astro.mjs +1 -0
- package/dist/rules/baseline.mjs +23 -0
- package/dist/rules/css.mjs +27 -6
- package/dist/rules/html.mjs +7 -7
- package/dist/rules/javascript.mjs +1 -2
- package/dist/rules/next.mjs +28 -0
- package/dist/rules/packageJson.mjs +1 -1
- package/dist/rules/react.mjs +160 -0
- package/dist/rules/typescript.mjs +1 -0
- package/dist/rules/unicorn.mjs +97 -1
- package/dist/rules/vue.mjs +2 -2
- package/dist/types/eslint-schema.d.mts +2384 -348
- package/dist/types/index.d.mts +55 -22
- package/dist/types/options/baseline.d.mts +106 -0
- package/dist/types/options/nuxt.d.mts +1 -2
- package/dist/types/options/react.d.mts +50 -0
- package/dist/types/options/stylistic.d.mts +1 -1
- package/dist/types/options/test.d.mts +1 -1
- package/package.json +21 -16
- package/dist/types/options/css.d.mts +0 -27
- package/dist/types/options/html.d.mts +0 -27
- package/dist/types/options/perfectionist.d.mts +0 -18
package/dist/rules/css.mjs
CHANGED
|
@@ -45,9 +45,9 @@ const allowedPhysicalProperties = [
|
|
|
45
45
|
"contain-intrinsic-width",
|
|
46
46
|
"contain-intrinsic-height"
|
|
47
47
|
];
|
|
48
|
-
function
|
|
49
|
-
const {
|
|
50
|
-
const {
|
|
48
|
+
function getCssRules(options) {
|
|
49
|
+
const { useBaseline } = options.configs;
|
|
50
|
+
const { allowedAtRules: userAllowedAtRules, allowedFunctions: userAllowedFunctions, allowedMediaConditions: userAllowedMediaConditions, allowedProperties: userAllowedProperties, allowedPropertyValues: userAllowedPropertyValues, allowedSelectors: userAllowedSelectors, allowedUnits: userAllowedUnits } = isEnabled(useBaseline) ? useBaseline.css : defaultOptions.configs.useBaseline.css;
|
|
51
51
|
return {
|
|
52
52
|
"css/font-family-fallbacks": "warn",
|
|
53
53
|
"css/no-duplicate-imports": "error",
|
|
@@ -63,9 +63,30 @@ function getCSSRules(options) {
|
|
|
63
63
|
allowUnits: allowedPhysicalUnits,
|
|
64
64
|
allowProperties: allowedPhysicalProperties
|
|
65
65
|
}],
|
|
66
|
-
"css/relative-font-units": ["warn", { allowUnits:
|
|
67
|
-
|
|
66
|
+
"css/relative-font-units": ["warn", { allowUnits: [
|
|
67
|
+
"cap",
|
|
68
|
+
"ch",
|
|
69
|
+
"em",
|
|
70
|
+
"ex",
|
|
71
|
+
"ic",
|
|
72
|
+
"lh",
|
|
73
|
+
"rcap",
|
|
74
|
+
"rch",
|
|
75
|
+
"rem",
|
|
76
|
+
"ric",
|
|
77
|
+
"rlh"
|
|
78
|
+
] }],
|
|
79
|
+
"css/use-baseline": isEnabled(useBaseline) ? ["warn", {
|
|
80
|
+
available: useBaseline.baseline,
|
|
81
|
+
allowAtRules: userAllowedAtRules,
|
|
82
|
+
allowFunctions: userAllowedFunctions,
|
|
83
|
+
allowMediaConditions: userAllowedMediaConditions,
|
|
84
|
+
allowProperties: userAllowedProperties,
|
|
85
|
+
allowPropertyValues: userAllowedPropertyValues,
|
|
86
|
+
allowSelectors: userAllowedSelectors,
|
|
87
|
+
allowUnits: userAllowedUnits
|
|
88
|
+
}] : "off"
|
|
68
89
|
};
|
|
69
90
|
}
|
|
70
91
|
//#endregion
|
|
71
|
-
export {
|
|
92
|
+
export { getCssRules };
|
package/dist/rules/html.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { isEnabled } from "../utils/isEnabled.mjs";
|
|
2
2
|
import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
|
|
3
3
|
//#region src/rules/html.ts
|
|
4
|
-
function
|
|
5
|
-
const { html, unicorn, tailwind, stylistic } = options.configs;
|
|
6
|
-
const {
|
|
7
|
-
const { indent, maxLineLength, maxAttributesPerLine, maxConsecutiveEmptyLines,
|
|
4
|
+
function getHtmlRules(options) {
|
|
5
|
+
const { html, unicorn, tailwind, stylistic, useBaseline } = options.configs;
|
|
6
|
+
const { idNamingConvention } = isEnabled(html) ? html : defaultOptions.configs.html;
|
|
7
|
+
const { indent, maxLineLength, maxAttributesPerLine, maxConsecutiveEmptyLines, selfCloseVoidHtmlElements } = isEnabled(stylistic) ? stylistic : defaultOptions.configs.stylistic;
|
|
8
8
|
const htmlRules = {
|
|
9
9
|
"@html-eslint/css-no-empty-blocks": "error",
|
|
10
10
|
"@html-eslint/no-duplicate-attrs": "error",
|
|
@@ -23,7 +23,7 @@ function getHTMLRules(options) {
|
|
|
23
23
|
"@html-eslint/require-button-type": "error",
|
|
24
24
|
"@html-eslint/require-closing-tags": ["warn", {
|
|
25
25
|
selfClosingCustomPatterns: ["-"],
|
|
26
|
-
selfClosing:
|
|
26
|
+
selfClosing: selfCloseVoidHtmlElements
|
|
27
27
|
}],
|
|
28
28
|
"@html-eslint/require-details-summary": "error",
|
|
29
29
|
"@html-eslint/require-doctype": "error",
|
|
@@ -31,7 +31,7 @@ function getHTMLRules(options) {
|
|
|
31
31
|
"@html-eslint/require-li-container": "error",
|
|
32
32
|
"@html-eslint/require-meta-charset": "error",
|
|
33
33
|
"@html-eslint/svg-require-viewbox": "error",
|
|
34
|
-
"@html-eslint/use-baseline": useBaseline ? ["warn", { available: useBaseline }] : "off",
|
|
34
|
+
"@html-eslint/use-baseline": isEnabled(useBaseline) ? ["warn", { available: useBaseline.baseline }] : "off",
|
|
35
35
|
"@html-eslint/no-multiple-h1": "error",
|
|
36
36
|
"@html-eslint/require-lang": "error",
|
|
37
37
|
"@html-eslint/require-meta-description": "error",
|
|
@@ -81,4 +81,4 @@ function getHTMLRules(options) {
|
|
|
81
81
|
return htmlRules;
|
|
82
82
|
}
|
|
83
83
|
//#endregion
|
|
84
|
-
export {
|
|
84
|
+
export { getHtmlRules };
|
|
@@ -107,7 +107,6 @@ function getJavaScriptRules(options) {
|
|
|
107
107
|
"max-params": ["warn", { countThis: "always" }],
|
|
108
108
|
"new-cap": "warn",
|
|
109
109
|
"no-array-constructor": "error",
|
|
110
|
-
"no-bitwise": ["error", { int32Hint: true }],
|
|
111
110
|
"no-caller": "error",
|
|
112
111
|
"no-console": ["warn", { allow: [
|
|
113
112
|
"info",
|
|
@@ -201,7 +200,7 @@ function getJavaScriptRules(options) {
|
|
|
201
200
|
"no-void": ["error", { allowAsStatement: true }],
|
|
202
201
|
"no-with": "error",
|
|
203
202
|
"object-shorthand": "warn",
|
|
204
|
-
"operator-assignment": "
|
|
203
|
+
"operator-assignment": "warn",
|
|
205
204
|
"prefer-arrow-callback": ["warn", { allowUnboundThis: true }],
|
|
206
205
|
"prefer-const": "error",
|
|
207
206
|
"prefer-destructuring": [isTypeScriptEnabled ? "off" : "warn", {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//#region src/rules/next.ts
|
|
2
|
+
const nextRules = {
|
|
3
|
+
"next/google-font-display": "warn",
|
|
4
|
+
"next/google-font-preconnect": "warn",
|
|
5
|
+
"next/inline-script-id": "error",
|
|
6
|
+
"next/next-script-for-ga": "warn",
|
|
7
|
+
"next/no-async-client-component": "error",
|
|
8
|
+
"next/no-before-interactive-script-outside-document": "error",
|
|
9
|
+
"next/no-css-tags": "warn",
|
|
10
|
+
"next/no-document-import-in-page": "error",
|
|
11
|
+
"next/no-duplicate-head": "error",
|
|
12
|
+
"next/no-head-element": "warn",
|
|
13
|
+
"next/no-head-import-in-document": "error",
|
|
14
|
+
"next/no-html-link-for-pages": "warn",
|
|
15
|
+
"next/no-img-element": "warn",
|
|
16
|
+
"next/no-page-custom-font": "warn",
|
|
17
|
+
"next/no-script-component-in-head": "error",
|
|
18
|
+
"next/no-styled-jsx-in-document": "error",
|
|
19
|
+
"next/no-sync-scripts": "warn",
|
|
20
|
+
"next/no-title-in-document-head": "error",
|
|
21
|
+
"next/no-typos": "warn",
|
|
22
|
+
"next/no-unwanted-polyfillio": "warn"
|
|
23
|
+
};
|
|
24
|
+
function getNextRules() {
|
|
25
|
+
return nextRules;
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
export { getNextRules };
|
|
@@ -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":
|
|
15
|
+
"package-json/require-engines": "warn",
|
|
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",
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { isEnabled } from "../utils/isEnabled.mjs";
|
|
2
|
+
import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
|
|
3
|
+
//#region src/rules/react.ts
|
|
4
|
+
const commonCallees = [
|
|
5
|
+
"classnames",
|
|
6
|
+
"classNames",
|
|
7
|
+
"clsx",
|
|
8
|
+
"cx",
|
|
9
|
+
"cva",
|
|
10
|
+
"cn",
|
|
11
|
+
"twMerge",
|
|
12
|
+
"twJoin",
|
|
13
|
+
"classcat",
|
|
14
|
+
"ctl"
|
|
15
|
+
];
|
|
16
|
+
function getReactRules(options) {
|
|
17
|
+
const { react, unicorn, tailwind, useBaseline } = options.configs;
|
|
18
|
+
const { imageComponents: userImageComponents, anchorComponents: userAnchorComponents, headingComponents: userHeadingComponents } = isEnabled(react) && isEnabled(react.accessibility) ? react.accessibility : defaultOptions.configs.react.accessibility;
|
|
19
|
+
const reactRules = {
|
|
20
|
+
/*** @eslint/react ***/
|
|
21
|
+
"@eslint-react/error-boundaries": "error",
|
|
22
|
+
"@eslint-react/exhaustive-deps": "error",
|
|
23
|
+
"@eslint-react/globals": "error",
|
|
24
|
+
"@eslint-react/immutability": "error",
|
|
25
|
+
"@eslint-react/no-access-state-in-setstate": "error",
|
|
26
|
+
"@eslint-react/no-array-index-key": "warn",
|
|
27
|
+
"@eslint-react/no-children-count": "error",
|
|
28
|
+
"@eslint-react/no-children-for-each": "error",
|
|
29
|
+
"@eslint-react/no-children-map": "error",
|
|
30
|
+
"@eslint-react/no-children-only": "error",
|
|
31
|
+
"@eslint-react/no-children-to-array": "error",
|
|
32
|
+
"@eslint-react/no-class-component": "warn",
|
|
33
|
+
"@eslint-react/no-clone-element": "error",
|
|
34
|
+
"@eslint-react/no-component-will-mount": "error",
|
|
35
|
+
"@eslint-react/no-component-will-receive-props": "error",
|
|
36
|
+
"@eslint-react/no-component-will-update": "error",
|
|
37
|
+
"@eslint-react/no-context-provider": "error",
|
|
38
|
+
"@eslint-react/no-create-ref": "error",
|
|
39
|
+
"@eslint-react/no-direct-mutation-state": "error",
|
|
40
|
+
"@eslint-react/no-duplicate-key": "error",
|
|
41
|
+
"@eslint-react/no-forward-ref": "warn",
|
|
42
|
+
"@eslint-react/no-implicit-children": "warn",
|
|
43
|
+
"@eslint-react/no-implicit-key": "warn",
|
|
44
|
+
"@eslint-react/no-implicit-ref": "warn",
|
|
45
|
+
"@eslint-react/no-leaked-conditional-rendering": "error",
|
|
46
|
+
"@eslint-react/no-missing-component-display-name": "warn",
|
|
47
|
+
"@eslint-react/no-missing-context-display-name": "warn",
|
|
48
|
+
"@eslint-react/no-missing-key": "error",
|
|
49
|
+
"@eslint-react/no-misused-capture-owner-stack": "error",
|
|
50
|
+
"@eslint-react/no-nested-component-definitions": "error",
|
|
51
|
+
"@eslint-react/no-nested-lazy-component-declarations": "error",
|
|
52
|
+
"@eslint-react/no-set-state-in-component-did-mount": "error",
|
|
53
|
+
"@eslint-react/no-set-state-in-component-did-update": "error",
|
|
54
|
+
"@eslint-react/no-set-state-in-component-will-update": "error",
|
|
55
|
+
"@eslint-react/no-unnecessary-use-prefix": "warn",
|
|
56
|
+
"@eslint-react/no-unsafe-component-will-mount": "error",
|
|
57
|
+
"@eslint-react/no-unsafe-component-will-receive-props": "error",
|
|
58
|
+
"@eslint-react/no-unsafe-component-will-update": "error",
|
|
59
|
+
"@eslint-react/no-unstable-context-value": "error",
|
|
60
|
+
"@eslint-react/no-unstable-default-props": "error",
|
|
61
|
+
"@eslint-react/no-unused-class-component-members": "error",
|
|
62
|
+
"@eslint-react/no-unused-props": "error",
|
|
63
|
+
"@eslint-react/no-unused-state": "error",
|
|
64
|
+
"@eslint-react/no-use-context": "warn",
|
|
65
|
+
"@eslint-react/purity": "error",
|
|
66
|
+
"@eslint-react/refs": "error",
|
|
67
|
+
"@eslint-react/rules-of-hooks": "error",
|
|
68
|
+
"@eslint-react/set-state-in-effect": "warn",
|
|
69
|
+
"@eslint-react/set-state-in-render": "error",
|
|
70
|
+
"@eslint-react/static-components": "warn",
|
|
71
|
+
"@eslint-react/unsupported-syntax": "error",
|
|
72
|
+
"@eslint-react/use-memo": "error",
|
|
73
|
+
"@eslint-react/use-state": "warn",
|
|
74
|
+
"@eslint-react/jsx-no-children-prop": "warn",
|
|
75
|
+
"@eslint-react/jsx-no-children-prop-with-children": "error",
|
|
76
|
+
"@eslint-react/jsx-no-comment-textnodes": "error",
|
|
77
|
+
"@eslint-react/jsx-no-key-after-spread": "warn",
|
|
78
|
+
"@eslint-react/jsx-no-namespace": "error",
|
|
79
|
+
"@eslint-react/jsx-no-useless-fragment": "warn",
|
|
80
|
+
"@eslint-react/rsc-function-definition": "error",
|
|
81
|
+
"@eslint-react/dom-no-dangerously-set-innerhtml": "warn",
|
|
82
|
+
"@eslint-react/dom-no-dangerously-set-innerhtml-with-children": "error",
|
|
83
|
+
"@eslint-react/dom-no-find-dom-node": "error",
|
|
84
|
+
"@eslint-react/dom-no-flush-sync": "warn",
|
|
85
|
+
"@eslint-react/dom-no-hydrate": "error",
|
|
86
|
+
"@eslint-react/dom-no-missing-button-type": "error",
|
|
87
|
+
"@eslint-react/dom-no-missing-iframe-sandbox": "error",
|
|
88
|
+
"@eslint-react/dom-no-render": "error",
|
|
89
|
+
"@eslint-react/dom-no-render-return-value": "error",
|
|
90
|
+
"@eslint-react/dom-no-script-url": "error",
|
|
91
|
+
"@eslint-react/dom-no-string-style-prop": "error",
|
|
92
|
+
"@eslint-react/dom-no-unknown-property": ["error", { requireDataLowercase: true }],
|
|
93
|
+
"@eslint-react/dom-no-unsafe-iframe-sandbox": "error",
|
|
94
|
+
"@eslint-react/dom-no-unsafe-target-blank": "warn",
|
|
95
|
+
"@eslint-react/dom-no-use-form-state": "warn",
|
|
96
|
+
"@eslint-react/dom-no-void-elements-with-children": "error",
|
|
97
|
+
"@eslint-react/web-api-no-leaked-event-listener": "error",
|
|
98
|
+
"@eslint-react/web-api-no-leaked-fetch": "error",
|
|
99
|
+
"@eslint-react/web-api-no-leaked-intersection-observer": "error",
|
|
100
|
+
"@eslint-react/web-api-no-leaked-interval": "error",
|
|
101
|
+
"@eslint-react/web-api-no-leaked-resize-observer": "error",
|
|
102
|
+
"@eslint-react/web-api-no-leaked-timeout": "error",
|
|
103
|
+
"@eslint-react/naming-convention-context-name": "warn",
|
|
104
|
+
"@eslint-react/naming-convention-id-name": "warn",
|
|
105
|
+
"@eslint-react/naming-convention-ref-name": "warn",
|
|
106
|
+
/*** jsx-a11y ***/
|
|
107
|
+
"jsx-a11y/alt-text": ["error", { img: userImageComponents }],
|
|
108
|
+
"jsx-a11y/anchor-ambiguous-text": "warn",
|
|
109
|
+
"jsx-a11y/anchor-has-content": ["error", { components: userAnchorComponents }],
|
|
110
|
+
"jsx-a11y/anchor-is-valid": ["error", {
|
|
111
|
+
specialLink: ["to"],
|
|
112
|
+
components: userAnchorComponents
|
|
113
|
+
}],
|
|
114
|
+
"jsx-a11y/aria-activedescendant-has-tabindex": "error",
|
|
115
|
+
"jsx-a11y/aria-props": "error",
|
|
116
|
+
"jsx-a11y/aria-proptypes": "error",
|
|
117
|
+
"jsx-a11y/aria-role": "error",
|
|
118
|
+
"jsx-a11y/aria-unsupported-elements": "error",
|
|
119
|
+
"jsx-a11y/autocomplete-valid": "error",
|
|
120
|
+
"jsx-a11y/click-events-have-key-events": "error",
|
|
121
|
+
"jsx-a11y/control-has-associated-label": "error",
|
|
122
|
+
"jsx-a11y/heading-has-content": ["error", { components: userHeadingComponents }],
|
|
123
|
+
"jsx-a11y/html-has-lang": "error",
|
|
124
|
+
"jsx-a11y/iframe-has-title": "error",
|
|
125
|
+
"jsx-a11y/img-redundant-alt": ["error", { components: userImageComponents }],
|
|
126
|
+
"jsx-a11y/interactive-supports-focus": "error",
|
|
127
|
+
"jsx-a11y/label-has-associated-control": "error",
|
|
128
|
+
"jsx-a11y/lang": "error",
|
|
129
|
+
"jsx-a11y/media-has-caption": "error",
|
|
130
|
+
"jsx-a11y/mouse-events-have-key-events": "error",
|
|
131
|
+
"jsx-a11y/no-access-key": "warn",
|
|
132
|
+
"jsx-a11y/no-aria-hidden-on-focusable": "error",
|
|
133
|
+
"jsx-a11y/no-autofocus": "warn",
|
|
134
|
+
"jsx-a11y/no-distracting-elements": "warn",
|
|
135
|
+
"jsx-a11y/no-interactive-element-to-noninteractive-role": "error",
|
|
136
|
+
"jsx-a11y/no-noninteractive-element-interactions": "error",
|
|
137
|
+
"jsx-a11y/no-noninteractive-element-to-interactive-role": "error",
|
|
138
|
+
"jsx-a11y/no-noninteractive-tabindex": "error",
|
|
139
|
+
"jsx-a11y/no-redundant-roles": "warn",
|
|
140
|
+
"jsx-a11y/no-static-element-interactions": "warn",
|
|
141
|
+
"jsx-a11y/prefer-tag-over-role": "warn",
|
|
142
|
+
"jsx-a11y/role-has-required-aria-props": "warn",
|
|
143
|
+
"jsx-a11y/role-supports-aria-props": "warn",
|
|
144
|
+
"jsx-a11y/scope": "error",
|
|
145
|
+
"jsx-a11y/tabindex-no-positive": "error",
|
|
146
|
+
/*** @html-eslint/react ***/
|
|
147
|
+
"@html-eslint/react/no-invalid-attr-value": "error",
|
|
148
|
+
"@html-eslint/react/use-baseline": isEnabled(useBaseline) ? ["warn", { available: useBaseline.baseline }] : "off",
|
|
149
|
+
"@html-eslint/react/no-ineffective-attrs": "warn",
|
|
150
|
+
"@html-eslint/react/no-obsolete-attrs": "error",
|
|
151
|
+
"@html-eslint/react/no-obsolete-tags": "error",
|
|
152
|
+
"@html-eslint/react/classname-spacing": ["warn", { callees: commonCallees }],
|
|
153
|
+
"@html-eslint/react/no-duplicate-classname": ["warn", { callees: commonCallees }]
|
|
154
|
+
};
|
|
155
|
+
if (isEnabled(tailwind)) reactRules["better-tailwindcss/no-duplicate-classes"] = "off";
|
|
156
|
+
if (isEnabled(unicorn)) reactRules["unicorn/no-invalid-file-input-accept"] = "error";
|
|
157
|
+
return reactRules;
|
|
158
|
+
}
|
|
159
|
+
//#endregion
|
|
160
|
+
export { getReactRules };
|
|
@@ -71,6 +71,7 @@ function getTypeScriptRules(options) {
|
|
|
71
71
|
"@typescript-eslint/prefer-reduce-type-parameter": "error",
|
|
72
72
|
"@typescript-eslint/prefer-return-this-type": "error",
|
|
73
73
|
"@typescript-eslint/related-getter-setter-pairs": "error",
|
|
74
|
+
"@typescript-eslint/require-array-sort-compare": "error",
|
|
74
75
|
"@typescript-eslint/require-await": "error",
|
|
75
76
|
"@typescript-eslint/restrict-plus-operands": "error",
|
|
76
77
|
"@typescript-eslint/restrict-template-expressions": "error",
|
package/dist/rules/unicorn.mjs
CHANGED
|
@@ -2,14 +2,17 @@
|
|
|
2
2
|
const unicornRules = {
|
|
3
3
|
"unicorn/better-dom-traversing": "warn",
|
|
4
4
|
"unicorn/catch-error-name": "warn",
|
|
5
|
+
"unicorn/class-reference-in-static-methods": "warn",
|
|
5
6
|
"unicorn/consistent-assert": "warn",
|
|
6
7
|
"unicorn/consistent-compound-words": "warn",
|
|
7
8
|
"unicorn/consistent-date-clone": "warn",
|
|
8
9
|
"unicorn/consistent-destructuring": "warn",
|
|
9
10
|
"unicorn/consistent-empty-array-spread": "warn",
|
|
10
11
|
"unicorn/consistent-existence-index-check": "warn",
|
|
12
|
+
"unicorn/consistent-export-decorator-position": "warn",
|
|
11
13
|
"unicorn/consistent-function-scoping": ["warn", { checkArrowFunctions: false }],
|
|
12
14
|
"unicorn/consistent-json-file-read": "error",
|
|
15
|
+
"unicorn/consistent-optional-chaining": "warn",
|
|
13
16
|
"unicorn/consistent-template-literal-escape": "warn",
|
|
14
17
|
"unicorn/custom-error-definition": "error",
|
|
15
18
|
"unicorn/dom-node-dataset": "warn",
|
|
@@ -17,103 +20,188 @@ const unicornRules = {
|
|
|
17
20
|
"unicorn/error-message": "error",
|
|
18
21
|
"unicorn/escape-case": "warn",
|
|
19
22
|
"unicorn/explicit-length-check": "warn",
|
|
23
|
+
"unicorn/explicit-timer-delay": "warn",
|
|
20
24
|
"unicorn/isolated-functions": "error",
|
|
21
25
|
"unicorn/new-for-builtins": "error",
|
|
22
26
|
"unicorn/no-abusive-eslint-disable": "error",
|
|
23
27
|
"unicorn/no-accessor-recursion": "error",
|
|
28
|
+
"unicorn/no-accidental-bitwise-operator": "warn",
|
|
24
29
|
"unicorn/no-array-callback-reference": "warn",
|
|
30
|
+
"unicorn/no-array-concat-in-loop": "warn",
|
|
25
31
|
"unicorn/no-array-fill-with-reference-type": "error",
|
|
26
32
|
"unicorn/no-array-from-fill": "warn",
|
|
27
33
|
"unicorn/no-array-method-this-argument": "warn",
|
|
34
|
+
"unicorn/no-array-sort-for-min-max": "warn",
|
|
28
35
|
"unicorn/no-await-expression-member": "warn",
|
|
29
36
|
"unicorn/no-await-in-promise-methods": "error",
|
|
30
37
|
"unicorn/no-blob-to-file": "warn",
|
|
38
|
+
"unicorn/no-boolean-sort-comparator": "warn",
|
|
31
39
|
"unicorn/no-canvas-to-image": "warn",
|
|
40
|
+
"unicorn/no-chained-comparison": "error",
|
|
41
|
+
"unicorn/no-collection-bracket-access": "error",
|
|
42
|
+
"unicorn/no-confusing-array-with": "warn",
|
|
32
43
|
"unicorn/no-console-spaces": "warn",
|
|
44
|
+
"unicorn/no-constant-zero-expression": "warn",
|
|
45
|
+
"unicorn/no-declarations-before-early-exit": "warn",
|
|
33
46
|
"unicorn/no-document-cookie": "warn",
|
|
47
|
+
"unicorn/no-double-comparison": "warn",
|
|
48
|
+
"unicorn/no-duplicate-if-branches": "warn",
|
|
49
|
+
"unicorn/no-duplicate-logical-operands": "warn",
|
|
50
|
+
"unicorn/no-duplicate-loops": "warn",
|
|
34
51
|
"unicorn/no-duplicate-set-values": "error",
|
|
52
|
+
"unicorn/no-error-property-assignment": "error",
|
|
35
53
|
"unicorn/no-exports-in-scripts": "error",
|
|
36
54
|
"unicorn/no-for-loop": "warn",
|
|
37
|
-
"unicorn/no-hex-escape": "warn",
|
|
38
55
|
"unicorn/no-immediate-mutation": "warn",
|
|
56
|
+
"unicorn/no-impossible-length-comparison": "error",
|
|
39
57
|
"unicorn/no-incorrect-query-selector": "error",
|
|
58
|
+
"unicorn/no-incorrect-template-string-interpolation": "error",
|
|
59
|
+
"unicorn/no-invalid-character-comparison": "error",
|
|
40
60
|
"unicorn/no-invalid-fetch-options": "error",
|
|
41
61
|
"unicorn/no-invalid-remove-event-listener": "error",
|
|
42
62
|
"unicorn/no-late-current-target-access": "warn",
|
|
43
63
|
"unicorn/no-lonely-if": "warn",
|
|
64
|
+
"unicorn/no-loop-iterable-mutation": "warn",
|
|
44
65
|
"unicorn/no-magic-array-flat-depth": "warn",
|
|
66
|
+
"unicorn/no-mismatched-map-key": "warn",
|
|
67
|
+
"unicorn/no-misrefactored-assignment": "warn",
|
|
68
|
+
"unicorn/no-negated-array-predicate": "warn",
|
|
69
|
+
"unicorn/no-negated-comparison": ["warn", { checkLogicalExpressions: false }],
|
|
45
70
|
"unicorn/no-negation-in-equality-check": "warn",
|
|
46
71
|
"unicorn/no-nested-ternary": "warn",
|
|
47
72
|
"unicorn/no-new-buffer": "error",
|
|
73
|
+
"unicorn/no-nonstandard-builtin-properties": "error",
|
|
48
74
|
"unicorn/no-object-as-default-parameter": "warn",
|
|
75
|
+
"unicorn/no-object-methods-with-collections": "warn",
|
|
76
|
+
"unicorn/no-optional-chaining-on-undeclared-variable": "error",
|
|
77
|
+
"unicorn/no-redundant-comparison": "warn",
|
|
78
|
+
"unicorn/no-selector-as-dom-name": "error",
|
|
49
79
|
"unicorn/no-single-promise-in-promise-methods": "warn",
|
|
50
80
|
"unicorn/no-static-only-class": "warn",
|
|
81
|
+
"unicorn/no-subtraction-comparison": "warn",
|
|
51
82
|
"unicorn/no-thenable": "error",
|
|
52
83
|
"unicorn/no-this-outside-of-class": "error",
|
|
53
84
|
"unicorn/no-typeof-undefined": "warn",
|
|
85
|
+
"unicorn/no-uncalled-method": "error",
|
|
86
|
+
"unicorn/no-undeclared-class-members": "error",
|
|
54
87
|
"unicorn/no-unnecessary-array-flat-depth": "warn",
|
|
55
88
|
"unicorn/no-unnecessary-array-splice-count": "warn",
|
|
89
|
+
"unicorn/no-unnecessary-boolean-comparison": "warn",
|
|
90
|
+
"unicorn/no-unnecessary-global-this": "warn",
|
|
56
91
|
"unicorn/no-unnecessary-nested-ternary": "warn",
|
|
57
92
|
"unicorn/no-unnecessary-polyfills": "warn",
|
|
58
93
|
"unicorn/no-unnecessary-slice-end": "warn",
|
|
94
|
+
"unicorn/no-unnecessary-splice": "warn",
|
|
59
95
|
"unicorn/no-unreadable-array-destructuring": "warn",
|
|
96
|
+
"unicorn/no-unreadable-for-of-expression": "warn",
|
|
60
97
|
"unicorn/no-unreadable-iife": "warn",
|
|
98
|
+
"unicorn/no-unreadable-new-expression": "warn",
|
|
99
|
+
"unicorn/no-unsafe-buffer-conversion": "warn",
|
|
100
|
+
"unicorn/no-unsafe-property-key": "error",
|
|
61
101
|
"unicorn/no-unused-array-method-return": "warn",
|
|
62
102
|
"unicorn/no-unused-properties": "warn",
|
|
103
|
+
"unicorn/no-useless-boolean-cast": "warn",
|
|
63
104
|
"unicorn/no-useless-collection-argument": "warn",
|
|
105
|
+
"unicorn/no-useless-compound-assignment": "warn",
|
|
106
|
+
"unicorn/no-useless-concat": "warn",
|
|
107
|
+
"unicorn/no-useless-continue": "warn",
|
|
108
|
+
"unicorn/no-useless-delete-check": "warn",
|
|
64
109
|
"unicorn/no-useless-error-capture-stack-trace": "warn",
|
|
65
110
|
"unicorn/no-useless-fallback-in-spread": "warn",
|
|
66
111
|
"unicorn/no-useless-iterator-to-array": "warn",
|
|
67
112
|
"unicorn/no-useless-length-check": "warn",
|
|
113
|
+
"unicorn/no-useless-logical-operand": "warn",
|
|
114
|
+
"unicorn/no-useless-override": "warn",
|
|
68
115
|
"unicorn/no-useless-promise-resolve-reject": "warn",
|
|
116
|
+
"unicorn/no-useless-recursion": "warn",
|
|
69
117
|
"unicorn/no-useless-spread": "warn",
|
|
70
118
|
"unicorn/no-useless-switch-case": "warn",
|
|
119
|
+
"unicorn/no-useless-template-literals": "warn",
|
|
71
120
|
"unicorn/no-useless-undefined": ["warn", { checkArrowFunctionBody: false }],
|
|
121
|
+
"unicorn/no-xor-as-exponentiation": "error",
|
|
72
122
|
"unicorn/no-zero-fractions": "warn",
|
|
73
123
|
"unicorn/number-literal-case": "warn",
|
|
74
124
|
"unicorn/numeric-separators-style": "warn",
|
|
75
125
|
"unicorn/prefer-add-event-listener": "warn",
|
|
126
|
+
"unicorn/prefer-add-event-listener-options": "warn",
|
|
76
127
|
"unicorn/prefer-array-flat": "warn",
|
|
77
128
|
"unicorn/prefer-array-flat-map": "warn",
|
|
129
|
+
"unicorn/prefer-array-from-async": "warn",
|
|
130
|
+
"unicorn/prefer-array-from-map": "warn",
|
|
78
131
|
"unicorn/prefer-array-index-of": "warn",
|
|
132
|
+
"unicorn/prefer-array-iterable-methods": "warn",
|
|
79
133
|
"unicorn/prefer-array-last-methods": "warn",
|
|
134
|
+
"unicorn/prefer-array-slice": "warn",
|
|
80
135
|
"unicorn/prefer-array-some": "warn",
|
|
81
136
|
"unicorn/prefer-at": "warn",
|
|
82
137
|
"unicorn/prefer-bigint-literals": "warn",
|
|
83
138
|
"unicorn/prefer-blob-reading-methods": "warn",
|
|
139
|
+
"unicorn/prefer-boolean-return": "warn",
|
|
84
140
|
"unicorn/prefer-class-fields": "warn",
|
|
85
141
|
"unicorn/prefer-classlist-toggle": "warn",
|
|
142
|
+
"unicorn/prefer-code-point": "error",
|
|
143
|
+
"unicorn/prefer-continue": ["warn", { maximumStatements: 3 }],
|
|
86
144
|
"unicorn/prefer-date-now": "warn",
|
|
145
|
+
"unicorn/prefer-direct-iteration": "warn",
|
|
146
|
+
"unicorn/prefer-dispose": "warn",
|
|
87
147
|
"unicorn/prefer-dom-node-append": "warn",
|
|
148
|
+
"unicorn/prefer-dom-node-html-methods": "warn",
|
|
88
149
|
"unicorn/prefer-dom-node-remove": "warn",
|
|
89
150
|
"unicorn/prefer-dom-node-text-content": "warn",
|
|
90
151
|
"unicorn/prefer-event-target": "warn",
|
|
91
152
|
"unicorn/prefer-export-from": ["warn", { checkUsedVariables: false }],
|
|
153
|
+
"unicorn/prefer-flat-math-min-max": "warn",
|
|
92
154
|
"unicorn/prefer-get-or-insert-computed": "warn",
|
|
155
|
+
"unicorn/prefer-global-number-constants": "warn",
|
|
156
|
+
"unicorn/prefer-has-check": "warn",
|
|
157
|
+
"unicorn/prefer-hoisting-branch-code": "warn",
|
|
93
158
|
"unicorn/prefer-https": "warn",
|
|
159
|
+
"unicorn/prefer-identifier-import-export-specifiers": "warn",
|
|
94
160
|
"unicorn/prefer-import-meta-properties": "warn",
|
|
95
161
|
"unicorn/prefer-includes": "warn",
|
|
162
|
+
"unicorn/prefer-iterable-in-constructor": "warn",
|
|
163
|
+
"unicorn/prefer-iterator-concat": "warn",
|
|
164
|
+
"unicorn/prefer-iterator-to-array": "warn",
|
|
96
165
|
"unicorn/prefer-iterator-to-array-at-end": "warn",
|
|
97
166
|
"unicorn/prefer-keyboard-event-key": "error",
|
|
167
|
+
"unicorn/prefer-location-assign": "warn",
|
|
98
168
|
"unicorn/prefer-logical-operator-over-ternary": "warn",
|
|
169
|
+
"unicorn/prefer-map-from-entries": "warn",
|
|
99
170
|
"unicorn/prefer-math-abs": "warn",
|
|
171
|
+
"unicorn/prefer-math-constants": "warn",
|
|
100
172
|
"unicorn/prefer-math-min-max": "warn",
|
|
101
173
|
"unicorn/prefer-math-trunc": "warn",
|
|
102
174
|
"unicorn/prefer-modern-dom-apis": "warn",
|
|
103
175
|
"unicorn/prefer-modern-math-apis": "warn",
|
|
104
176
|
"unicorn/prefer-module": "error",
|
|
177
|
+
"unicorn/prefer-native-coercion-functions": "warn",
|
|
105
178
|
"unicorn/prefer-negative-index": "warn",
|
|
106
179
|
"unicorn/prefer-node-protocol": "warn",
|
|
180
|
+
"unicorn/prefer-number-coercion": "warn",
|
|
181
|
+
"unicorn/prefer-number-is-safe-integer": "warn",
|
|
107
182
|
"unicorn/prefer-number-properties": "warn",
|
|
183
|
+
"unicorn/prefer-object-define-properties": "warn",
|
|
184
|
+
"unicorn/prefer-object-destructuring-defaults": "warn",
|
|
108
185
|
"unicorn/prefer-object-from-entries": "warn",
|
|
186
|
+
"unicorn/prefer-object-iterable-methods": "warn",
|
|
109
187
|
"unicorn/prefer-optional-catch-binding": "warn",
|
|
188
|
+
"unicorn/prefer-path2d": "warn",
|
|
189
|
+
"unicorn/prefer-private-class-fields": "warn",
|
|
190
|
+
"unicorn/prefer-promise-with-resolvers": "warn",
|
|
110
191
|
"unicorn/prefer-queue-microtask": "warn",
|
|
111
192
|
"unicorn/prefer-reflect-apply": "warn",
|
|
193
|
+
"unicorn/prefer-regexp-escape": "warn",
|
|
112
194
|
"unicorn/prefer-regexp-test": "warn",
|
|
113
195
|
"unicorn/prefer-response-static-json": "warn",
|
|
196
|
+
"unicorn/prefer-scoped-selector": "warn",
|
|
114
197
|
"unicorn/prefer-set-size": "warn",
|
|
115
198
|
"unicorn/prefer-simple-condition-first": "warn",
|
|
199
|
+
"unicorn/prefer-simple-sort-comparator": "warn",
|
|
200
|
+
"unicorn/prefer-single-array-predicate": "warn",
|
|
116
201
|
"unicorn/prefer-single-call": "warn",
|
|
202
|
+
"unicorn/prefer-single-object-destructuring": "warn",
|
|
203
|
+
"unicorn/prefer-single-replace": "warn",
|
|
204
|
+
"unicorn/prefer-smaller-scope": "warn",
|
|
117
205
|
"unicorn/prefer-spread": "warn",
|
|
118
206
|
"unicorn/prefer-string-match-all": "warn",
|
|
119
207
|
"unicorn/prefer-string-pad-start-end": "warn",
|
|
@@ -123,15 +211,23 @@ const unicornRules = {
|
|
|
123
211
|
"unicorn/prefer-string-starts-ends-with": "warn",
|
|
124
212
|
"unicorn/prefer-string-trim-start-end": "warn",
|
|
125
213
|
"unicorn/prefer-structured-clone": "warn",
|
|
214
|
+
"unicorn/prefer-temporal": "warn",
|
|
126
215
|
"unicorn/prefer-top-level-await": "warn",
|
|
127
216
|
"unicorn/prefer-type-error": "warn",
|
|
217
|
+
"unicorn/prefer-uint8array-base64": "warn",
|
|
218
|
+
"unicorn/prefer-unary-minus": "warn",
|
|
219
|
+
"unicorn/prefer-url-can-parse": "warn",
|
|
220
|
+
"unicorn/prefer-url-href": "warn",
|
|
221
|
+
"unicorn/prefer-while-loop-condition": "warn",
|
|
128
222
|
"unicorn/relative-url-style": "warn",
|
|
129
223
|
"unicorn/require-array-join-separator": "warn",
|
|
224
|
+
"unicorn/require-css-escape": "warn",
|
|
130
225
|
"unicorn/require-module-attributes": "error",
|
|
131
226
|
"unicorn/require-module-specifiers": "error",
|
|
132
227
|
"unicorn/require-number-to-fixed-digits-argument": "warn",
|
|
133
228
|
"unicorn/require-passive-events": "warn",
|
|
134
229
|
"unicorn/require-post-message-target-origin": "error",
|
|
230
|
+
"unicorn/require-proxy-trap-boolean-return": "error",
|
|
135
231
|
"unicorn/switch-case-braces": "warn",
|
|
136
232
|
"unicorn/switch-case-break-position": "error",
|
|
137
233
|
"unicorn/template-indent": "warn",
|
package/dist/rules/vue.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { getRestrictedVueElements } from "../helpers/vue/getRestrictedVueElement
|
|
|
6
6
|
//#region src/rules/vue.ts
|
|
7
7
|
function getVueRules(options) {
|
|
8
8
|
const { typescript, stylistic, vue, nuxt } = options.configs;
|
|
9
|
-
const { indent, trailingComma, maxLineLength, maxAttributesPerLine, maxConsecutiveEmptyLines,
|
|
9
|
+
const { indent, trailingComma, maxLineLength, maxAttributesPerLine, maxConsecutiveEmptyLines, selfCloseVoidHtmlElements } = isEnabled(stylistic) ? stylistic : defaultOptions.configs.stylistic;
|
|
10
10
|
const { blockLang, blocksOrder, macrosOrder, attributesOrder, destructureProps, vForDelimiterStyle, attributeHyphenation, allowedStyleAttributes, preferVBindTrueShorthand, componentNameCaseInTemplate, preferVBindSameNameShorthand, restrictedElements: userRestrictedElements, ignoredUndefinedComponents: userIgnoredUndefinedComponents, restrictedStaticAttributes: userRestrictedStaticAttributes } = isEnabled(vue) ? vue : defaultOptions.configs.vue;
|
|
11
11
|
const isNuxtEnabled = isEnabled(nuxt);
|
|
12
12
|
const isNuxtImageEnabled = isNuxtEnabled ? nuxt.image : void 0;
|
|
@@ -115,7 +115,7 @@ function getVueRules(options) {
|
|
|
115
115
|
"vue/html-quotes": "warn",
|
|
116
116
|
"vue/html-self-closing": ["error", { html: {
|
|
117
117
|
normal: "never",
|
|
118
|
-
void:
|
|
118
|
+
void: selfCloseVoidHtmlElements
|
|
119
119
|
} }],
|
|
120
120
|
"vue/max-attributes-per-line": ["warn", { singleline: { max: maxAttributesPerLine } }],
|
|
121
121
|
"vue/multiline-html-element-content-newline": "warn",
|