@shayanthenerd/eslint-config 0.30.2 → 0.31.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/astro.mjs +6 -5
- package/dist/configs/baseline.mjs +1 -1
- package/dist/configs/css.mjs +5 -4
- package/dist/configs/cypress.mjs +4 -3
- package/dist/configs/html.mjs +4 -3
- package/dist/configs/importX.mjs +5 -4
- package/dist/configs/javascript.mjs +4 -3
- package/dist/configs/markdown.mjs +4 -3
- package/dist/configs/next.mjs +4 -3
- package/dist/configs/node.mjs +6 -5
- package/dist/configs/nuxt.mjs +23 -22
- package/dist/configs/packageJson.mjs +4 -3
- package/dist/configs/perfectionist.mjs +5 -4
- package/dist/configs/playwright.mjs +4 -3
- package/dist/configs/promise.mjs +5 -4
- package/dist/configs/react.mjs +4 -3
- package/dist/configs/storybook.mjs +4 -3
- package/dist/configs/stylistic.mjs +5 -4
- package/dist/configs/tailwind.mjs +5 -4
- package/dist/configs/typescript.mjs +5 -4
- package/dist/configs/unicorn.mjs +5 -4
- package/dist/configs/vitest.mjs +4 -3
- package/dist/configs/vue.mjs +5 -4
- package/dist/configs/zod.mjs +5 -4
- package/dist/helpers/options/enableDetectedConfigs.mjs +1 -1
- package/dist/helpers/options/mergeWithDefaults.mjs +1 -1
- package/dist/index.mjs +19 -18
- package/dist/rules/baseline.mjs +1 -1
- package/dist/rules/css.mjs +1 -1
- package/dist/rules/html.mjs +1 -1
- package/dist/rules/markdown.mjs +1 -1
- package/dist/rules/perfectionist.mjs +8 -13
- package/dist/rules/react.mjs +1 -1
- package/dist/rules/stylistic.mjs +4 -2
- package/dist/rules/tailwind.mjs +1 -1
- package/dist/rules/typescript.mjs +2 -2
- package/dist/rules/unicorn.mjs +1 -1
- package/dist/rules/vue.mjs +4 -3
- package/dist/rules/zod.mjs +3 -1
- package/dist/types/eslint-schema.d.mts +969 -776
- package/dist/types/index.d.mts +8 -6
- package/package.json +24 -22
package/dist/configs/vue.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { globs } from "../helpers/globs.mjs";
|
|
2
|
-
import { isEnabled } from "../utils/isEnabled.mjs";
|
|
3
2
|
import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
|
|
3
|
+
import { isEnabled } from "../utils/isEnabled.mjs";
|
|
4
4
|
import { getVueRules } from "../rules/vue.mjs";
|
|
5
5
|
import { mergeConfigs } from "eslint-flat-config-utils";
|
|
6
|
-
import eslintPluginVue from "eslint-plugin-vue";
|
|
7
6
|
import { parser } from "typescript-eslint";
|
|
7
|
+
import eslintPluginVue from "eslint-plugin-vue";
|
|
8
8
|
import eslintPluginVueAccessibility from "eslint-plugin-vuejs-accessibility";
|
|
9
9
|
//#region src/configs/vue.ts
|
|
10
10
|
const baseVueConfig = eslintPluginVue.configs["flat/base"].find((config) => config.languageOptions?.parser);
|
|
@@ -12,7 +12,7 @@ function getVueConfig(options) {
|
|
|
12
12
|
const { vue } = options.configs;
|
|
13
13
|
const { overrides } = isEnabled(vue) ? vue : defaultOptions.configs.vue;
|
|
14
14
|
const isVueAccessibilityEnabled = isEnabled(vue) && isEnabled(vue.accessibility);
|
|
15
|
-
|
|
15
|
+
const vueConfig = {
|
|
16
16
|
name: "shayanthenerd/vue",
|
|
17
17
|
files: [
|
|
18
18
|
globs.src,
|
|
@@ -34,7 +34,8 @@ function getVueConfig(options) {
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
rules: getVueRules(options)
|
|
37
|
-
}
|
|
37
|
+
};
|
|
38
|
+
return mergeConfigs(vueConfig, overrides);
|
|
38
39
|
}
|
|
39
40
|
//#endregion
|
|
40
41
|
export { getVueConfig };
|
package/dist/configs/zod.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { isTruthy } from "../utils/isTruthy.mjs";
|
|
2
1
|
import { globs } from "../helpers/globs.mjs";
|
|
3
|
-
import { isEnabled } from "../utils/isEnabled.mjs";
|
|
4
2
|
import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
|
|
3
|
+
import { isEnabled } from "../utils/isEnabled.mjs";
|
|
4
|
+
import { isTruthy } from "../utils/isTruthy.mjs";
|
|
5
5
|
import { getZodRules } from "../rules/zod.mjs";
|
|
6
6
|
import { mergeConfigs } from "eslint-flat-config-utils";
|
|
7
7
|
import eslintPluginZod from "eslint-plugin-zod";
|
|
@@ -10,7 +10,7 @@ import eslintPluginZodMini from "eslint-plugin-zod-mini";
|
|
|
10
10
|
function getZodConfig(options) {
|
|
11
11
|
const { zod, vue, astro } = options.configs;
|
|
12
12
|
const { mini, overrides } = isEnabled(zod) ? zod : defaultOptions.configs.zod;
|
|
13
|
-
|
|
13
|
+
const zodConfig = {
|
|
14
14
|
name: `shayanthenerd/${mini ? "zod-mini" : "zod"}`,
|
|
15
15
|
files: [
|
|
16
16
|
globs.src,
|
|
@@ -20,7 +20,8 @@ function getZodConfig(options) {
|
|
|
20
20
|
].filter(isTruthy),
|
|
21
21
|
plugins: mini ? { "zod-mini": eslintPluginZodMini } : { zod: eslintPluginZod },
|
|
22
22
|
rules: getZodRules(options)
|
|
23
|
-
}
|
|
23
|
+
};
|
|
24
|
+
return mergeConfigs(zodConfig, overrides);
|
|
24
25
|
}
|
|
25
26
|
//#endregion
|
|
26
27
|
export { getZodConfig };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isEnabled } from "../../utils/isEnabled.mjs";
|
|
2
1
|
import { defaultOptions } from "./defaultOptions.mjs";
|
|
2
|
+
import { isEnabled } from "../../utils/isEnabled.mjs";
|
|
3
3
|
import { isPackageDetected, logDetectedPackages } from "../isPackageDetected.mjs";
|
|
4
4
|
//#region src/helpers/options/enableDetectedConfigs.ts
|
|
5
5
|
function enableDetectedConfigs(options) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defaultOptions } from "./defaultOptions.mjs";
|
|
2
|
-
import { isEmptyString } from "../../utils/isEmptyString.mjs";
|
|
3
2
|
import { enableDetectedConfigs } from "./enableDetectedConfigs.mjs";
|
|
3
|
+
import { isEmptyString } from "../../utils/isEmptyString.mjs";
|
|
4
4
|
import { createDefu } from "defu";
|
|
5
5
|
//#region src/helpers/options/mergeWithDefaults.ts
|
|
6
6
|
const mergeOptions = createDefu((object, key, value) => {
|
package/dist/index.mjs
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { isTruthy } from "./utils/isTruthy.mjs";
|
|
2
1
|
import { isEnabled } from "./utils/isEnabled.mjs";
|
|
2
|
+
import { getAstroConfig } from "./configs/astro.mjs";
|
|
3
|
+
import { isTruthy } from "./utils/isTruthy.mjs";
|
|
4
|
+
import { getBaselineConfig } from "./configs/baseline.mjs";
|
|
3
5
|
import { getCssConfig } from "./configs/css.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import { getZodConfig } from "./configs/zod.mjs";
|
|
6
|
+
import { getCypressConfig } from "./configs/cypress.mjs";
|
|
6
7
|
import { getHtmlConfig } from "./configs/html.mjs";
|
|
8
|
+
import { getImportXConfig } from "./configs/importX.mjs";
|
|
9
|
+
import { getJavascriptConfig } from "./configs/javascript.mjs";
|
|
10
|
+
import { getMarkdownConfig } from "./configs/markdown.mjs";
|
|
7
11
|
import { getNextConfig } from "./configs/next.mjs";
|
|
8
12
|
import { getNodeConfig } from "./configs/node.mjs";
|
|
9
13
|
import { getNuxtConfigs } from "./configs/nuxt.mjs";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { getCypressConfig } from "./configs/cypress.mjs";
|
|
14
|
-
import { getImportXConfig } from "./configs/importX.mjs";
|
|
14
|
+
import { getPackageJsonConfig } from "./configs/packageJson.mjs";
|
|
15
|
+
import { getPerfectionistConfig } from "./configs/perfectionist.mjs";
|
|
16
|
+
import { getPlaywrightConfig } from "./configs/playwright.mjs";
|
|
15
17
|
import { getPromiseConfig } from "./configs/promise.mjs";
|
|
16
|
-
import {
|
|
17
|
-
import { getBaselineConfig } from "./configs/baseline.mjs";
|
|
18
|
-
import { getMarkdownConfig } from "./configs/markdown.mjs";
|
|
19
|
-
import { getTailwindConfig } from "./configs/tailwind.mjs";
|
|
18
|
+
import { getReactConfig } from "./configs/react.mjs";
|
|
20
19
|
import { getStorybookConfig } from "./configs/storybook.mjs";
|
|
21
20
|
import { getStylisticConfig } from "./configs/stylistic.mjs";
|
|
22
|
-
import {
|
|
23
|
-
import { getPlaywrightConfig } from "./configs/playwright.mjs";
|
|
21
|
+
import { getTailwindConfig } from "./configs/tailwind.mjs";
|
|
24
22
|
import { getTypescriptConfig } from "./configs/typescript.mjs";
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
23
|
+
import { getUnicornConfig } from "./configs/unicorn.mjs";
|
|
24
|
+
import { getVitestConfig } from "./configs/vitest.mjs";
|
|
25
|
+
import { getVueConfig } from "./configs/vue.mjs";
|
|
26
|
+
import { getZodConfig } from "./configs/zod.mjs";
|
|
27
27
|
import { getIgnorePatterns } from "./helpers/ignores/getIgnorePatterns.mjs";
|
|
28
28
|
import { mergeWithDefaults } from "./helpers/options/mergeWithDefaults.mjs";
|
|
29
29
|
import { defineConfig as defineConfig$1, globalIgnores } from "eslint/config";
|
|
@@ -77,7 +77,7 @@ function defineConfig(...args) {
|
|
|
77
77
|
gitignore,
|
|
78
78
|
patterns: ignores
|
|
79
79
|
});
|
|
80
|
-
|
|
80
|
+
const configObjects = [
|
|
81
81
|
{
|
|
82
82
|
name: "shayanthenerd/project",
|
|
83
83
|
linterOptions,
|
|
@@ -110,7 +110,8 @@ function defineConfig(...args) {
|
|
|
110
110
|
isEnabled(cypress) && getCypressConfig(mergedOptions),
|
|
111
111
|
isEnabled(playwright) && getPlaywrightConfig(mergedOptions),
|
|
112
112
|
...userConfigs
|
|
113
|
-
].filter(isTruthy)
|
|
113
|
+
].filter(isTruthy);
|
|
114
|
+
return defineConfig$1(configObjects);
|
|
114
115
|
}
|
|
115
116
|
//#endregion
|
|
116
117
|
export { defineConfig };
|
package/dist/rules/baseline.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isEnabled } from "../utils/isEnabled.mjs";
|
|
2
1
|
import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
|
|
2
|
+
import { isEnabled } from "../utils/isEnabled.mjs";
|
|
3
3
|
//#region src/rules/baseline.ts
|
|
4
4
|
function getBaselineRules(options) {
|
|
5
5
|
const baselineOption = options.configs.baseline;
|
package/dist/rules/css.mjs
CHANGED
package/dist/rules/html.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isEnabled } from "../utils/isEnabled.mjs";
|
|
2
1
|
import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
|
|
2
|
+
import { isEnabled } from "../utils/isEnabled.mjs";
|
|
3
3
|
//#region src/rules/html.ts
|
|
4
4
|
function getHtmlRules(options) {
|
|
5
5
|
const { html, unicorn, tailwind, stylistic, baseline } = options.configs;
|
package/dist/rules/markdown.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isEnabled } from "../utils/isEnabled.mjs";
|
|
2
1
|
import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
|
|
2
|
+
import { isEnabled } from "../utils/isEnabled.mjs";
|
|
3
3
|
//#region src/rules/markdown.ts
|
|
4
4
|
function getMarkdownRules(options) {
|
|
5
5
|
const { unicorn, markdown } = options.configs;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isEnabled } from "../utils/isEnabled.mjs";
|
|
2
1
|
import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
|
|
2
|
+
import { isEnabled } from "../utils/isEnabled.mjs";
|
|
3
3
|
//#region src/rules/perfectionist.ts
|
|
4
4
|
const literalCustomGroups = [
|
|
5
5
|
{
|
|
@@ -102,16 +102,15 @@ const sortImportsGroups = [
|
|
|
102
102
|
{ newlinesBetween: 0 },
|
|
103
103
|
[
|
|
104
104
|
"internal",
|
|
105
|
-
"index",
|
|
106
105
|
"parent",
|
|
106
|
+
"index",
|
|
107
107
|
"sibling"
|
|
108
108
|
],
|
|
109
109
|
["import", "unknown"]
|
|
110
110
|
];
|
|
111
111
|
function getPerfectionistRules(options) {
|
|
112
|
-
const { env, tsConfig, configs: { stylistic
|
|
112
|
+
const { env, tsConfig, configs: { stylistic } } = options;
|
|
113
113
|
const { maxLineLength } = isEnabled(stylistic) ? stylistic : defaultOptions.configs.stylistic;
|
|
114
|
-
const { sortType } = isEnabled(perfectionist) ? perfectionist : defaultOptions.configs.perfectionist;
|
|
115
114
|
return {
|
|
116
115
|
"perfectionist/sort-maps": "warn",
|
|
117
116
|
"perfectionist/sort-exports": "warn",
|
|
@@ -123,17 +122,13 @@ function getPerfectionistRules(options) {
|
|
|
123
122
|
"perfectionist/sort-imports": ["warn", {
|
|
124
123
|
environment: env === "bun" ? env : "node",
|
|
125
124
|
tsconfig: tsConfig || { rootDir: "" },
|
|
125
|
+
maxLineLength,
|
|
126
|
+
sortBy: "path",
|
|
127
|
+
type: "subgroup-order",
|
|
126
128
|
sortSideEffects: true,
|
|
127
|
-
fallbackSort: {
|
|
128
|
-
order: "asc",
|
|
129
|
-
type: "natural"
|
|
130
|
-
},
|
|
131
129
|
partitionByComment: true,
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
maxLineLength,
|
|
135
|
-
customGroups: sortImportsCustomGroups,
|
|
136
|
-
groups: sortImportsGroups
|
|
130
|
+
groups: sortImportsGroups,
|
|
131
|
+
customGroups: sortImportsCustomGroups
|
|
137
132
|
}]
|
|
138
133
|
};
|
|
139
134
|
}
|
package/dist/rules/react.mjs
CHANGED
package/dist/rules/stylistic.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isEnabled } from "../utils/isEnabled.mjs";
|
|
2
1
|
import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
|
|
2
|
+
import { isEnabled } from "../utils/isEnabled.mjs";
|
|
3
3
|
//#region src/rules/stylistic.ts
|
|
4
4
|
function getStylisticRules(options) {
|
|
5
5
|
const { stylistic } = options.configs;
|
|
@@ -113,7 +113,9 @@ function getStylisticRules(options) {
|
|
|
113
113
|
"?": "before",
|
|
114
114
|
":": "before",
|
|
115
115
|
"|": "before",
|
|
116
|
-
"&": "before"
|
|
116
|
+
"&": "before",
|
|
117
|
+
"||": "ignore",
|
|
118
|
+
"&&": "ignore"
|
|
117
119
|
} }
|
|
118
120
|
],
|
|
119
121
|
"@stylistic/padded-blocks": [
|
package/dist/rules/tailwind.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isEnabled } from "../utils/isEnabled.mjs";
|
|
2
1
|
import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
|
|
2
|
+
import { isEnabled } from "../utils/isEnabled.mjs";
|
|
3
3
|
//#region src/rules/tailwind.ts
|
|
4
4
|
const nonLogicalTailwindUtilityPatterns = [
|
|
5
5
|
"-?top(?:-.+)?",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isEnabled } from "../utils/isEnabled.mjs";
|
|
2
1
|
import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
|
|
2
|
+
import { isEnabled } from "../utils/isEnabled.mjs";
|
|
3
3
|
//#region src/rules/typescript.ts
|
|
4
4
|
function getTypescriptRules(options) {
|
|
5
5
|
const { typescript } = options.configs;
|
|
@@ -38,7 +38,7 @@ function getTypescriptRules(options) {
|
|
|
38
38
|
"@typescript-eslint/no-require-imports": "error",
|
|
39
39
|
"@typescript-eslint/no-this-alias": "error",
|
|
40
40
|
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "error",
|
|
41
|
-
"@typescript-eslint/no-unnecessary-condition": "error",
|
|
41
|
+
"@typescript-eslint/no-unnecessary-condition": ["error", { allowConstantLoopConditions: "only-allowed-literals" }],
|
|
42
42
|
"@typescript-eslint/no-unnecessary-template-expression": "error",
|
|
43
43
|
"@typescript-eslint/no-unnecessary-type-arguments": "error",
|
|
44
44
|
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
package/dist/rules/unicorn.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isEnabled } from "../utils/isEnabled.mjs";
|
|
2
1
|
import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
|
|
2
|
+
import { isEnabled } from "../utils/isEnabled.mjs";
|
|
3
3
|
//#region src/rules/unicorn.ts
|
|
4
4
|
function getUnicornRules(options) {
|
|
5
5
|
const { unicorn, stylistic } = options.configs;
|
package/dist/rules/vue.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { isTruthy } from "../utils/isTruthy.mjs";
|
|
2
|
-
import { isEnabled } from "../utils/isEnabled.mjs";
|
|
3
1
|
import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
|
|
4
|
-
import {
|
|
2
|
+
import { isEnabled } from "../utils/isEnabled.mjs";
|
|
3
|
+
import { isTruthy } from "../utils/isTruthy.mjs";
|
|
5
4
|
import { getRestrictedVueElements } from "../helpers/vue/getRestrictedVueElements.mjs";
|
|
5
|
+
import { getRestrictedVueInputs } from "../helpers/vue/getRestrictedVueInputs.mjs";
|
|
6
6
|
//#region src/rules/vue.ts
|
|
7
7
|
function getVueRules(options) {
|
|
8
8
|
const { typescript, stylistic, vue, nuxt } = options.configs;
|
|
@@ -355,6 +355,7 @@ function getVueRules(options) {
|
|
|
355
355
|
],
|
|
356
356
|
"vue/no-root-v-if": "warn",
|
|
357
357
|
"vue/no-setup-props-reactivity-loss": "error",
|
|
358
|
+
"vue/no-shadow-native-events": "error",
|
|
358
359
|
"vue/no-static-inline-styles": ["warn", { allowBinding: true }],
|
|
359
360
|
"vue/no-this-in-before-route-enter": "error",
|
|
360
361
|
"vue/no-undef-components": ["error", { ignorePatterns: [
|
package/dist/rules/zod.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isEnabled } from "../utils/isEnabled.mjs";
|
|
2
1
|
import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
|
|
2
|
+
import { isEnabled } from "../utils/isEnabled.mjs";
|
|
3
3
|
//#region src/rules/zod.ts
|
|
4
4
|
function getZodRules(options) {
|
|
5
5
|
const { zod } = options.configs;
|
|
@@ -21,6 +21,7 @@ function getZodRules(options) {
|
|
|
21
21
|
"zod-mini/no-transform-in-record-key": "error",
|
|
22
22
|
"zod-mini/no-unnecessary-readonly": "warn",
|
|
23
23
|
"zod-mini/prefer-enum-over-literal-union": "warn",
|
|
24
|
+
"zod-mini/prefer-map-set-size-over-min-max": "warn",
|
|
24
25
|
"zod-mini/prefer-meta": "warn",
|
|
25
26
|
"zod-mini/prefer-nullish": "warn",
|
|
26
27
|
"zod-mini/prefer-tuple-over-array-length": "warn",
|
|
@@ -53,6 +54,7 @@ function getZodRules(options) {
|
|
|
53
54
|
"zod/no-unnecessary-readonly": "warn",
|
|
54
55
|
"zod/prefer-enum-over-literal-union": "warn",
|
|
55
56
|
"zod/prefer-loose-object": "warn",
|
|
57
|
+
"zod/prefer-map-set-size-over-min-max": "warn",
|
|
56
58
|
"zod/prefer-meta": "warn",
|
|
57
59
|
"zod/prefer-nullish": "warn",
|
|
58
60
|
"zod/prefer-meta-last": "warn",
|