@shayanthenerd/eslint-config 0.26.2 → 0.26.4
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 +19 -18
- package/dist/rules/javascript.mjs +7 -3
- package/dist/rules/tailwind.mjs +27 -25
- package/dist/rules/unicorn.mjs +8 -0
- package/dist/types/eslint-schema.d.mts +461 -372
- package/package.json +13 -13
package/README.md
CHANGED
|
@@ -25,40 +25,40 @@ ESLint configuration for enforcing best practices and maintaining a consistent c
|
|
|
25
25
|
|
|
26
26
|
## Plugin Support
|
|
27
27
|
Legend:
|
|
28
|
-
- ✅ Enabled by default
|
|
29
|
-
-
|
|
30
|
-
-
|
|
28
|
+
- ✅ — **Enabled** by default
|
|
29
|
+
- ⚙️ — **Opt-in** (requires manual configuration)
|
|
30
|
+
- 🔍 — [**Automatically detected**](#automatic-dependency-detection) (based on project dependencies)
|
|
31
31
|
|
|
32
32
|
| Category | Activation |
|
|
33
33
|
| :---------------------------------------------------------------------------------------------------- | :--------: |
|
|
34
34
|
| **Languages** | |
|
|
35
35
|
| [JavaScript][eslint] | ✅ |
|
|
36
|
-
| [TypeScript][plugin-ts] |
|
|
36
|
+
| [TypeScript][plugin-ts] | 🔍 |
|
|
37
37
|
| [Markdown][plugin-md] | ✅ |
|
|
38
|
-
| [HTML][plugin-html] |
|
|
39
|
-
| [CSS][plugin-css] |
|
|
38
|
+
| [HTML][plugin-html] | ⚙️ |
|
|
39
|
+
| [CSS][plugin-css] | ⚙️ |
|
|
40
40
|
| **Formatting** | |
|
|
41
41
|
| [Stylistic][plugin-stylistic] | ✅ |
|
|
42
42
|
| [Perfectionist][plugin-perfectionist] | ✅ |
|
|
43
43
|
| **Frameworks & Libraries** | |
|
|
44
|
-
| [Astro][plugin-astro] ([jsx-accessibility][plugin-jsx-a11y]) |
|
|
45
|
-
| [React][plugin-react] ([jsx-accessibility][plugin-jsx-a11y], [@html-eslint/react][plugin-html-react]) |
|
|
46
|
-
| [Next][plugin-next] |
|
|
47
|
-
| [Vue & Nuxt][plugin-vue] ([vue-accessibility][plugin-vue-a11y]) |
|
|
48
|
-
| [Tailwind][plugin-tailwind] |
|
|
49
|
-
| [Zod & Zod Mini][plugin-zod] |
|
|
44
|
+
| [Astro][plugin-astro] ([jsx-accessibility][plugin-jsx-a11y]) | 🔍 |
|
|
45
|
+
| [React][plugin-react] ([jsx-accessibility][plugin-jsx-a11y], [@html-eslint/react][plugin-html-react]) | 🔍 |
|
|
46
|
+
| [Next][plugin-next] | 🔍 |
|
|
47
|
+
| [Vue & Nuxt][plugin-vue] ([vue-accessibility][plugin-vue-a11y]) | 🔍 |
|
|
48
|
+
| [Tailwind][plugin-tailwind] | ⚙️ |
|
|
49
|
+
| [Zod & Zod Mini][plugin-zod] | 🔍 |
|
|
50
50
|
| **Testing Tools** | |
|
|
51
|
-
| [Storybook][plugin-storybook] |
|
|
52
|
-
| [Vitest][plugin-vitest] |
|
|
53
|
-
| [Cypress][plugin-cypress] |
|
|
54
|
-
| [Playwright][plugin-playwright] |
|
|
51
|
+
| [Storybook][plugin-storybook] | 🔍 |
|
|
52
|
+
| [Vitest][plugin-vitest] | 🔍 |
|
|
53
|
+
| [Cypress][plugin-cypress] | 🔍 |
|
|
54
|
+
| [Playwright][plugin-playwright] | 🔍 |
|
|
55
55
|
| **Miscellaneous** | |
|
|
56
56
|
| [_package.json_][plugin-package-json] | ✅ |
|
|
57
57
|
| [Node][plugin-n] | ✅ |
|
|
58
58
|
| [Promises][plugin-promise] | ✅ |
|
|
59
59
|
| [Imports][plugin-import-x] | ✅ |
|
|
60
60
|
| [Unicorn][plugin-unicorn] | ✅ |
|
|
61
|
-
| [Baseline][plugin-baseline] |
|
|
61
|
+
| [Baseline][plugin-baseline] | 🔍 |
|
|
62
62
|
|
|
63
63
|
## Installation and Configuration
|
|
64
64
|
1. Install the package and ESLint as dev dependencies:
|
|
@@ -231,8 +231,9 @@ Some rules depend on the specified Node.js version. Visit the documentation for
|
|
|
231
231
|
|
|
232
232
|
## IDE Support
|
|
233
233
|
Install the VS Code extensions for [ESLint][extension-eslint] and [Prettier][extension-prettier].
|
|
234
|
+
|
|
234
235
|
> [!TIP]
|
|
235
|
-
> In case you're using PNPM without `shamefullyHoist: true
|
|
236
|
+
> In case you're using PNPM without `shamefullyHoist: true` and ESLint's VS Code extension isn't working as expected, add the following to your _pnpm-workspace.yaml_ and run `pnpm install --yes`:
|
|
236
237
|
> ```yaml title="pnpm-workspace.yaml"
|
|
237
238
|
> publicHoistPattern:
|
|
238
239
|
> - '*eslint*'
|
|
@@ -82,7 +82,7 @@ function getJavaScriptRules(options) {
|
|
|
82
82
|
"consistent-return": isTypeScriptEnabled ? "off" : "error",
|
|
83
83
|
"consistent-this": "error",
|
|
84
84
|
"curly": "warn",
|
|
85
|
-
"default-case": "warn",
|
|
85
|
+
"default-case": isTypeScriptEnabled ? "off" : "warn",
|
|
86
86
|
"default-case-last": "warn",
|
|
87
87
|
"default-param-last": isTypeScriptEnabled ? "off" : "warn",
|
|
88
88
|
"dot-notation": isTypeScriptEnabled ? "off" : "warn",
|
|
@@ -164,10 +164,14 @@ function getJavaScriptRules(options) {
|
|
|
164
164
|
"no-setter-return": isTypeScriptEnabled ? "off" : "error",
|
|
165
165
|
"no-shadow": ["error", {
|
|
166
166
|
hoist: "all",
|
|
167
|
-
allow: ["name"],
|
|
168
167
|
builtinGlobals: true,
|
|
169
168
|
ignoreTypeValueShadow: false,
|
|
170
|
-
ignoreFunctionTypeParameterNameValueShadow: false
|
|
169
|
+
ignoreFunctionTypeParameterNameValueShadow: false,
|
|
170
|
+
allow: [
|
|
171
|
+
"name",
|
|
172
|
+
"event",
|
|
173
|
+
"status"
|
|
174
|
+
]
|
|
171
175
|
}],
|
|
172
176
|
"no-shadow-restricted-names": "warn",
|
|
173
177
|
"no-sparse-arrays": "error",
|
package/dist/rules/tailwind.mjs
CHANGED
|
@@ -1,30 +1,32 @@
|
|
|
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
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
]
|
|
4
|
+
const nonLogicalTailwindUtilityPatterns = [
|
|
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
|
+
].map((pattern) => {
|
|
28
|
+
return `^(?:\\S+:)*(?:!${pattern}|${pattern}!?)$`;
|
|
29
|
+
});
|
|
28
30
|
function getTailwindRules(options) {
|
|
29
31
|
const { tailwind, stylistic } = options.configs;
|
|
30
32
|
const { multilineSort, ignoredUnknownClasses: userIgnoredUnknownClasses } = isEnabled(tailwind) ? tailwind : defaultOptions.configs.tailwind;
|
|
@@ -41,7 +43,7 @@ function getTailwindRules(options) {
|
|
|
41
43
|
printWidth: maxLineLength
|
|
42
44
|
}],
|
|
43
45
|
"better-tailwindcss/enforce-consistent-variant-order": "warn",
|
|
44
|
-
"better-tailwindcss/enforce-logical-properties": ["warn", { ignore:
|
|
46
|
+
"better-tailwindcss/enforce-logical-properties": ["warn", { ignore: nonLogicalTailwindUtilityPatterns }],
|
|
45
47
|
"better-tailwindcss/no-duplicate-classes": "error",
|
|
46
48
|
"better-tailwindcss/no-deprecated-classes": "error",
|
|
47
49
|
"better-tailwindcss/no-unnecessary-whitespace": "warn",
|
package/dist/rules/unicorn.mjs
CHANGED
|
@@ -33,6 +33,7 @@ const unicornRules = {
|
|
|
33
33
|
"unicorn/no-array-from-fill": "warn",
|
|
34
34
|
"unicorn/no-array-method-this-argument": "warn",
|
|
35
35
|
"unicorn/no-array-sort-for-min-max": "warn",
|
|
36
|
+
"unicorn/no-async-promise-finally": "warn",
|
|
36
37
|
"unicorn/no-await-expression-member": "warn",
|
|
37
38
|
"unicorn/no-await-in-promise-methods": "error",
|
|
38
39
|
"unicorn/no-blob-to-file": "warn",
|
|
@@ -91,6 +92,7 @@ const unicornRules = {
|
|
|
91
92
|
"unicorn/no-unnecessary-array-flat-depth": "warn",
|
|
92
93
|
"unicorn/no-unnecessary-array-splice-count": "warn",
|
|
93
94
|
"unicorn/no-unnecessary-boolean-comparison": "warn",
|
|
95
|
+
"unicorn/no-unnecessary-fetch-options": "warn",
|
|
94
96
|
"unicorn/no-unnecessary-global-this": "warn",
|
|
95
97
|
"unicorn/no-unnecessary-nested-ternary": "warn",
|
|
96
98
|
"unicorn/no-unnecessary-polyfills": "warn",
|
|
@@ -101,6 +103,7 @@ const unicornRules = {
|
|
|
101
103
|
"unicorn/no-unreadable-iife": "warn",
|
|
102
104
|
"unicorn/no-unreadable-new-expression": "warn",
|
|
103
105
|
"unicorn/no-unsafe-buffer-conversion": "warn",
|
|
106
|
+
"unicorn/no-unsafe-promise-all-settled-values": "error",
|
|
104
107
|
"unicorn/no-unsafe-property-key": "error",
|
|
105
108
|
"unicorn/no-unused-array-method-return": "warn",
|
|
106
109
|
"unicorn/no-unused-properties": "warn",
|
|
@@ -126,6 +129,7 @@ const unicornRules = {
|
|
|
126
129
|
"unicorn/no-zero-fractions": "warn",
|
|
127
130
|
"unicorn/number-literal-case": "warn",
|
|
128
131
|
"unicorn/numeric-separators-style": "warn",
|
|
132
|
+
"unicorn/prefer-abort-signal-any": "warn",
|
|
129
133
|
"unicorn/prefer-abort-signal-timeout": "warn",
|
|
130
134
|
"unicorn/prefer-add-event-listener": "warn",
|
|
131
135
|
"unicorn/prefer-add-event-listener-options": "warn",
|
|
@@ -142,6 +146,7 @@ const unicornRules = {
|
|
|
142
146
|
"unicorn/prefer-at": "warn",
|
|
143
147
|
"unicorn/prefer-bigint-literals": "warn",
|
|
144
148
|
"unicorn/prefer-blob-reading-methods": "warn",
|
|
149
|
+
"unicorn/prefer-block-statement-over-iife": "warn",
|
|
145
150
|
"unicorn/prefer-boolean-return": "warn",
|
|
146
151
|
"unicorn/prefer-class-fields": "warn",
|
|
147
152
|
"unicorn/prefer-classlist-toggle": "warn",
|
|
@@ -161,6 +166,7 @@ const unicornRules = {
|
|
|
161
166
|
"unicorn/prefer-flat-math-min-max": "warn",
|
|
162
167
|
"unicorn/prefer-get-or-insert-computed": "warn",
|
|
163
168
|
"unicorn/prefer-global-number-constants": "warn",
|
|
169
|
+
"unicorn/prefer-group-by": "warn",
|
|
164
170
|
"unicorn/prefer-has-check": "warn",
|
|
165
171
|
"unicorn/prefer-hoisting-branch-code": "warn",
|
|
166
172
|
"unicorn/prefer-https": "warn",
|
|
@@ -169,6 +175,7 @@ const unicornRules = {
|
|
|
169
175
|
"unicorn/prefer-includes": "warn",
|
|
170
176
|
"unicorn/prefer-iterable-in-constructor": "warn",
|
|
171
177
|
"unicorn/prefer-iterator-concat": "warn",
|
|
178
|
+
"unicorn/prefer-iterator-helpers": "warn",
|
|
172
179
|
"unicorn/prefer-iterator-to-array": "warn",
|
|
173
180
|
"unicorn/prefer-iterator-to-array-at-end": "warn",
|
|
174
181
|
"unicorn/prefer-keyboard-event-key": "error",
|
|
@@ -208,6 +215,7 @@ const unicornRules = {
|
|
|
208
215
|
"unicorn/prefer-set-size": "warn",
|
|
209
216
|
"unicorn/prefer-simple-condition-first": "warn",
|
|
210
217
|
"unicorn/prefer-simple-sort-comparator": "warn",
|
|
218
|
+
"unicorn/prefer-simplified-conditions": "warn",
|
|
211
219
|
"unicorn/prefer-single-array-predicate": "warn",
|
|
212
220
|
"unicorn/prefer-single-call": "warn",
|
|
213
221
|
"unicorn/prefer-single-object-destructuring": "warn",
|