@shayanthenerd/eslint-config 0.27.1 → 0.28.0
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/astro.mjs +0 -2
- package/dist/rules/css.mjs +8 -3
- package/dist/rules/markdown.mjs +4 -2
- package/dist/rules/tailwind.mjs +1 -1
- package/dist/rules/unicorn.mjs +3 -0
- package/dist/types/eslint-schema.d.mts +400 -337
- package/package.json +11 -11
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/astro.mjs
CHANGED
|
@@ -11,12 +11,10 @@ const astroRules = {
|
|
|
11
11
|
"astro/no-exports-from-components": "error",
|
|
12
12
|
"astro/no-prerender-export-outside-pages": "error",
|
|
13
13
|
"astro/no-unused-define-vars-in-style": "warn",
|
|
14
|
-
"astro/valid-compile": "error",
|
|
15
14
|
"astro/no-set-html-directive": "warn",
|
|
16
15
|
"astro/no-unsafe-inline-scripts": "warn",
|
|
17
16
|
"astro/no-set-text-directive": "warn",
|
|
18
17
|
"astro/no-unused-css-selector": "warn",
|
|
19
|
-
"astro/no-omitted-end-tags": "warn",
|
|
20
18
|
"astro/prefer-class-list-directive": "warn",
|
|
21
19
|
"astro/prefer-split-class-list": "warn",
|
|
22
20
|
"astro/jsx-a11y/alt-text": "error",
|
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/tailwind.mjs
CHANGED
|
@@ -35,7 +35,7 @@ function getTailwindRules(options) {
|
|
|
35
35
|
const isTailwindV4 = isEnabled(tailwind) && tailwind.entryPoint;
|
|
36
36
|
return {
|
|
37
37
|
"better-tailwindcss/enforce-canonical-classes": "warn",
|
|
38
|
-
"better-tailwindcss/enforce-consistent-class-order":
|
|
38
|
+
"better-tailwindcss/enforce-consistent-class-order": "warn",
|
|
39
39
|
"better-tailwindcss/enforce-consistent-line-wrapping": [multilineSort ? "warn" : "off", {
|
|
40
40
|
indent,
|
|
41
41
|
tabWidth: indent,
|
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",
|