@shayanthenerd/eslint-config 0.27.2 → 0.28.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/dist/configs/css.mjs +6 -2
- package/dist/configs/markdown.mjs +6 -2
- package/dist/rules/css.mjs +8 -3
- package/dist/rules/markdown.mjs +4 -2
- package/dist/rules/stylistic.mjs +22 -4
- package/dist/rules/unicorn.mjs +3 -0
- package/dist/rules/zod.mjs +6 -0
- package/dist/types/eslint-schema.d.mts +438 -336
- package/package.json +9 -9
package/dist/configs/css.mjs
CHANGED
|
@@ -4,16 +4,20 @@ import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
|
|
|
4
4
|
import { getCssRules } from "../rules/css.mjs";
|
|
5
5
|
import eslintPluginCss from "@eslint/css";
|
|
6
6
|
import { mergeConfigs } from "eslint-flat-config-utils";
|
|
7
|
+
import eslintPluginUnicorn from "eslint-plugin-unicorn";
|
|
7
8
|
import { tailwind3, tailwind4 } from "tailwind-csstree";
|
|
8
9
|
//#region src/configs/css.ts
|
|
9
10
|
function getCssConfig(options) {
|
|
10
|
-
const { css, tailwind } = options.configs;
|
|
11
|
+
const { css, unicorn, tailwind } = options.configs;
|
|
11
12
|
const { overrides } = isEnabled(css) ? css : defaultOptions.configs.css;
|
|
12
13
|
const tailwindSyntax = isEnabled(tailwind) && tailwind.entryPoint ? tailwind4 : tailwind3;
|
|
13
14
|
return mergeConfigs({
|
|
14
15
|
name: "shayanthenerd/css",
|
|
15
16
|
files: [globs.css],
|
|
16
|
-
plugins: {
|
|
17
|
+
plugins: {
|
|
18
|
+
css: eslintPluginCss,
|
|
19
|
+
...isEnabled(unicorn) && { unicorn: eslintPluginUnicorn }
|
|
20
|
+
},
|
|
17
21
|
language: "css/css",
|
|
18
22
|
languageOptions: {
|
|
19
23
|
tolerant: true,
|
|
@@ -3,15 +3,19 @@ import { isEnabled } from "../utils/isEnabled.mjs";
|
|
|
3
3
|
import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
|
|
4
4
|
import { getMarkdownRules } from "../rules/markdown.mjs";
|
|
5
5
|
import { mergeConfigs } from "eslint-flat-config-utils";
|
|
6
|
+
import eslintPluginUnicorn from "eslint-plugin-unicorn";
|
|
6
7
|
import eslintPluginMarkdown from "@eslint/markdown";
|
|
7
8
|
//#region src/configs/markdown.ts
|
|
8
9
|
function getMarkdownConfig(options) {
|
|
9
|
-
const { markdown } = options.configs;
|
|
10
|
+
const { unicorn, markdown } = options.configs;
|
|
10
11
|
const { language, frontmatter, overrides } = isEnabled(markdown) ? markdown : defaultOptions.configs.markdown;
|
|
11
12
|
return mergeConfigs({
|
|
12
13
|
name: "shayanthenerd/markdown",
|
|
13
14
|
files: [globs.markdown],
|
|
14
|
-
plugins: {
|
|
15
|
+
plugins: {
|
|
16
|
+
markdown: eslintPluginMarkdown,
|
|
17
|
+
...isEnabled(unicorn) && { unicorn: eslintPluginUnicorn }
|
|
18
|
+
},
|
|
15
19
|
language: `markdown/${language}`,
|
|
16
20
|
languageOptions: {
|
|
17
21
|
math: true,
|
package/dist/rules/css.mjs
CHANGED
|
@@ -46,16 +46,16 @@ const allowedPhysicalProperties = [
|
|
|
46
46
|
"contain-intrinsic-height"
|
|
47
47
|
];
|
|
48
48
|
function getCssRules(options) {
|
|
49
|
-
const { useBaseline } = options.configs;
|
|
49
|
+
const { unicorn, tailwind, useBaseline } = options.configs;
|
|
50
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
|
+
const cssRules = {
|
|
52
52
|
"css/font-family-fallbacks": "warn",
|
|
53
53
|
"css/no-duplicate-imports": "error",
|
|
54
54
|
"css/no-duplicate-keyframe-selectors": "error",
|
|
55
55
|
"css/no-empty-blocks": "error",
|
|
56
56
|
"css/no-important": "warn",
|
|
57
57
|
"css/no-invalid-at-rule-placement": "error",
|
|
58
|
-
"css/no-invalid-at-rules": "error",
|
|
58
|
+
"css/no-invalid-at-rules": isEnabled(tailwind) ? "off" : "error",
|
|
59
59
|
"css/no-invalid-named-grid-areas": "error",
|
|
60
60
|
"css/no-invalid-properties": ["error", { allowUnknownVariables: true }],
|
|
61
61
|
"css/no-unmatchable-selectors": "error",
|
|
@@ -87,6 +87,11 @@ function getCssRules(options) {
|
|
|
87
87
|
allowUnits: userAllowedUnits
|
|
88
88
|
}] : "off"
|
|
89
89
|
};
|
|
90
|
+
if (isEnabled(unicorn)) {
|
|
91
|
+
cssRules["unicorn/no-shorthand-property-overrides"] = "warn";
|
|
92
|
+
cssRules["unicorn/prefer-explicit-viewport-units"] = "warn";
|
|
93
|
+
}
|
|
94
|
+
return cssRules;
|
|
90
95
|
}
|
|
91
96
|
//#endregion
|
|
92
97
|
export { getCssRules };
|
package/dist/rules/markdown.mjs
CHANGED
|
@@ -2,10 +2,10 @@ import { isEnabled } from "../utils/isEnabled.mjs";
|
|
|
2
2
|
import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
|
|
3
3
|
//#region src/rules/markdown.ts
|
|
4
4
|
function getMarkdownRules(options) {
|
|
5
|
-
const { markdown } = options.configs;
|
|
5
|
+
const { unicorn, markdown } = options.configs;
|
|
6
6
|
const { language, allowedHtmlTags: userAllowedHtmlTags } = isEnabled(markdown) ? markdown : defaultOptions.configs.markdown;
|
|
7
7
|
const isCommonMark = language === "commonmark";
|
|
8
|
-
|
|
8
|
+
const markdownRules = {
|
|
9
9
|
"markdown/fenced-code-language": "error",
|
|
10
10
|
"markdown/heading-increment": "warn",
|
|
11
11
|
"markdown/no-bare-urls": isCommonMark ? "off" : "warn",
|
|
@@ -47,6 +47,8 @@ function getMarkdownRules(options) {
|
|
|
47
47
|
"markdown/require-alt-text": "warn",
|
|
48
48
|
"markdown/table-column-count": [isCommonMark ? "off" : "error", { checkMissingCells: true }]
|
|
49
49
|
};
|
|
50
|
+
if (isEnabled(unicorn)) markdownRules["unicorn/no-missing-local-resource"] = "error";
|
|
51
|
+
return markdownRules;
|
|
50
52
|
}
|
|
51
53
|
//#endregion
|
|
52
54
|
export { getMarkdownRules };
|
package/dist/rules/stylistic.mjs
CHANGED
|
@@ -165,10 +165,10 @@ function getStylisticRules(options) {
|
|
|
165
165
|
},
|
|
166
166
|
{
|
|
167
167
|
prev: [
|
|
168
|
-
"var",
|
|
169
|
-
"let",
|
|
170
168
|
"const",
|
|
171
|
-
"
|
|
169
|
+
"let",
|
|
170
|
+
"using",
|
|
171
|
+
"var"
|
|
172
172
|
],
|
|
173
173
|
next: "block-like",
|
|
174
174
|
blankLine: "any"
|
|
@@ -178,10 +178,28 @@ function getStylisticRules(options) {
|
|
|
178
178
|
next: "*",
|
|
179
179
|
blankLine: "always"
|
|
180
180
|
},
|
|
181
|
+
{
|
|
182
|
+
prev: [
|
|
183
|
+
"if",
|
|
184
|
+
"switch",
|
|
185
|
+
"try",
|
|
186
|
+
"for",
|
|
187
|
+
"while",
|
|
188
|
+
"do",
|
|
189
|
+
"with"
|
|
190
|
+
],
|
|
191
|
+
next: [
|
|
192
|
+
"break",
|
|
193
|
+
"continue",
|
|
194
|
+
"return",
|
|
195
|
+
"throw"
|
|
196
|
+
],
|
|
197
|
+
blankLine: "any"
|
|
198
|
+
},
|
|
181
199
|
{
|
|
182
200
|
prev: ["case", "default"],
|
|
183
201
|
next: ["case", "default"],
|
|
184
|
-
blankLine: "
|
|
202
|
+
blankLine: "never"
|
|
185
203
|
}
|
|
186
204
|
],
|
|
187
205
|
"@stylistic/quote-props": ["warn", "consistent-as-needed"],
|
package/dist/rules/unicorn.mjs
CHANGED
|
@@ -69,6 +69,7 @@ const unicornRules = {
|
|
|
69
69
|
"unicorn/no-magic-array-flat-depth": "warn",
|
|
70
70
|
"unicorn/no-mismatched-map-key": "warn",
|
|
71
71
|
"unicorn/no-misrefactored-assignment": "warn",
|
|
72
|
+
"unicorn/no-multiple-promise-resolver-calls": "error",
|
|
72
73
|
"unicorn/no-negated-array-predicate": "warn",
|
|
73
74
|
"unicorn/no-negated-comparison": ["warn", { checkLogicalExpressions: false }],
|
|
74
75
|
"unicorn/no-negation-in-equality-check": "warn",
|
|
@@ -120,6 +121,7 @@ const unicornRules = {
|
|
|
120
121
|
"unicorn/no-useless-logical-operand": "warn",
|
|
121
122
|
"unicorn/no-useless-override": "warn",
|
|
122
123
|
"unicorn/no-useless-promise-resolve-reject": "warn",
|
|
124
|
+
"unicorn/no-useless-re-export": "warn",
|
|
123
125
|
"unicorn/no-useless-recursion": "warn",
|
|
124
126
|
"unicorn/no-useless-spread": "warn",
|
|
125
127
|
"unicorn/no-useless-switch-case": "warn",
|
|
@@ -231,6 +233,7 @@ const unicornRules = {
|
|
|
231
233
|
"unicorn/prefer-string-trim-start-end": "warn",
|
|
232
234
|
"unicorn/prefer-structured-clone": "warn",
|
|
233
235
|
"unicorn/prefer-temporal": "warn",
|
|
236
|
+
"unicorn/prefer-then-catch": "warn",
|
|
234
237
|
"unicorn/prefer-toggle-attribute": "warn",
|
|
235
238
|
"unicorn/prefer-top-level-await": "warn",
|
|
236
239
|
"unicorn/prefer-type-error": "warn",
|
package/dist/rules/zod.mjs
CHANGED
|
@@ -12,12 +12,15 @@ function getZodRules(options) {
|
|
|
12
12
|
"zod-mini/consistent-schema-var-name": "warn",
|
|
13
13
|
"zod-mini/no-any-schema": "error",
|
|
14
14
|
"zod-mini/no-coerce-boolean": "warn",
|
|
15
|
+
"zod-mini/no-conflicting-checks": "warn",
|
|
15
16
|
"zod-mini/no-duplicate-schema-methods": "error",
|
|
16
17
|
"zod-mini/no-empty-custom-schema": "error",
|
|
17
18
|
"zod-mini/no-throw-in-refine": "error",
|
|
18
19
|
"zod-mini/no-transform-in-record-key": "error",
|
|
20
|
+
"zod-mini/no-unnecessary-readonly": "warn",
|
|
19
21
|
"zod-mini/prefer-enum-over-literal-union": "warn",
|
|
20
22
|
"zod-mini/prefer-meta": "warn",
|
|
23
|
+
"zod-mini/prefer-tuple-over-array-length": "warn",
|
|
21
24
|
"zod-mini/require-brand-type-parameter": "error",
|
|
22
25
|
"zod-mini/require-error-message": "warn"
|
|
23
26
|
} : {
|
|
@@ -28,6 +31,7 @@ function getZodRules(options) {
|
|
|
28
31
|
"zod/consistent-schema-var-name": "warn",
|
|
29
32
|
"zod/no-any-schema": "error",
|
|
30
33
|
"zod/no-coerce-boolean": "warn",
|
|
34
|
+
"zod/no-conflicting-checks": "error",
|
|
31
35
|
"zod/no-duplicate-schema-methods": "error",
|
|
32
36
|
"zod/no-empty-custom-schema": "error",
|
|
33
37
|
"zod/no-native-enum": "warn",
|
|
@@ -43,6 +47,7 @@ function getZodRules(options) {
|
|
|
43
47
|
"zod/no-schema-with-is-optional": "warn",
|
|
44
48
|
"zod/no-throw-in-refine": "error",
|
|
45
49
|
"zod/no-transform-in-record-key": "error",
|
|
50
|
+
"zod/no-unnecessary-readonly": "warn",
|
|
46
51
|
"zod/prefer-enum-over-literal-union": "warn",
|
|
47
52
|
"zod/prefer-loose-object": "warn",
|
|
48
53
|
"zod/prefer-meta": "warn",
|
|
@@ -50,6 +55,7 @@ function getZodRules(options) {
|
|
|
50
55
|
"zod/prefer-strict-object": "warn",
|
|
51
56
|
"zod/prefer-top-level-string-formats": "warn",
|
|
52
57
|
"zod/prefer-trim-before-string-length-checks": "error",
|
|
58
|
+
"zod/prefer-tuple-over-array-length": "warn",
|
|
53
59
|
"zod/require-brand-type-parameter": "error",
|
|
54
60
|
"zod/require-error-message": "warn"
|
|
55
61
|
};
|