@shayanthenerd/eslint-config 0.23.0 → 0.24.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 +21 -14
- package/dist/configs/html.mjs +6 -2
- package/dist/configs/node.mjs +27 -0
- package/dist/configs/{restrictedExports.mjs → restrictedDefaultExports.mjs} +5 -5
- package/dist/configs/unicorn.mjs +24 -0
- package/dist/configs/vue.mjs +3 -3
- package/dist/helpers/globs.mjs +1 -1
- package/dist/helpers/options/defaultOptions.mjs +2 -0
- package/dist/helpers/options/enableDetectedConfigs.mjs +1 -0
- package/dist/index.mjs +7 -3
- package/dist/rules/css.mjs +18 -18
- package/dist/rules/html.mjs +2 -1
- package/dist/rules/javascript.mjs +36 -35
- package/dist/rules/node.mjs +35 -0
- package/dist/rules/stylistic.mjs +1 -9
- package/dist/rules/tailwind.mjs +25 -0
- package/dist/rules/typescript.mjs +4 -2
- package/dist/rules/unicorn.mjs +145 -0
- package/dist/types/eslint-schema.d.mts +1810 -191
- package/dist/types/index.d.mts +14 -0
- package/package.json +11 -9
package/dist/rules/tailwind.mjs
CHANGED
|
@@ -1,6 +1,30 @@
|
|
|
1
1
|
import { isEnabled } from "../utils/isEnabled.mjs";
|
|
2
2
|
import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
|
|
3
3
|
//#region src/rules/tailwind.ts
|
|
4
|
+
const ignoredNonLogicalProperties = [
|
|
5
|
+
"^top(?:-.+)?$",
|
|
6
|
+
"^bottom(?:-.+)?$",
|
|
7
|
+
"^pt-.+$",
|
|
8
|
+
"^pb-.+$",
|
|
9
|
+
"^-?mt-.+$",
|
|
10
|
+
"^-?mb-.+$",
|
|
11
|
+
"^border-t(?:-.+)?$",
|
|
12
|
+
"^border-b(?:-.+)?$",
|
|
13
|
+
"^w-.+$",
|
|
14
|
+
"^min-w-.+$",
|
|
15
|
+
"^max-w-.+$",
|
|
16
|
+
"^h-.+$",
|
|
17
|
+
"^min-h-.+$",
|
|
18
|
+
"^max-h-.+$",
|
|
19
|
+
"^overflow-x-.+$",
|
|
20
|
+
"^overflow-y-.+$",
|
|
21
|
+
"^overscroll-x-.+$",
|
|
22
|
+
"^overscroll-y-.+$",
|
|
23
|
+
"^scroll-pt-.+$",
|
|
24
|
+
"^scroll-pb-.+$",
|
|
25
|
+
"^scroll-mt-.+$",
|
|
26
|
+
"^scroll-mb-.+$"
|
|
27
|
+
];
|
|
4
28
|
function getTailwindRules(options) {
|
|
5
29
|
const { tailwind, stylistic } = options.configs;
|
|
6
30
|
const { multilineSort, ignoredUnknownClasses: userIgnoredUnknownClasses } = isEnabled(tailwind) ? tailwind : defaultOptions.configs.tailwind;
|
|
@@ -17,6 +41,7 @@ function getTailwindRules(options) {
|
|
|
17
41
|
printWidth: maxLineLength
|
|
18
42
|
}],
|
|
19
43
|
"better-tailwindcss/enforce-consistent-variant-order": "warn",
|
|
44
|
+
"better-tailwindcss/enforce-logical-properties": ["warn", { ignore: ignoredNonLogicalProperties }],
|
|
20
45
|
"better-tailwindcss/no-duplicate-classes": "error",
|
|
21
46
|
"better-tailwindcss/no-deprecated-classes": "error",
|
|
22
47
|
"better-tailwindcss/no-unnecessary-whitespace": "warn",
|
|
@@ -5,6 +5,8 @@ import { getJavaScriptRules } from "./javascript.mjs";
|
|
|
5
5
|
function getTypeScriptRules(options) {
|
|
6
6
|
const { typescript } = options.configs;
|
|
7
7
|
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];
|
|
8
10
|
return {
|
|
9
11
|
"@typescript-eslint/await-thenable": "error",
|
|
10
12
|
"@typescript-eslint/ban-ts-comment": ["warn", { "ts-expect-error": { descriptionFormat: "^ -- .+ $" } }],
|
|
@@ -56,7 +58,7 @@ function getTypeScriptRules(options) {
|
|
|
56
58
|
"@typescript-eslint/no-unsafe-return": "error",
|
|
57
59
|
"@typescript-eslint/no-unsafe-unary-minus": "error",
|
|
58
60
|
"@typescript-eslint/no-unused-vars": ["error", {
|
|
59
|
-
...
|
|
61
|
+
...noUnusedVarsOptions,
|
|
60
62
|
enableAutofixRemoval: { imports: removeUnusedImports }
|
|
61
63
|
}],
|
|
62
64
|
"@typescript-eslint/no-useless-default-assignment": "warn",
|
|
@@ -96,7 +98,7 @@ function getTypeScriptRules(options) {
|
|
|
96
98
|
"@typescript-eslint/prefer-regexp-exec": "warn",
|
|
97
99
|
"@typescript-eslint/prefer-string-starts-ends-with": "warn",
|
|
98
100
|
"@typescript-eslint/default-param-last": "warn",
|
|
99
|
-
"@typescript-eslint/prefer-destructuring": ["warn",
|
|
101
|
+
"@typescript-eslint/prefer-destructuring": ["warn", preferDestructuringOptions],
|
|
100
102
|
"@typescript-eslint/promise-function-async": "error",
|
|
101
103
|
"@typescript-eslint/consistent-type-imports": "warn",
|
|
102
104
|
"@typescript-eslint/no-useless-empty-export": "error",
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
//#region src/rules/unicorn.ts
|
|
2
|
+
const unicornRules = {
|
|
3
|
+
"unicorn/better-dom-traversing": "warn",
|
|
4
|
+
"unicorn/catch-error-name": "warn",
|
|
5
|
+
"unicorn/consistent-assert": "warn",
|
|
6
|
+
"unicorn/consistent-compound-words": "warn",
|
|
7
|
+
"unicorn/consistent-date-clone": "warn",
|
|
8
|
+
"unicorn/consistent-destructuring": "warn",
|
|
9
|
+
"unicorn/consistent-empty-array-spread": "warn",
|
|
10
|
+
"unicorn/consistent-existence-index-check": "warn",
|
|
11
|
+
"unicorn/consistent-function-scoping": ["warn", { checkArrowFunctions: false }],
|
|
12
|
+
"unicorn/consistent-json-file-read": "error",
|
|
13
|
+
"unicorn/consistent-template-literal-escape": "warn",
|
|
14
|
+
"unicorn/custom-error-definition": "error",
|
|
15
|
+
"unicorn/dom-node-dataset": "warn",
|
|
16
|
+
"unicorn/empty-brace-spaces": "warn",
|
|
17
|
+
"unicorn/error-message": "error",
|
|
18
|
+
"unicorn/escape-case": "warn",
|
|
19
|
+
"unicorn/explicit-length-check": "warn",
|
|
20
|
+
"unicorn/isolated-functions": "error",
|
|
21
|
+
"unicorn/new-for-builtins": "error",
|
|
22
|
+
"unicorn/no-abusive-eslint-disable": "error",
|
|
23
|
+
"unicorn/no-accessor-recursion": "error",
|
|
24
|
+
"unicorn/no-array-callback-reference": "warn",
|
|
25
|
+
"unicorn/no-array-fill-with-reference-type": "error",
|
|
26
|
+
"unicorn/no-array-from-fill": "warn",
|
|
27
|
+
"unicorn/no-array-method-this-argument": "warn",
|
|
28
|
+
"unicorn/no-await-expression-member": "warn",
|
|
29
|
+
"unicorn/no-await-in-promise-methods": "error",
|
|
30
|
+
"unicorn/no-blob-to-file": "warn",
|
|
31
|
+
"unicorn/no-canvas-to-image": "warn",
|
|
32
|
+
"unicorn/no-console-spaces": "warn",
|
|
33
|
+
"unicorn/no-document-cookie": "warn",
|
|
34
|
+
"unicorn/no-duplicate-set-values": "error",
|
|
35
|
+
"unicorn/no-exports-in-scripts": "error",
|
|
36
|
+
"unicorn/no-for-loop": "warn",
|
|
37
|
+
"unicorn/no-hex-escape": "warn",
|
|
38
|
+
"unicorn/no-immediate-mutation": "warn",
|
|
39
|
+
"unicorn/no-incorrect-query-selector": "error",
|
|
40
|
+
"unicorn/no-invalid-fetch-options": "error",
|
|
41
|
+
"unicorn/no-invalid-remove-event-listener": "error",
|
|
42
|
+
"unicorn/no-late-current-target-access": "warn",
|
|
43
|
+
"unicorn/no-lonely-if": "warn",
|
|
44
|
+
"unicorn/no-magic-array-flat-depth": "warn",
|
|
45
|
+
"unicorn/no-negation-in-equality-check": "warn",
|
|
46
|
+
"unicorn/no-nested-ternary": "warn",
|
|
47
|
+
"unicorn/no-new-buffer": "error",
|
|
48
|
+
"unicorn/no-object-as-default-parameter": "warn",
|
|
49
|
+
"unicorn/no-single-promise-in-promise-methods": "warn",
|
|
50
|
+
"unicorn/no-static-only-class": "warn",
|
|
51
|
+
"unicorn/no-thenable": "error",
|
|
52
|
+
"unicorn/no-this-outside-of-class": "error",
|
|
53
|
+
"unicorn/no-typeof-undefined": "warn",
|
|
54
|
+
"unicorn/no-unnecessary-array-flat-depth": "warn",
|
|
55
|
+
"unicorn/no-unnecessary-array-splice-count": "warn",
|
|
56
|
+
"unicorn/no-unnecessary-nested-ternary": "warn",
|
|
57
|
+
"unicorn/no-unnecessary-polyfills": "warn",
|
|
58
|
+
"unicorn/no-unnecessary-slice-end": "warn",
|
|
59
|
+
"unicorn/no-unreadable-array-destructuring": "warn",
|
|
60
|
+
"unicorn/no-unreadable-iife": "warn",
|
|
61
|
+
"unicorn/no-unused-array-method-return": "warn",
|
|
62
|
+
"unicorn/no-unused-properties": "warn",
|
|
63
|
+
"unicorn/no-useless-collection-argument": "warn",
|
|
64
|
+
"unicorn/no-useless-error-capture-stack-trace": "warn",
|
|
65
|
+
"unicorn/no-useless-fallback-in-spread": "warn",
|
|
66
|
+
"unicorn/no-useless-iterator-to-array": "warn",
|
|
67
|
+
"unicorn/no-useless-length-check": "warn",
|
|
68
|
+
"unicorn/no-useless-promise-resolve-reject": "warn",
|
|
69
|
+
"unicorn/no-useless-spread": "warn",
|
|
70
|
+
"unicorn/no-useless-switch-case": "warn",
|
|
71
|
+
"unicorn/no-useless-undefined": ["warn", { checkArrowFunctionBody: false }],
|
|
72
|
+
"unicorn/no-zero-fractions": "warn",
|
|
73
|
+
"unicorn/number-literal-case": "warn",
|
|
74
|
+
"unicorn/numeric-separators-style": "warn",
|
|
75
|
+
"unicorn/prefer-add-event-listener": "warn",
|
|
76
|
+
"unicorn/prefer-array-flat": "warn",
|
|
77
|
+
"unicorn/prefer-array-flat-map": "warn",
|
|
78
|
+
"unicorn/prefer-array-index-of": "warn",
|
|
79
|
+
"unicorn/prefer-array-last-methods": "warn",
|
|
80
|
+
"unicorn/prefer-array-some": "warn",
|
|
81
|
+
"unicorn/prefer-at": "warn",
|
|
82
|
+
"unicorn/prefer-bigint-literals": "warn",
|
|
83
|
+
"unicorn/prefer-blob-reading-methods": "warn",
|
|
84
|
+
"unicorn/prefer-class-fields": "warn",
|
|
85
|
+
"unicorn/prefer-classlist-toggle": "warn",
|
|
86
|
+
"unicorn/prefer-date-now": "warn",
|
|
87
|
+
"unicorn/prefer-dom-node-append": "warn",
|
|
88
|
+
"unicorn/prefer-dom-node-remove": "warn",
|
|
89
|
+
"unicorn/prefer-dom-node-text-content": "warn",
|
|
90
|
+
"unicorn/prefer-event-target": "warn",
|
|
91
|
+
"unicorn/prefer-export-from": ["warn", { checkUsedVariables: false }],
|
|
92
|
+
"unicorn/prefer-get-or-insert-computed": "warn",
|
|
93
|
+
"unicorn/prefer-https": "warn",
|
|
94
|
+
"unicorn/prefer-import-meta-properties": "warn",
|
|
95
|
+
"unicorn/prefer-includes": "warn",
|
|
96
|
+
"unicorn/prefer-iterator-to-array-at-end": "warn",
|
|
97
|
+
"unicorn/prefer-keyboard-event-key": "error",
|
|
98
|
+
"unicorn/prefer-logical-operator-over-ternary": "warn",
|
|
99
|
+
"unicorn/prefer-math-abs": "warn",
|
|
100
|
+
"unicorn/prefer-math-min-max": "warn",
|
|
101
|
+
"unicorn/prefer-math-trunc": "warn",
|
|
102
|
+
"unicorn/prefer-modern-dom-apis": "warn",
|
|
103
|
+
"unicorn/prefer-modern-math-apis": "warn",
|
|
104
|
+
"unicorn/prefer-module": "error",
|
|
105
|
+
"unicorn/prefer-negative-index": "warn",
|
|
106
|
+
"unicorn/prefer-node-protocol": "warn",
|
|
107
|
+
"unicorn/prefer-number-properties": "warn",
|
|
108
|
+
"unicorn/prefer-object-from-entries": "warn",
|
|
109
|
+
"unicorn/prefer-optional-catch-binding": "warn",
|
|
110
|
+
"unicorn/prefer-queue-microtask": "warn",
|
|
111
|
+
"unicorn/prefer-reflect-apply": "warn",
|
|
112
|
+
"unicorn/prefer-regexp-test": "warn",
|
|
113
|
+
"unicorn/prefer-response-static-json": "warn",
|
|
114
|
+
"unicorn/prefer-set-size": "warn",
|
|
115
|
+
"unicorn/prefer-simple-condition-first": "warn",
|
|
116
|
+
"unicorn/prefer-single-call": "warn",
|
|
117
|
+
"unicorn/prefer-spread": "warn",
|
|
118
|
+
"unicorn/prefer-string-match-all": "warn",
|
|
119
|
+
"unicorn/prefer-string-pad-start-end": "warn",
|
|
120
|
+
"unicorn/prefer-string-repeat": "warn",
|
|
121
|
+
"unicorn/prefer-string-replace-all": "warn",
|
|
122
|
+
"unicorn/prefer-string-slice": "warn",
|
|
123
|
+
"unicorn/prefer-string-starts-ends-with": "warn",
|
|
124
|
+
"unicorn/prefer-string-trim-start-end": "warn",
|
|
125
|
+
"unicorn/prefer-structured-clone": "warn",
|
|
126
|
+
"unicorn/prefer-top-level-await": "warn",
|
|
127
|
+
"unicorn/prefer-type-error": "warn",
|
|
128
|
+
"unicorn/relative-url-style": "warn",
|
|
129
|
+
"unicorn/require-array-join-separator": "warn",
|
|
130
|
+
"unicorn/require-module-attributes": "error",
|
|
131
|
+
"unicorn/require-module-specifiers": "error",
|
|
132
|
+
"unicorn/require-number-to-fixed-digits-argument": "warn",
|
|
133
|
+
"unicorn/require-passive-events": "warn",
|
|
134
|
+
"unicorn/require-post-message-target-origin": "error",
|
|
135
|
+
"unicorn/switch-case-braces": "warn",
|
|
136
|
+
"unicorn/switch-case-break-position": "error",
|
|
137
|
+
"unicorn/template-indent": "warn",
|
|
138
|
+
"unicorn/text-encoding-identifier-case": "warn",
|
|
139
|
+
"unicorn/throw-new-error": "warn"
|
|
140
|
+
};
|
|
141
|
+
function getUnicornRules() {
|
|
142
|
+
return unicornRules;
|
|
143
|
+
}
|
|
144
|
+
//#endregion
|
|
145
|
+
export { getUnicornRules };
|