@shayanthenerd/eslint-config 0.30.3 → 0.32.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/README.md +15 -5
- 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 +5 -4
- 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/tanstack.mjs +26 -0
- 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/defaultOptions.mjs +6 -0
- package/dist/helpers/options/enableDetectedConfigs.mjs +11 -1
- package/dist/helpers/options/mergeWithDefaults.mjs +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +22 -53
- 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/tanstack.mjs +39 -0
- 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 +1 -1
- package/dist/types/eslint-schema.d.mts +678 -430
- package/dist/types/index.d.mts +15 -6
- package/dist/types/options/tanstack.d.mts +32 -0
- package/package.json +23 -18
|
@@ -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 { getTypescriptRules } from "../rules/typescript.mjs";
|
|
6
6
|
import { mergeConfigs } from "eslint-flat-config-utils";
|
|
7
7
|
import { parser, plugin } from "typescript-eslint";
|
|
@@ -11,7 +11,7 @@ function getTypescriptConfig(options) {
|
|
|
11
11
|
const { tsConfig, configs: { vue, astro, typescript } } = options;
|
|
12
12
|
const { allowedDefaultProjects } = isEnabled(typescript) ? typescript : defaultOptions.configs.typescript;
|
|
13
13
|
const { overrides } = isEnabled(typescript) ? typescript : defaultOptions.configs.typescript;
|
|
14
|
-
|
|
14
|
+
const typescriptConfig = {
|
|
15
15
|
name: "shayanthenerd/typescript",
|
|
16
16
|
files: [
|
|
17
17
|
globs.src,
|
|
@@ -32,7 +32,8 @@ function getTypescriptConfig(options) {
|
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
rules: getTypescriptRules(options)
|
|
35
|
-
}
|
|
35
|
+
};
|
|
36
|
+
return mergeConfigs(typescriptConfig, overrides);
|
|
36
37
|
}
|
|
37
38
|
//#endregion
|
|
38
39
|
export { getTypescriptConfig };
|
package/dist/configs/unicorn.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 { getUnicornRules } from "../rules/unicorn.mjs";
|
|
6
6
|
import { mergeConfigs } from "eslint-flat-config-utils";
|
|
7
7
|
import eslintPluginUnicorn from "eslint-plugin-unicorn";
|
|
@@ -9,7 +9,7 @@ import eslintPluginUnicorn from "eslint-plugin-unicorn";
|
|
|
9
9
|
function getUnicornConfig(options) {
|
|
10
10
|
const { vue, astro, unicorn } = options.configs;
|
|
11
11
|
const { overrides } = isEnabled(unicorn) ? unicorn : defaultOptions.configs.unicorn;
|
|
12
|
-
|
|
12
|
+
const astroConfig = {
|
|
13
13
|
name: "shayanthenerd/unicorn",
|
|
14
14
|
files: [
|
|
15
15
|
globs.src,
|
|
@@ -19,7 +19,8 @@ function getUnicornConfig(options) {
|
|
|
19
19
|
].filter(isTruthy),
|
|
20
20
|
plugins: { unicorn: eslintPluginUnicorn },
|
|
21
21
|
rules: getUnicornRules(options)
|
|
22
|
-
}
|
|
22
|
+
};
|
|
23
|
+
return mergeConfigs(astroConfig, overrides);
|
|
23
24
|
}
|
|
24
25
|
//#endregion
|
|
25
26
|
export { getUnicornConfig };
|
package/dist/configs/vitest.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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 { getVitestRules } from "../rules/vitest.mjs";
|
|
5
5
|
import { mergeConfigs } from "eslint-flat-config-utils";
|
|
6
6
|
import eslintPluginVitest from "@vitest/eslint-plugin";
|
|
@@ -8,12 +8,13 @@ import eslintPluginVitest from "@vitest/eslint-plugin";
|
|
|
8
8
|
function getVitestConfig(options) {
|
|
9
9
|
const { vitest } = options.configs.test;
|
|
10
10
|
const { overrides } = isEnabled(vitest) ? vitest : defaultOptions.configs.test.vitest;
|
|
11
|
-
|
|
11
|
+
const vitestConfig = {
|
|
12
12
|
name: "shayanthenerd/vitest",
|
|
13
13
|
files: [globs.test],
|
|
14
14
|
plugins: { vitest: eslintPluginVitest },
|
|
15
15
|
rules: getVitestRules(options)
|
|
16
|
-
}
|
|
16
|
+
};
|
|
17
|
+
return mergeConfigs(vitestConfig, overrides);
|
|
17
18
|
}
|
|
18
19
|
//#endregion
|
|
19
20
|
export { getVitestConfig };
|
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) {
|
|
@@ -25,6 +25,9 @@ function enableDetectedConfigs(options) {
|
|
|
25
25
|
astro: isPackageDetected("astro", options),
|
|
26
26
|
react: isPackageDetected("react", options),
|
|
27
27
|
next: isPackageDetected("next", options),
|
|
28
|
+
tanstackStart: isPackageDetected("@tanstack/react-start", options),
|
|
29
|
+
tanstackQuery: isPackageDetected("@tanstack/react-query", options),
|
|
30
|
+
tanstackRouter: isPackageDetected("@tanstack/react-router", options),
|
|
28
31
|
vue: isPackageDetected("vue", options),
|
|
29
32
|
nuxt: isPackageDetected("nuxt", options),
|
|
30
33
|
nuxtUI: isPackageDetected("@nuxt/ui", options),
|
|
@@ -55,6 +58,7 @@ function enableDetectedConfigs(options) {
|
|
|
55
58
|
options.configs.nuxt ??= autoDetectedPackages.nuxt;
|
|
56
59
|
options.configs.react ??= autoDetectedPackages.react;
|
|
57
60
|
options.configs.next ??= autoDetectedPackages.next;
|
|
61
|
+
options.configs.tanstack ??= autoDetectedPackages.tanstackStart || autoDetectedPackages.tanstackQuery || autoDetectedPackages.tanstackRouter;
|
|
58
62
|
options.configs.test.vitest ??= autoDetectedPackages.vitest;
|
|
59
63
|
options.configs.test.cypress ??= autoDetectedPackages.cypress;
|
|
60
64
|
options.configs.test.storybook ??= autoDetectedPackages.storybook;
|
|
@@ -76,6 +80,12 @@ function enableDetectedConfigs(options) {
|
|
|
76
80
|
options.configs.vue = options.configs.vue === true ? {} : options.configs.vue;
|
|
77
81
|
options.configs.vue.blockLang = { script: "ts" };
|
|
78
82
|
}
|
|
83
|
+
if (options.configs.tanstack) {
|
|
84
|
+
if (options.configs.tanstack === true) options.configs.tanstack = {};
|
|
85
|
+
options.configs.tanstack.start ??= autoDetectedPackages.tanstackStart;
|
|
86
|
+
options.configs.tanstack.query ??= autoDetectedPackages.tanstackQuery;
|
|
87
|
+
options.configs.tanstack.router ??= autoDetectedPackages.tanstackRouter;
|
|
88
|
+
}
|
|
79
89
|
if (options.configs.nuxt) {
|
|
80
90
|
if (options.configs.nuxt === true) options.configs.nuxt = {};
|
|
81
91
|
options.configs.nuxt.ui ??= autoDetectedPackages.nuxtUI;
|
|
@@ -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.d.mts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { Options } from "./types/index.mjs";
|
|
2
2
|
import { Linter } from "eslint";
|
|
3
3
|
//#region src/index.d.ts
|
|
4
|
-
/** Valid argument combinations for `defineConfig`. */
|
|
5
|
-
type DefineConfigArguments = [] | [options: Options] | [configs: Linter.Config[]] | [options: Options, configs: Linter.Config[]];
|
|
6
4
|
/**
|
|
7
5
|
* Define your ESLint configuration based on the provided options and/or custom Flat Config Objects.
|
|
8
6
|
*
|
|
@@ -37,6 +35,8 @@ type DefineConfigArguments = [] | [options: Options] | [configs: Linter.Config[]
|
|
|
37
35
|
* ],
|
|
38
36
|
* );
|
|
39
37
|
*/
|
|
40
|
-
declare function defineConfig(
|
|
38
|
+
declare function defineConfig(options: Options): Linter.Config[];
|
|
39
|
+
declare function defineConfig(configs: Linter.Config[]): Linter.Config[];
|
|
40
|
+
declare function defineConfig(options: Options, configs: Linter.Config[]): Linter.Config[];
|
|
41
41
|
//#endregion
|
|
42
42
|
export { defineConfig };
|
package/dist/index.mjs
CHANGED
|
@@ -1,67 +1,34 @@
|
|
|
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 {
|
|
21
|
+
import { getTailwindConfig } from "./configs/tailwind.mjs";
|
|
22
|
+
import { getTanstackConfig } from "./configs/tanstack.mjs";
|
|
24
23
|
import { getTypescriptConfig } from "./configs/typescript.mjs";
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
24
|
+
import { getUnicornConfig } from "./configs/unicorn.mjs";
|
|
25
|
+
import { getVitestConfig } from "./configs/vitest.mjs";
|
|
26
|
+
import { getVueConfig } from "./configs/vue.mjs";
|
|
27
|
+
import { getZodConfig } from "./configs/zod.mjs";
|
|
27
28
|
import { getIgnorePatterns } from "./helpers/ignores/getIgnorePatterns.mjs";
|
|
28
29
|
import { mergeWithDefaults } from "./helpers/options/mergeWithDefaults.mjs";
|
|
29
30
|
import { defineConfig as defineConfig$1, globalIgnores } from "eslint/config";
|
|
30
31
|
//#region src/index.ts
|
|
31
|
-
/**
|
|
32
|
-
* Define your ESLint configuration based on the provided options and/or custom Flat Config Objects.
|
|
33
|
-
*
|
|
34
|
-
* @param {...DefineConfigArguments} args The configuration options and/or custom Flat Config objects.
|
|
35
|
-
* @returns {Linter.Config[]} The merged ESLint configuration array
|
|
36
|
-
*
|
|
37
|
-
* @example
|
|
38
|
-
* defineConfig();
|
|
39
|
-
* // or
|
|
40
|
-
* defineConfig({ autoDetectDeps: 'verbose' });
|
|
41
|
-
* // or
|
|
42
|
-
* defineConfig([
|
|
43
|
-
* {
|
|
44
|
-
* name: 'custom',
|
|
45
|
-
* rules: {
|
|
46
|
-
* 'no-console': 'error',
|
|
47
|
-
* },
|
|
48
|
-
* },
|
|
49
|
-
* { ... },
|
|
50
|
-
* ]);
|
|
51
|
-
* // or
|
|
52
|
-
* defineConfig(
|
|
53
|
-
* { autoDetectDeps: 'verbose' },
|
|
54
|
-
* [
|
|
55
|
-
* {
|
|
56
|
-
* name: 'custom',
|
|
57
|
-
* rules: {
|
|
58
|
-
* 'no-console': 'error',
|
|
59
|
-
* },
|
|
60
|
-
* },
|
|
61
|
-
* { ... },
|
|
62
|
-
* ],
|
|
63
|
-
* );
|
|
64
|
-
*/
|
|
65
32
|
function defineConfig(...args) {
|
|
66
33
|
let options = {};
|
|
67
34
|
let userConfigs = [];
|
|
@@ -72,12 +39,12 @@ function defineConfig(...args) {
|
|
|
72
39
|
userConfigs = secondArgument ?? [];
|
|
73
40
|
}
|
|
74
41
|
const mergedOptions = mergeWithDefaults(options);
|
|
75
|
-
const { gitignore, project: { rules, ignores, settings, linterOptions }, configs: { css, vue, zod, html, next, node, nuxt, react, astro, unicorn, importX, promise, baseline, markdown, tailwind, stylistic, typescript, packageJson, perfectionist, test: { vitest, cypress, storybook, playwright } } } = mergedOptions;
|
|
42
|
+
const { gitignore, project: { rules, ignores, settings, linterOptions }, configs: { css, vue, zod, html, next, node, nuxt, react, astro, unicorn, importX, promise, baseline, markdown, tailwind, tanstack, stylistic, typescript, packageJson, perfectionist, test: { vitest, cypress, storybook, playwright } } } = mergedOptions;
|
|
76
43
|
const ignorePatterns = getIgnorePatterns({
|
|
77
44
|
gitignore,
|
|
78
45
|
patterns: ignores
|
|
79
46
|
});
|
|
80
|
-
|
|
47
|
+
const configObjects = [
|
|
81
48
|
{
|
|
82
49
|
name: "shayanthenerd/project",
|
|
83
50
|
linterOptions,
|
|
@@ -103,6 +70,7 @@ function defineConfig(...args) {
|
|
|
103
70
|
isEnabled(astro) && getAstroConfig(mergedOptions),
|
|
104
71
|
isEnabled(react) && getReactConfig(mergedOptions),
|
|
105
72
|
isEnabled(next) && getNextConfig(mergedOptions),
|
|
73
|
+
isEnabled(tanstack) && getTanstackConfig(mergedOptions),
|
|
106
74
|
isEnabled(vue) && getVueConfig(mergedOptions),
|
|
107
75
|
...isEnabled(nuxt) ? getNuxtConfigs(mergedOptions) : [],
|
|
108
76
|
isEnabled(storybook) && getStorybookConfig(mergedOptions),
|
|
@@ -110,7 +78,8 @@ function defineConfig(...args) {
|
|
|
110
78
|
isEnabled(cypress) && getCypressConfig(mergedOptions),
|
|
111
79
|
isEnabled(playwright) && getPlaywrightConfig(mergedOptions),
|
|
112
80
|
...userConfigs
|
|
113
|
-
].filter(isTruthy)
|
|
81
|
+
].filter(isTruthy);
|
|
82
|
+
return defineConfig$1(configObjects);
|
|
114
83
|
}
|
|
115
84
|
//#endregion
|
|
116
85
|
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(?:-.+)?",
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { isEnabled } from "../utils/isEnabled.mjs";
|
|
2
|
+
//#region src/rules/tanstack.ts
|
|
3
|
+
const tanstackStartRules = {
|
|
4
|
+
"@tanstack/start/no-async-client-component": "error",
|
|
5
|
+
"@tanstack/start/no-client-code-in-server-component": "error"
|
|
6
|
+
};
|
|
7
|
+
const tanstackQueryRules = {
|
|
8
|
+
"@tanstack/query/exhaustive-deps": "warn",
|
|
9
|
+
"@tanstack/query/no-rest-destructuring": "warn",
|
|
10
|
+
"@tanstack/query/stable-query-client": "error",
|
|
11
|
+
"@tanstack/query/no-unstable-deps": "error",
|
|
12
|
+
"@tanstack/query/infinite-query-property-order": "warn",
|
|
13
|
+
"@tanstack/query/no-void-query-fn": "error",
|
|
14
|
+
"@tanstack/query/mutation-property-order": "warn"
|
|
15
|
+
};
|
|
16
|
+
const tanstackRouterRules = {
|
|
17
|
+
"@tanstack/router/create-route-property-order": "warn",
|
|
18
|
+
"@tanstack/router/route-param-names": "error"
|
|
19
|
+
};
|
|
20
|
+
function getTanstackRules(options) {
|
|
21
|
+
const { tanstack, typescript } = options.configs;
|
|
22
|
+
const rules = {};
|
|
23
|
+
if (!isEnabled(tanstack)) return rules;
|
|
24
|
+
if (isEnabled(typescript)) tanstackRouterRules["@typescript-eslint/only-throw-error"] = ["error", { allow: [{
|
|
25
|
+
from: "package",
|
|
26
|
+
package: "@tanstack/router-core",
|
|
27
|
+
name: "Redirect"
|
|
28
|
+
}, {
|
|
29
|
+
from: "package",
|
|
30
|
+
package: "@tanstack/router-core",
|
|
31
|
+
name: "NotFoundError"
|
|
32
|
+
}] }];
|
|
33
|
+
if (isEnabled(tanstack.start)) Object.assign(rules, tanstackStartRules);
|
|
34
|
+
if (isEnabled(tanstack.query)) Object.assign(rules, tanstackQueryRules);
|
|
35
|
+
if (isEnabled(tanstack.router)) Object.assign(rules, tanstackRouterRules);
|
|
36
|
+
return rules;
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { getTanstackRules };
|
|
@@ -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;
|