@zayne-labs/eslint-config 0.6.4 → 0.7.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/index.d.ts +20 -6
- package/dist/index.js +170 -108
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -15425,7 +15425,7 @@ type Yoda = []|[("always" | "never")]|[("always" | "never"), {
|
|
|
15425
15425
|
}]
|
|
15426
15426
|
|
|
15427
15427
|
// Names of all the configs
|
|
15428
|
-
type ConfigNames = "zayne/js-eslint/setup" | "zayne/js-eslint/recommended" | "zayne/js-eslint/rules" | "zayne/unicorn/recommended" | "zayne/unicorn/rules" | "zayne/ts-eslint/setup" | "zayne/ts-eslint/strict" | "zayne/ts-eslint/strict" | "zayne/ts-eslint/strict" | "zayne/ts-eslint/strict" | "zayne/ts-eslint/strict" | "zayne/ts-eslint/strict" | "zayne/ts-eslint/rules" | "zayne/tailwindcss/setup" | "zayne/tailwindcss/recommended" | "zayne/tailwindcss/rules" | "zayne/perfectionist/rules" | "zayne/stylistic/rules" | "zayne/import/setup" | "zayne/import/recommended" | "zayne/import/rules" | "zayne/jsdoc/rules" | "zayne/jsonc/setup" | "zayne/jsonc/rules" | "zayne/react/setup" | "zayne/react/recommended" | "zayne/react/rules" | "zayne/react/refresh" | "zayne/react/nextjs" | "zayne/node/setup" | "zayne/node/recommended" | "zayne/node/rules" | "zayne/tanstack/
|
|
15428
|
+
type ConfigNames = "zayne/js-eslint/setup" | "zayne/js-eslint/recommended > ExtendedConfig[0]" | "zayne/js-eslint/rules" | "zayne/unicorn/recommended" | "zayne/unicorn/rules" | "zayne/ts-eslint/setup" | "zayne/ts-eslint/strict" | "zayne/ts-eslint/strict" | "zayne/ts-eslint/strict" | "zayne/ts-eslint/strict" | "zayne/ts-eslint/strict" | "zayne/ts-eslint/strict" | "zayne/ts-eslint/rules" | "zayne/tailwindcss/setup" | "zayne/tailwindcss/recommended" | "zayne/tailwindcss/rules" | "zayne/perfectionist/rules" | "zayne/stylistic/rules" | "zayne/import/setup" | "zayne/import/recommended" | "zayne/import/rules" | "zayne/jsdoc/rules" | "zayne/jsonc/setup" | "zayne/jsonc/rules" | "zayne/react/setup" | "zayne/react/recommended" | "zayne/react/rules" | "zayne/react/refresh" | "zayne/react/nextjs" | "zayne/node/setup" | "zayne/node/recommended" | "zayne/node/rules" | "zayne/tanstack-query/recommended" | "zayne/eslint-comments/rules" | "zayne/toml/setup" | "zayne/toml/rules" | "zayne/yaml/setup" | "zayne/yaml/rules" | "zayne/vue/setup" | "zayne/vue/recommended" | "zayne/vue/rules" | "zayne/solid/setup" | "zayne/solid/recommended" | "zayne/solid/rules"
|
|
15429
15429
|
|
|
15430
15430
|
type LiteralUnion<TUnion extends TBase, TBase = string> = TUnion | (TBase & { _ignore?: never });
|
|
15431
15431
|
|
|
@@ -16058,7 +16058,7 @@ declare const solid: (options?: ExtractOptions<OptionsConfig["solid"]>) => Promi
|
|
|
16058
16058
|
* @returns
|
|
16059
16059
|
* The merged ESLint configurations.
|
|
16060
16060
|
*/
|
|
16061
|
-
declare const zayne: (options?: OptionsConfig & Prettify<Pick<TypedFlatConfigItem, "ignores">>, userConfigs
|
|
16061
|
+
declare const zayne: (options?: OptionsConfig & Prettify<Pick<TypedFlatConfigItem, "ignores">>, ...userConfigs: Array<Awaitable<FlatConfigComposer | Linter.Config[] | TypedFlatConfigItem | TypedFlatConfigItem[]>>) => FlatConfigComposer<TypedFlatConfigItem, ConfigNames>;
|
|
16062
16062
|
|
|
16063
16063
|
declare const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
16064
16064
|
declare const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
@@ -16087,9 +16087,9 @@ declare const GLOB_ASTRO = "**/*.astro";
|
|
|
16087
16087
|
declare const GLOB_ASTRO_TS = "**/*.astro/*.ts";
|
|
16088
16088
|
declare const GLOB_GRAPHQL = "**/*.{g,graph}ql";
|
|
16089
16089
|
declare const GLOB_MARKDOWN_CODE = "**/*.md/**/*.?([cm])[jt]s?(x)";
|
|
16090
|
-
declare const GLOB_TESTS:
|
|
16090
|
+
declare const GLOB_TESTS: ["**/__tests__/**/*.?([cm])[jt]s?(x)", "**/*.spec.?([cm])[jt]s?(x)", "**/*.test.?([cm])[jt]s?(x)", "**/*.bench.?([cm])[jt]s?(x)", "**/*.benchmark.?([cm])[jt]s?(x)"];
|
|
16091
16091
|
declare const GLOB_ALL_SRC: string[];
|
|
16092
|
-
declare const GLOB_EXCLUDE:
|
|
16092
|
+
declare const GLOB_EXCLUDE: ["**/node_modules", "**/dist", "**/package-lock.json", "**/yarn.lock", "**/pnpm-lock.yaml", "**/bun.lockb", "**/output", "**/coverage", "**/temp", "**/.temp", "**/tmp", "**/.tmp", "**/.history", "**/.vitepress/cache", "**/.nuxt", "**/.next", "**/.svelte-kit", "**/.vercel", "**/.changeset", "**/.idea", "**/.cache", "**/.output", "**/.vite-inspect", "**/.yarn", "**/vite.config.*.timestamp-*", "**/CHANGELOG*.md", "**/*.min.*", "**/LICENSE*", "**/__snapshots__", "**/auto-import?(s).d.ts", "**/components.d.ts"];
|
|
16093
16093
|
|
|
16094
16094
|
declare const isObject: <TObject extends Record<string, unknown>>(value: unknown) => value is TObject;
|
|
16095
16095
|
/**
|
|
@@ -16133,7 +16133,11 @@ declare const renamePlugins: (plugins: Record<string, unknown> | undefined, rena
|
|
|
16133
16133
|
* })
|
|
16134
16134
|
* ```
|
|
16135
16135
|
*/
|
|
16136
|
-
declare const renamePluginInConfigs: (
|
|
16136
|
+
declare const renamePluginInConfigs: (options: {
|
|
16137
|
+
configs: TypedFlatConfigItem[];
|
|
16138
|
+
overrides?: TypedFlatConfigItem;
|
|
16139
|
+
renameMap: Record<string, string>;
|
|
16140
|
+
}) => TypedFlatConfigItem[];
|
|
16137
16141
|
declare const isPackageInScope: (name: string) => boolean;
|
|
16138
16142
|
/**
|
|
16139
16143
|
* @description
|
|
@@ -16146,5 +16150,15 @@ declare const isPackageInScope: (name: string) => boolean;
|
|
|
16146
16150
|
*/
|
|
16147
16151
|
declare const ensurePackages: (packages: Array<string | undefined>) => Promise<void>;
|
|
16148
16152
|
declare const resolveOptions: <TObject>(option: boolean | TObject | undefined) => TObject;
|
|
16153
|
+
type OverrideOptions<TConfigName extends string> = {
|
|
16154
|
+
configName: TConfigName;
|
|
16155
|
+
files?: string[];
|
|
16156
|
+
overrides: TypedFlatConfigItem["rules"];
|
|
16157
|
+
};
|
|
16158
|
+
declare const createOverrideRules: <TConfigName extends string>(options: OverrideOptions<TConfigName>) => {
|
|
16159
|
+
name: `zayne/${TConfigName}/rules/overrides`;
|
|
16160
|
+
rules: Partial<Linter.RulesRecord> & Rules;
|
|
16161
|
+
files?: string[] | undefined;
|
|
16162
|
+
};
|
|
16149
16163
|
|
|
16150
|
-
export { type Awaitable, type ConfigNames, type ExtractOptions, GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLES, GLOB_SVELTE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, type OptionsAppType, type OptionsComponentExts, type OptionsConfig, type OptionsFiles, type OptionsHasJsx, type OptionsHasTypeScript, type OptionsNode, type OptionsOverrides, type OptionsReact, type OptionsRegExp, type OptionsStylistic, type OptionsTailwindCSS, type OptionsTanstack, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type OptionsTypescript$1 as OptionsTypescript, type OptionsVue, type Prettify, type Rules, type TypedFlatConfigItem, combine, comments, ensurePackages, gitIgnores, ignores, imports, interopDefault, isObject, isPackageInScope, javascript, jsdoc, jsonc, node, perfectionist, react, renamePluginInConfigs, renamePlugins, renameRules, resolveOptions, solid, sortPackageJson, sortTsconfig, stylistic, tailwindcss, tanstack, toml, typescript, unicorn, vue, yaml, zayne };
|
|
16164
|
+
export { type Awaitable, type ConfigNames, type ExtractOptions, GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLES, GLOB_SVELTE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, type OptionsAppType, type OptionsComponentExts, type OptionsConfig, type OptionsFiles, type OptionsHasJsx, type OptionsHasTypeScript, type OptionsNode, type OptionsOverrides, type OptionsReact, type OptionsRegExp, type OptionsStylistic, type OptionsTailwindCSS, type OptionsTanstack, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type OptionsTypescript$1 as OptionsTypescript, type OptionsVue, type Prettify, type Rules, type TypedFlatConfigItem, combine, comments, createOverrideRules, ensurePackages, gitIgnores, ignores, imports, interopDefault, isObject, isPackageInScope, javascript, jsdoc, jsonc, node, perfectionist, react, renamePluginInConfigs, renamePlugins, renameRules, resolveOptions, solid, sortPackageJson, sortTsconfig, stylistic, tailwindcss, tanstack, toml, typescript, unicorn, vue, yaml, zayne };
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { fileURLToPath } from 'node:url';
|
|
2
|
+
import { defineEnum, assert } from '@zayne-labs/toolkit-type-helpers';
|
|
2
3
|
import { isPackageExists } from 'local-pkg';
|
|
4
|
+
import { globalIgnores, defineConfig } from 'eslint/config';
|
|
3
5
|
import globals from 'globals';
|
|
4
6
|
import { fixupPluginRules } from '@eslint/compat';
|
|
5
7
|
import { mergeProcessors } from 'eslint-merge-processors';
|
|
6
|
-
import { assert } from '@zayne-labs/toolkit-type-helpers';
|
|
7
8
|
import { FlatConfigComposer } from 'eslint-flat-config-utils';
|
|
8
9
|
|
|
9
10
|
// src/utils.ts
|
|
@@ -40,12 +41,17 @@ var renamePlugins = (plugins, renameMap) => {
|
|
|
40
41
|
});
|
|
41
42
|
return Object.fromEntries(renamedPluginEntries);
|
|
42
43
|
};
|
|
43
|
-
var renamePluginInConfigs = (
|
|
44
|
+
var renamePluginInConfigs = (options) => {
|
|
45
|
+
const { configs, overrides, renameMap } = options;
|
|
44
46
|
const renamedConfigs = configs.map((config) => ({
|
|
45
47
|
...config,
|
|
46
|
-
...
|
|
47
|
-
...isObject(config.
|
|
48
|
-
|
|
48
|
+
...overrides,
|
|
49
|
+
...isObject(config.plugins) && {
|
|
50
|
+
plugins: renamePlugins(config.plugins, renameMap)
|
|
51
|
+
},
|
|
52
|
+
...isObject(config.rules) && {
|
|
53
|
+
rules: renameRules(config.rules, renameMap)
|
|
54
|
+
}
|
|
49
55
|
}));
|
|
50
56
|
return renamedConfigs;
|
|
51
57
|
};
|
|
@@ -66,8 +72,17 @@ var ensurePackages = async (packages) => {
|
|
|
66
72
|
}
|
|
67
73
|
};
|
|
68
74
|
var resolveOptions = (option) => isObject(option) ? option : {};
|
|
69
|
-
|
|
70
|
-
|
|
75
|
+
var createOverrideRules = (options) => {
|
|
76
|
+
const { configName, files, overrides } = options;
|
|
77
|
+
if (!isObject(overrides)) {
|
|
78
|
+
return {};
|
|
79
|
+
}
|
|
80
|
+
return defineEnum({
|
|
81
|
+
...files && { files },
|
|
82
|
+
name: `zayne/${configName}/rules/overrides`,
|
|
83
|
+
rules: overrides
|
|
84
|
+
});
|
|
85
|
+
};
|
|
71
86
|
var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
72
87
|
var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
73
88
|
var GLOB_JS = "**/*.?([cm])js";
|
|
@@ -95,13 +110,13 @@ var GLOB_ASTRO = "**/*.astro";
|
|
|
95
110
|
var GLOB_ASTRO_TS = "**/*.astro/*.ts";
|
|
96
111
|
var GLOB_GRAPHQL = "**/*.{g,graph}ql";
|
|
97
112
|
var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
|
|
98
|
-
var GLOB_TESTS = [
|
|
113
|
+
var GLOB_TESTS = defineEnum([
|
|
99
114
|
`**/__tests__/**/*.${GLOB_SRC_EXT}`,
|
|
100
115
|
`**/*.spec.${GLOB_SRC_EXT}`,
|
|
101
116
|
`**/*.test.${GLOB_SRC_EXT}`,
|
|
102
117
|
`**/*.bench.${GLOB_SRC_EXT}`,
|
|
103
118
|
`**/*.benchmark.${GLOB_SRC_EXT}`
|
|
104
|
-
];
|
|
119
|
+
]);
|
|
105
120
|
var GLOB_ALL_SRC = [
|
|
106
121
|
GLOB_SRC,
|
|
107
122
|
GLOB_STYLES,
|
|
@@ -114,7 +129,7 @@ var GLOB_ALL_SRC = [
|
|
|
114
129
|
GLOB_XML,
|
|
115
130
|
GLOB_HTML
|
|
116
131
|
];
|
|
117
|
-
var GLOB_EXCLUDE = [
|
|
132
|
+
var GLOB_EXCLUDE = defineEnum([
|
|
118
133
|
"**/node_modules",
|
|
119
134
|
"**/dist",
|
|
120
135
|
"**/package-lock.json",
|
|
@@ -146,15 +161,12 @@ var GLOB_EXCLUDE = [
|
|
|
146
161
|
"**/__snapshots__",
|
|
147
162
|
"**/auto-import?(s).d.ts",
|
|
148
163
|
"**/components.d.ts"
|
|
149
|
-
];
|
|
164
|
+
]);
|
|
150
165
|
|
|
151
166
|
// src/configs/ignores.ts
|
|
152
|
-
var ignores = (userIgnores = []) =>
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
name: "zayne/defaults/ignores"
|
|
156
|
-
}
|
|
157
|
-
];
|
|
167
|
+
var ignores = (userIgnores = []) => {
|
|
168
|
+
return [globalIgnores([...GLOB_EXCLUDE, ...userIgnores], "zayne/defaults/ignores")];
|
|
169
|
+
};
|
|
158
170
|
var gitIgnores = async (options) => {
|
|
159
171
|
const antfuGitIgnore = await interopDefault(import('eslint-config-flat-gitignore'));
|
|
160
172
|
const config = antfuGitIgnore({
|
|
@@ -167,7 +179,7 @@ var gitIgnores = async (options) => {
|
|
|
167
179
|
var javascript = async (options = {}) => {
|
|
168
180
|
const { overrides } = options;
|
|
169
181
|
const eslintJs = await interopDefault(import('@eslint/js'));
|
|
170
|
-
return [
|
|
182
|
+
return defineConfig([
|
|
171
183
|
{
|
|
172
184
|
languageOptions: {
|
|
173
185
|
ecmaVersion: "latest",
|
|
@@ -190,8 +202,8 @@ var javascript = async (options = {}) => {
|
|
|
190
202
|
name: "zayne/js-eslint/setup"
|
|
191
203
|
},
|
|
192
204
|
{
|
|
193
|
-
|
|
194
|
-
|
|
205
|
+
extends: [eslintJs.configs.recommended],
|
|
206
|
+
name: "zayne/js-eslint/recommended"
|
|
195
207
|
},
|
|
196
208
|
{
|
|
197
209
|
name: "zayne/js-eslint/rules",
|
|
@@ -236,7 +248,7 @@ var javascript = async (options = {}) => {
|
|
|
236
248
|
"no-empty": ["error", { allowEmptyCatch: true }],
|
|
237
249
|
"no-empty-character-class": "error",
|
|
238
250
|
"no-empty-pattern": "error",
|
|
239
|
-
"no-eval": "error",
|
|
251
|
+
"no-eval": ["error", { allowIndirect: true }],
|
|
240
252
|
"no-ex-assign": "error",
|
|
241
253
|
"no-extend-native": "error",
|
|
242
254
|
"no-extra-bind": "error",
|
|
@@ -461,11 +473,11 @@ var javascript = async (options = {}) => {
|
|
|
461
473
|
"use-isnan": ["error", { enforceForIndexOf: true, enforceForSwitchCase: true }],
|
|
462
474
|
"valid-typeof": ["error", { requireStringLiterals: true }],
|
|
463
475
|
"vars-on-top": "error",
|
|
464
|
-
yoda: ["error", "never"]
|
|
465
|
-
...overrides
|
|
476
|
+
yoda: ["error", "never"]
|
|
466
477
|
}
|
|
467
|
-
}
|
|
468
|
-
|
|
478
|
+
},
|
|
479
|
+
createOverrideRules({ configName: "js-eslint", overrides })
|
|
480
|
+
]);
|
|
469
481
|
};
|
|
470
482
|
|
|
471
483
|
// src/configs/tailwindcss.ts
|
|
@@ -502,14 +514,15 @@ var tailwindcss = async (options = {}) => {
|
|
|
502
514
|
"tailwindcss/no-custom-classname": [
|
|
503
515
|
"warn",
|
|
504
516
|
{ ignoredKeys: ["compoundVariants", "defaultVariants", "responsiveVariants"] }
|
|
505
|
-
]
|
|
506
|
-
...overrides
|
|
517
|
+
]
|
|
507
518
|
}
|
|
508
|
-
}
|
|
519
|
+
},
|
|
520
|
+
createOverrideRules({
|
|
521
|
+
configName: "tailwindcss",
|
|
522
|
+
overrides
|
|
523
|
+
})
|
|
509
524
|
];
|
|
510
525
|
};
|
|
511
|
-
|
|
512
|
-
// src/configs/typescript.ts
|
|
513
526
|
var typescript = async (options = {}) => {
|
|
514
527
|
const {
|
|
515
528
|
allowDefaultProjects,
|
|
@@ -524,6 +537,16 @@ var typescript = async (options = {}) => {
|
|
|
524
537
|
} = options;
|
|
525
538
|
const isTypeAware = Boolean(tsconfigPath);
|
|
526
539
|
const tsEslint = await interopDefault(import('typescript-eslint'));
|
|
540
|
+
const projectServiceObject = isTypeAware && (allowDefaultProjects ? {
|
|
541
|
+
projectService: {
|
|
542
|
+
allowDefaultProject: allowDefaultProjects,
|
|
543
|
+
defaultProject: tsconfigPath
|
|
544
|
+
},
|
|
545
|
+
tsconfigRootDir: process.cwd()
|
|
546
|
+
} : {
|
|
547
|
+
project: tsconfigPath,
|
|
548
|
+
tsconfigRootDir: process.cwd()
|
|
549
|
+
});
|
|
527
550
|
const makeParser = (parsedFiles, ignores2) => ({
|
|
528
551
|
files: parsedFiles,
|
|
529
552
|
...ignores2 && { ignores: ignores2 },
|
|
@@ -532,16 +555,8 @@ var typescript = async (options = {}) => {
|
|
|
532
555
|
parserOptions: {
|
|
533
556
|
ecmaFeatures: { globalReturn: true },
|
|
534
557
|
extraFileExtensions: componentExts.map((ext) => `.${ext}`),
|
|
535
|
-
...isTypeAware && {
|
|
536
|
-
...allowDefaultProjects ? {
|
|
537
|
-
projectService: {
|
|
538
|
-
allowDefaultProject: allowDefaultProjects,
|
|
539
|
-
defaultProject: tsconfigPath
|
|
540
|
-
}
|
|
541
|
-
} : { project: tsconfigPath },
|
|
542
|
-
tsconfigRootDir: process.cwd()
|
|
543
|
-
},
|
|
544
558
|
sourceType: "module",
|
|
559
|
+
...projectServiceObject,
|
|
545
560
|
...parserOptions
|
|
546
561
|
}
|
|
547
562
|
}
|
|
@@ -558,22 +573,22 @@ var typescript = async (options = {}) => {
|
|
|
558
573
|
};
|
|
559
574
|
const selectedBaseRuleSet = isTypeAware ? "strictTypeChecked" : "strict";
|
|
560
575
|
const selectedStylisticRuleSet = isTypeAware ? "strictTypeChecked" : "strict";
|
|
561
|
-
return [
|
|
576
|
+
return defineConfig([
|
|
562
577
|
{
|
|
563
578
|
name: `zayne/ts-eslint/${isTypeAware ? "type-aware-setup" : "setup"}`,
|
|
564
579
|
...makeParser(files),
|
|
565
580
|
...isTypeAware && makeParser(filesTypeAware, ignoresTypeAware)
|
|
566
581
|
},
|
|
567
|
-
|
|
568
|
-
tsEslint.configs[selectedBaseRuleSet],
|
|
569
|
-
{
|
|
570
|
-
{
|
|
571
|
-
),
|
|
572
|
-
|
|
573
|
-
tsEslint.configs[selectedStylisticRuleSet],
|
|
574
|
-
{
|
|
575
|
-
{
|
|
576
|
-
) :
|
|
582
|
+
renamePluginInConfigs({
|
|
583
|
+
configs: tsEslint.configs[selectedBaseRuleSet],
|
|
584
|
+
overrides: { files, name: `zayne/ts-eslint/${selectedBaseRuleSet}` },
|
|
585
|
+
renameMap: { "@typescript-eslint": "ts-eslint" }
|
|
586
|
+
}),
|
|
587
|
+
stylistic2 ? renamePluginInConfigs({
|
|
588
|
+
configs: tsEslint.configs[selectedStylisticRuleSet],
|
|
589
|
+
overrides: { files, name: `zayne/ts-eslint/${selectedStylisticRuleSet}` },
|
|
590
|
+
renameMap: { "@typescript-eslint": "ts-eslint" }
|
|
591
|
+
}) : {},
|
|
577
592
|
{
|
|
578
593
|
files,
|
|
579
594
|
name: "zayne/ts-eslint/rules",
|
|
@@ -600,11 +615,11 @@ var typescript = async (options = {}) => {
|
|
|
600
615
|
"ts-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_" }],
|
|
601
616
|
"ts-eslint/no-use-before-define": "off",
|
|
602
617
|
"ts-eslint/no-useless-constructor": "error",
|
|
603
|
-
...isTypeAware && typeAwareRules
|
|
604
|
-
...overrides
|
|
618
|
+
...isTypeAware && typeAwareRules
|
|
605
619
|
}
|
|
606
|
-
}
|
|
607
|
-
|
|
620
|
+
},
|
|
621
|
+
createOverrideRules({ configName: "ts-eslint", files, overrides })
|
|
622
|
+
]);
|
|
608
623
|
};
|
|
609
624
|
|
|
610
625
|
// src/configs/unicorn.ts
|
|
@@ -641,10 +656,13 @@ var unicorn = async (options = {}) => {
|
|
|
641
656
|
"unicorn/no-null": "off",
|
|
642
657
|
"unicorn/no-useless-undefined": ["error", { checkArguments: true }],
|
|
643
658
|
"unicorn/numeric-separators-style": "off",
|
|
644
|
-
"unicorn/prevent-abbreviations": "off"
|
|
645
|
-
...overrides
|
|
659
|
+
"unicorn/prevent-abbreviations": "off"
|
|
646
660
|
}
|
|
647
|
-
}
|
|
661
|
+
},
|
|
662
|
+
createOverrideRules({
|
|
663
|
+
configName: "unicorn",
|
|
664
|
+
overrides
|
|
665
|
+
})
|
|
648
666
|
];
|
|
649
667
|
};
|
|
650
668
|
|
|
@@ -658,7 +676,9 @@ var imports = async (options = {}) => {
|
|
|
658
676
|
plugins: {
|
|
659
677
|
import: eslintPluginImportX
|
|
660
678
|
},
|
|
661
|
-
...typescript2 && {
|
|
679
|
+
...typescript2 && {
|
|
680
|
+
settings: eslintPluginImportX.flatConfigs.typescript.settings
|
|
681
|
+
}
|
|
662
682
|
},
|
|
663
683
|
{
|
|
664
684
|
name: "zayne/import/recommended",
|
|
@@ -687,10 +707,13 @@ var imports = async (options = {}) => {
|
|
|
687
707
|
"import/no-unresolved": "off",
|
|
688
708
|
"import/no-useless-path-segments": ["error", { commonjs: true }],
|
|
689
709
|
"import/no-webpack-loader-syntax": "error",
|
|
690
|
-
...stylistic2 && { "import/newline-after-import": "error" }
|
|
691
|
-
...overrides
|
|
710
|
+
...stylistic2 && { "import/newline-after-import": "error" }
|
|
692
711
|
}
|
|
693
|
-
}
|
|
712
|
+
},
|
|
713
|
+
createOverrideRules({
|
|
714
|
+
configName: "import",
|
|
715
|
+
overrides
|
|
716
|
+
})
|
|
694
717
|
];
|
|
695
718
|
};
|
|
696
719
|
|
|
@@ -802,7 +825,7 @@ var perfectionist = async (options = {}) => {
|
|
|
802
825
|
order: "asc",
|
|
803
826
|
type: "alphabetical"
|
|
804
827
|
}
|
|
805
|
-
]
|
|
828
|
+
]
|
|
806
829
|
// "perfectionist/sort-svelte-attributes": [
|
|
807
830
|
// "warn",
|
|
808
831
|
// {
|
|
@@ -832,9 +855,12 @@ var perfectionist = async (options = {}) => {
|
|
|
832
855
|
// type: "alphabetical",
|
|
833
856
|
// },
|
|
834
857
|
// ],
|
|
835
|
-
...overrides
|
|
836
858
|
}
|
|
837
|
-
}
|
|
859
|
+
},
|
|
860
|
+
createOverrideRules({
|
|
861
|
+
configName: "perfectionist",
|
|
862
|
+
overrides
|
|
863
|
+
})
|
|
838
864
|
];
|
|
839
865
|
};
|
|
840
866
|
|
|
@@ -868,10 +894,13 @@ var stylistic = async (options = {}) => {
|
|
|
868
894
|
],
|
|
869
895
|
...jsx2 && {
|
|
870
896
|
"stylistic/jsx-self-closing-comp": "warn"
|
|
871
|
-
}
|
|
872
|
-
...overrides
|
|
897
|
+
}
|
|
873
898
|
}
|
|
874
|
-
}
|
|
899
|
+
},
|
|
900
|
+
createOverrideRules({
|
|
901
|
+
configName: "stylistic",
|
|
902
|
+
overrides
|
|
903
|
+
})
|
|
875
904
|
];
|
|
876
905
|
};
|
|
877
906
|
|
|
@@ -932,10 +961,14 @@ var jsonc = async (options = {}) => {
|
|
|
932
961
|
"jsonc/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
|
|
933
962
|
"jsonc/quote-props": "error",
|
|
934
963
|
"jsonc/quotes": "error"
|
|
935
|
-
}
|
|
936
|
-
...overrides
|
|
964
|
+
}
|
|
937
965
|
}
|
|
938
|
-
}
|
|
966
|
+
},
|
|
967
|
+
createOverrideRules({
|
|
968
|
+
configName: "jsonc",
|
|
969
|
+
files,
|
|
970
|
+
overrides
|
|
971
|
+
})
|
|
939
972
|
];
|
|
940
973
|
};
|
|
941
974
|
|
|
@@ -970,15 +1003,16 @@ var jsdoc = async (options = {}) => {
|
|
|
970
1003
|
"jsdoc/check-alignment": "warn",
|
|
971
1004
|
"jsdoc/multiline-blocks": "warn",
|
|
972
1005
|
"jsdoc/require-description": ["warn", { descriptionStyle: "tag" }]
|
|
973
|
-
}
|
|
974
|
-
...overrides
|
|
1006
|
+
}
|
|
975
1007
|
}
|
|
976
|
-
}
|
|
1008
|
+
},
|
|
1009
|
+
createOverrideRules({
|
|
1010
|
+
configName: "jsdoc",
|
|
1011
|
+
overrides
|
|
1012
|
+
})
|
|
977
1013
|
];
|
|
978
1014
|
};
|
|
979
|
-
|
|
980
|
-
// src/constants.ts
|
|
981
|
-
var defaultPluginRenameMap = {
|
|
1015
|
+
var defaultPluginRenameMap = defineEnum({
|
|
982
1016
|
"@eslint-react/debug": "react-debug",
|
|
983
1017
|
"@eslint-react/dom": "react-dom",
|
|
984
1018
|
"@eslint-react/hooks-extra": "react-hooks-extra",
|
|
@@ -993,7 +1027,7 @@ var defaultPluginRenameMap = {
|
|
|
993
1027
|
"@typescript-eslint": "ts-eslint",
|
|
994
1028
|
"import-x": "import",
|
|
995
1029
|
n: "node"
|
|
996
|
-
};
|
|
1030
|
+
});
|
|
997
1031
|
var ReactRefreshAllowConstantExportPackages = ["vite"];
|
|
998
1032
|
var RemixPackages = ["@remix-run/node", "@remix-run/react", "@remix-run/serve", "@remix-run/dev"];
|
|
999
1033
|
var NextJsPackages = ["next"];
|
|
@@ -1066,8 +1100,7 @@ var react = async (options = {}) => {
|
|
|
1066
1100
|
"react/no-useless-fragment": "error",
|
|
1067
1101
|
"react/prefer-destructuring-assignment": "error",
|
|
1068
1102
|
"react/prefer-read-only-props": "off",
|
|
1069
|
-
"react/prefer-shorthand-fragment": "error"
|
|
1070
|
-
...overrides
|
|
1103
|
+
"react/prefer-shorthand-fragment": "error"
|
|
1071
1104
|
}
|
|
1072
1105
|
}
|
|
1073
1106
|
];
|
|
@@ -1139,12 +1172,10 @@ var react = async (options = {}) => {
|
|
|
1139
1172
|
)
|
|
1140
1173
|
});
|
|
1141
1174
|
}
|
|
1142
|
-
return config;
|
|
1175
|
+
return defineConfig([config, createOverrideRules({ configName: "react", files, overrides })]);
|
|
1143
1176
|
};
|
|
1144
|
-
|
|
1145
|
-
// src/configs/tanstack.ts
|
|
1146
1177
|
var tanstack = async (options = {}) => {
|
|
1147
|
-
const { query = true } = options;
|
|
1178
|
+
const { overrides, query = true } = options;
|
|
1148
1179
|
const config = [];
|
|
1149
1180
|
await ensurePackages([...query ? ["@tanstack/eslint-plugin-query"] : []]);
|
|
1150
1181
|
const [eslintPluginTanstackQuery] = await Promise.all(
|
|
@@ -1152,7 +1183,7 @@ var tanstack = async (options = {}) => {
|
|
|
1152
1183
|
);
|
|
1153
1184
|
if (query && eslintPluginTanstackQuery) {
|
|
1154
1185
|
config.push({
|
|
1155
|
-
name: "zayne/tanstack/
|
|
1186
|
+
name: "zayne/tanstack-query/recommended",
|
|
1156
1187
|
plugins: {
|
|
1157
1188
|
"tanstack-query": eslintPluginTanstackQuery
|
|
1158
1189
|
},
|
|
@@ -1162,14 +1193,20 @@ var tanstack = async (options = {}) => {
|
|
|
1162
1193
|
)
|
|
1163
1194
|
});
|
|
1164
1195
|
}
|
|
1165
|
-
return
|
|
1196
|
+
return defineConfig([
|
|
1197
|
+
config,
|
|
1198
|
+
createOverrideRules({
|
|
1199
|
+
configName: "tanstack",
|
|
1200
|
+
overrides
|
|
1201
|
+
})
|
|
1202
|
+
]);
|
|
1166
1203
|
};
|
|
1167
1204
|
|
|
1168
1205
|
// src/configs/sort.ts
|
|
1169
1206
|
var sortPackageJson = () => [
|
|
1170
1207
|
{
|
|
1171
1208
|
files: ["**/package.json"],
|
|
1172
|
-
name: "zayne/sort/package
|
|
1209
|
+
name: "zayne/sort/package.json",
|
|
1173
1210
|
rules: {
|
|
1174
1211
|
"jsonc/sort-array-values": [
|
|
1175
1212
|
"error",
|
|
@@ -1268,7 +1305,7 @@ var sortPackageJson = () => [
|
|
|
1268
1305
|
var sortTsconfig = () => [
|
|
1269
1306
|
{
|
|
1270
1307
|
files: ["**/tsconfig.json", "**/tsconfig.*.json"],
|
|
1271
|
-
name: "zayne/sort/tsconfig
|
|
1308
|
+
name: "zayne/sort/tsconfig.json",
|
|
1272
1309
|
rules: {
|
|
1273
1310
|
"jsonc/sort-keys": [
|
|
1274
1311
|
"error",
|
|
@@ -1420,10 +1457,13 @@ var node = async (options = {}) => {
|
|
|
1420
1457
|
} : {
|
|
1421
1458
|
"node/no-unsupported-features/es-syntax": "off",
|
|
1422
1459
|
"node/no-unsupported-features/node-builtins": "off"
|
|
1423
|
-
}
|
|
1424
|
-
...overrides
|
|
1460
|
+
}
|
|
1425
1461
|
}
|
|
1426
|
-
}
|
|
1462
|
+
},
|
|
1463
|
+
createOverrideRules({
|
|
1464
|
+
configName: "node",
|
|
1465
|
+
overrides
|
|
1466
|
+
})
|
|
1427
1467
|
];
|
|
1428
1468
|
};
|
|
1429
1469
|
|
|
@@ -1447,10 +1487,10 @@ var comments = async (options = {}) => {
|
|
|
1447
1487
|
"eslint-comments/no-unused-enable": "error",
|
|
1448
1488
|
...type !== "app" && {
|
|
1449
1489
|
"eslint-comments/require-description": "warn"
|
|
1450
|
-
}
|
|
1451
|
-
...overrides
|
|
1490
|
+
}
|
|
1452
1491
|
}
|
|
1453
|
-
}
|
|
1492
|
+
},
|
|
1493
|
+
createOverrideRules({ configName: "comments", overrides })
|
|
1454
1494
|
];
|
|
1455
1495
|
};
|
|
1456
1496
|
|
|
@@ -1496,10 +1536,14 @@ var toml = async (options = {}) => {
|
|
|
1496
1536
|
"toml/quoted-keys": "error",
|
|
1497
1537
|
"toml/spaced-comment": "error",
|
|
1498
1538
|
"toml/table-bracket-spacing": "error"
|
|
1499
|
-
}
|
|
1500
|
-
...overrides
|
|
1539
|
+
}
|
|
1501
1540
|
}
|
|
1502
|
-
}
|
|
1541
|
+
},
|
|
1542
|
+
createOverrideRules({
|
|
1543
|
+
configName: "toml",
|
|
1544
|
+
files,
|
|
1545
|
+
overrides
|
|
1546
|
+
})
|
|
1503
1547
|
];
|
|
1504
1548
|
};
|
|
1505
1549
|
|
|
@@ -1547,10 +1591,10 @@ var yaml = async (options = {}) => {
|
|
|
1547
1591
|
// ],
|
|
1548
1592
|
"yaml/spaced-comment": "error"
|
|
1549
1593
|
},
|
|
1550
|
-
"stylistic/spaced-comment": "off"
|
|
1551
|
-
...overrides
|
|
1594
|
+
"stylistic/spaced-comment": "off"
|
|
1552
1595
|
}
|
|
1553
|
-
}
|
|
1596
|
+
},
|
|
1597
|
+
createOverrideRules({ configName: "yaml", files, overrides })
|
|
1554
1598
|
];
|
|
1555
1599
|
};
|
|
1556
1600
|
async function vue(options = {}) {
|
|
@@ -1612,7 +1656,7 @@ async function vue(options = {}) {
|
|
|
1612
1656
|
...typescript2 && { parser: await interopDefault(import('@typescript-eslint/parser')) }
|
|
1613
1657
|
}
|
|
1614
1658
|
},
|
|
1615
|
-
name: "zayne/vue/
|
|
1659
|
+
name: "zayne/vue/recommended",
|
|
1616
1660
|
processor: sfcBlocks === false ? pluginVue.processors[".vue"] : mergeProcessors([
|
|
1617
1661
|
pluginVue.processors[".vue"],
|
|
1618
1662
|
processorVueBlocks?.({
|
|
@@ -1623,6 +1667,16 @@ async function vue(options = {}) {
|
|
|
1623
1667
|
}
|
|
1624
1668
|
}) ?? pluginVue.processors[".vue"]
|
|
1625
1669
|
]),
|
|
1670
|
+
rules: {
|
|
1671
|
+
...pluginVue.configs.base.rules,
|
|
1672
|
+
...pluginVue.configs[`flat/${vueVersion === 2 ? "vue2-" : ""}essential`].at(-1)?.rules,
|
|
1673
|
+
...pluginVue.configs[`flat/${vueVersion === 2 ? "vue2-" : ""}strongly-recommended`].at(-1)?.rules,
|
|
1674
|
+
...pluginVue.configs[`flat/${vueVersion === 2 ? "vue2-" : ""}recommended`].at(-1)?.rules
|
|
1675
|
+
}
|
|
1676
|
+
},
|
|
1677
|
+
{
|
|
1678
|
+
files,
|
|
1679
|
+
name: "zayne/vue/rules",
|
|
1626
1680
|
rules: {
|
|
1627
1681
|
...pluginVue.configs.base.rules,
|
|
1628
1682
|
...pluginVue.configs[`flat/${vueVersion === 2 ? "vue2-" : ""}essential`].at(-1)?.rules,
|
|
@@ -1718,10 +1772,14 @@ async function vue(options = {}) {
|
|
|
1718
1772
|
"vue/space-in-parens": ["error", "never"],
|
|
1719
1773
|
"vue/template-curly-spacing": "error"
|
|
1720
1774
|
},
|
|
1721
|
-
"ts-eslint/no-unused-vars": "off"
|
|
1722
|
-
...overrides
|
|
1775
|
+
"ts-eslint/no-unused-vars": "off"
|
|
1723
1776
|
}
|
|
1724
|
-
}
|
|
1777
|
+
},
|
|
1778
|
+
createOverrideRules({
|
|
1779
|
+
configName: "vue",
|
|
1780
|
+
files,
|
|
1781
|
+
overrides
|
|
1782
|
+
})
|
|
1725
1783
|
];
|
|
1726
1784
|
}
|
|
1727
1785
|
|
|
@@ -1747,10 +1805,14 @@ var solid = async (options = {}) => {
|
|
|
1747
1805
|
name: "zayne/solid/rules",
|
|
1748
1806
|
rules: {
|
|
1749
1807
|
"solid/no-innerhtml": ["error", { allowStatic: true }],
|
|
1750
|
-
"solid/style-prop": ["error", { styleProps: ["style", "css"] }]
|
|
1751
|
-
...overrides
|
|
1808
|
+
"solid/style-prop": ["error", { styleProps: ["style", "css"] }]
|
|
1752
1809
|
}
|
|
1753
|
-
}
|
|
1810
|
+
},
|
|
1811
|
+
createOverrideRules({
|
|
1812
|
+
configName: "solid",
|
|
1813
|
+
files,
|
|
1814
|
+
overrides
|
|
1815
|
+
})
|
|
1754
1816
|
];
|
|
1755
1817
|
};
|
|
1756
1818
|
|
|
@@ -1773,7 +1835,7 @@ var jsx = () => {
|
|
|
1773
1835
|
|
|
1774
1836
|
// src/factory.ts
|
|
1775
1837
|
var ReactPackages = ["react", "react-dom"];
|
|
1776
|
-
var zayne = (options = {}, userConfigs
|
|
1838
|
+
var zayne = (options = {}, ...userConfigs) => {
|
|
1777
1839
|
const {
|
|
1778
1840
|
autoRenamePlugins = true,
|
|
1779
1841
|
componentExts = [],
|
|
@@ -1895,6 +1957,6 @@ var zayne = (options = {}, userConfigs = []) => {
|
|
|
1895
1957
|
return composer;
|
|
1896
1958
|
};
|
|
1897
1959
|
|
|
1898
|
-
export { GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLES, GLOB_SVELTE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, combine, comments, ensurePackages, gitIgnores, ignores, imports, interopDefault, isObject, isPackageInScope, javascript, jsdoc, jsonc, node, perfectionist, react, renamePluginInConfigs, renamePlugins, renameRules, resolveOptions, solid, sortPackageJson, sortTsconfig, stylistic, tailwindcss, tanstack, toml, typescript, unicorn, vue, yaml, zayne };
|
|
1960
|
+
export { GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLES, GLOB_SVELTE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, combine, comments, createOverrideRules, ensurePackages, gitIgnores, ignores, imports, interopDefault, isObject, isPackageInScope, javascript, jsdoc, jsonc, node, perfectionist, react, renamePluginInConfigs, renamePlugins, renameRules, resolveOptions, solid, sortPackageJson, sortTsconfig, stylistic, tailwindcss, tanstack, toml, typescript, unicorn, vue, yaml, zayne };
|
|
1899
1961
|
//# sourceMappingURL=index.js.map
|
|
1900
1962
|
//# sourceMappingURL=index.js.map
|