@svifty7/eslint-config 0.0.4 → 0.0.6
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.cjs +2204 -0
- package/dist/index.d.cts +16871 -0
- package/dist/index.d.mts +26 -26
- package/dist/index.mjs +10 -11
- package/package.json +5 -4
package/dist/index.d.mts
CHANGED
|
@@ -16672,32 +16672,9 @@ interface OptionsConfig extends OptionsComponentExts, OptionsProjectType {
|
|
|
16672
16672
|
* @default true
|
|
16673
16673
|
*/
|
|
16674
16674
|
autoRenamePlugins?: boolean;
|
|
16675
|
-
prettier?:
|
|
16675
|
+
prettier?: boolean | PrettierConfig;
|
|
16676
16676
|
}
|
|
16677
16677
|
//#endregion
|
|
16678
|
-
//#region src/factory.d.ts
|
|
16679
|
-
declare const defaultPluginRenaming: {
|
|
16680
|
-
'@stylistic': string;
|
|
16681
|
-
'@typescript-eslint': string;
|
|
16682
|
-
'import-x': string;
|
|
16683
|
-
node: string;
|
|
16684
|
-
vitest: string;
|
|
16685
|
-
yml: string;
|
|
16686
|
-
};
|
|
16687
|
-
/**
|
|
16688
|
-
* Construct an array of ESLint flat config items.
|
|
16689
|
-
*
|
|
16690
|
-
* @param {OptionsConfig & TypedFlatConfigItem} options
|
|
16691
|
-
* The options for generating the ESLint configurations.
|
|
16692
|
-
* @param {Awaitable<TypedFlatConfigItem | TypedFlatConfigItem[]>[]} userConfigs
|
|
16693
|
-
* The user configurations to be merged with the generated configurations.
|
|
16694
|
-
* @returns {Promise<TypedFlatConfigItem[]>}
|
|
16695
|
-
* The merged ESLint configurations.
|
|
16696
|
-
*/
|
|
16697
|
-
declare function configure(options?: OptionsConfig & Omit<TypedFlatConfigItem, 'files'>, ...userConfigs: Awaitable<TypedFlatConfigItem | TypedFlatConfigItem[] | FlatConfigComposer<any, any> | Linter.Config[]>[]): FlatConfigComposer<TypedFlatConfigItem, ConfigNames>;
|
|
16698
|
-
type ResolvedOptions<T> = T extends boolean ? never : NonNullable<T>;
|
|
16699
|
-
declare function resolveSubOptions<K extends keyof OptionsConfig>(options: OptionsConfig, key: K): ResolvedOptions<OptionsConfig[K]>;
|
|
16700
|
-
//#endregion
|
|
16701
16678
|
//#region src/configs/command.d.ts
|
|
16702
16679
|
declare function command(): TypedFlatConfigItem[];
|
|
16703
16680
|
//#endregion
|
|
@@ -16708,7 +16685,7 @@ declare function comments(): TypedFlatConfigItem[];
|
|
|
16708
16685
|
declare function disables(): TypedFlatConfigItem[];
|
|
16709
16686
|
//#endregion
|
|
16710
16687
|
//#region src/configs/formatters.d.ts
|
|
16711
|
-
declare function formatters(stylistic?: Omit<StylisticCustomizeOptions, 'pluginName'>): Promise<TypedFlatConfigItem[]>;
|
|
16688
|
+
declare function formatters(stylistic?: Omit<StylisticCustomizeOptions, 'pluginName'>, prettier?: Partial<PrettierConfig>): Promise<TypedFlatConfigItem[]>;
|
|
16712
16689
|
//#endregion
|
|
16713
16690
|
//#region src/configs/ignores.d.ts
|
|
16714
16691
|
declare function ignores(userIgnores?: string[]): TypedFlatConfigItem[];
|
|
@@ -16784,6 +16761,29 @@ declare function vue(options?: OptionsHasTypeScript & OptionsFiles): Promise<Typ
|
|
|
16784
16761
|
//#region src/configs/yaml.d.ts
|
|
16785
16762
|
declare function yaml(options?: OptionsStylistic & OptionsFiles): Promise<TypedFlatConfigItem[]>;
|
|
16786
16763
|
//#endregion
|
|
16764
|
+
//#region src/factory.d.ts
|
|
16765
|
+
declare const defaultPluginRenaming: {
|
|
16766
|
+
'@stylistic': string;
|
|
16767
|
+
'@typescript-eslint': string;
|
|
16768
|
+
'import-x': string;
|
|
16769
|
+
node: string;
|
|
16770
|
+
vitest: string;
|
|
16771
|
+
yml: string;
|
|
16772
|
+
};
|
|
16773
|
+
/**
|
|
16774
|
+
* Construct an array of ESLint flat config items.
|
|
16775
|
+
*
|
|
16776
|
+
* @param {OptionsConfig & TypedFlatConfigItem} options
|
|
16777
|
+
* The options for generating the ESLint configurations.
|
|
16778
|
+
* @param {Awaitable<TypedFlatConfigItem | TypedFlatConfigItem[]>[]} userConfigs
|
|
16779
|
+
* The user configurations to be merged with the generated configurations.
|
|
16780
|
+
* @returns {Promise<TypedFlatConfigItem[]>}
|
|
16781
|
+
* The merged ESLint configurations.
|
|
16782
|
+
*/
|
|
16783
|
+
declare function configure(options?: OptionsConfig & Omit<TypedFlatConfigItem, 'files'>, ...userConfigs: Awaitable<TypedFlatConfigItem | TypedFlatConfigItem[] | FlatConfigComposer<any, any> | Linter.Config[]>[]): FlatConfigComposer<TypedFlatConfigItem, ConfigNames>;
|
|
16784
|
+
type ResolvedOptions<T> = T extends boolean ? never : NonNullable<T>;
|
|
16785
|
+
declare function resolveSubOptions<K extends keyof OptionsConfig>(options: OptionsConfig, key: K): ResolvedOptions<OptionsConfig[K]>;
|
|
16786
|
+
//#endregion
|
|
16787
16787
|
//#region src/globs.d.ts
|
|
16788
16788
|
declare const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
16789
16789
|
declare const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
@@ -16868,4 +16868,4 @@ declare function interopDefault<T>(m: Awaitable<T>): Promise<T extends {
|
|
|
16868
16868
|
declare function isInEditorEnv(): boolean;
|
|
16869
16869
|
declare function isInGitHooksOrLintStaged(): boolean;
|
|
16870
16870
|
//#endregion
|
|
16871
|
-
export { Awaitable, type ConfigNames, DefaultPrettierConfig, GLOB_ALL_SRC, 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_STYLE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, OptionsComponentExts, OptionsConfig, OptionsFiles, OptionsHasTypeScript, OptionsIsInEditor, OptionsProjectType, OptionsRegExp, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsTypescript, OptionsUnicorn, PrettierConfig, ResolvedOptions, Rules, StylisticConfig, StylisticConfigDefaults, TypedFlatConfigItem, XmlPrettierConfig, combine, command, comments, configure,
|
|
16871
|
+
export { Awaitable, type ConfigNames, DefaultPrettierConfig, GLOB_ALL_SRC, 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_STYLE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, OptionsComponentExts, OptionsConfig, OptionsFiles, OptionsHasTypeScript, OptionsIsInEditor, OptionsProjectType, OptionsRegExp, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsTypescript, OptionsUnicorn, PrettierConfig, ResolvedOptions, Rules, StylisticConfig, StylisticConfigDefaults, TypedFlatConfigItem, XmlPrettierConfig, combine, command, comments, configure, defaultPluginRenaming, disables, formatters, ignores, imports, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, javascript, jsdoc, jsonc, jsx, markdown, node, parserPlain, perfectionist, pnpm, regexp, renameRules, resolveSubOptions, sortPackageJson, sortTsconfig, stylistic, test, toml, typescript, unicorn, vue, yaml };
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { FlatConfigComposer } from "eslint-flat-config-utils";
|
|
2
|
-
import { isPackageExists, resolveModule } from "local-pkg";
|
|
3
1
|
import createCommand from "eslint-plugin-command/config";
|
|
4
2
|
import pluginComments from "@eslint-community/eslint-plugin-eslint-comments";
|
|
5
3
|
import pluginAntfu from "eslint-plugin-antfu";
|
|
@@ -9,9 +7,11 @@ import pluginPerfectionist from "eslint-plugin-perfectionist";
|
|
|
9
7
|
import pluginUnicorn from "eslint-plugin-unicorn";
|
|
10
8
|
import pluginUnusedImports from "eslint-plugin-unused-imports";
|
|
11
9
|
import { fileURLToPath } from "node:url";
|
|
10
|
+
import { isPackageExists, resolveModule } from "local-pkg";
|
|
12
11
|
import globals from "globals";
|
|
13
12
|
import { mergeProcessors, processorPassThrough } from "eslint-merge-processors";
|
|
14
13
|
import { configs } from "eslint-plugin-regexp";
|
|
14
|
+
import { FlatConfigComposer } from "eslint-flat-config-utils";
|
|
15
15
|
|
|
16
16
|
//#region src/configs/command.ts
|
|
17
17
|
function command() {
|
|
@@ -554,7 +554,7 @@ function mergePrettierOptions(options, overrides = {}) {
|
|
|
554
554
|
};
|
|
555
555
|
return config;
|
|
556
556
|
}
|
|
557
|
-
async function formatters(stylistic$1 = {}) {
|
|
557
|
+
async function formatters(stylistic$1 = {}, prettier = {}) {
|
|
558
558
|
const { indent, quotes, semi } = {
|
|
559
559
|
...StylisticConfigDefaults,
|
|
560
560
|
...stylistic$1
|
|
@@ -576,7 +576,8 @@ async function formatters(stylistic$1 = {}) {
|
|
|
576
576
|
htmlWhitespaceSensitivity: "css",
|
|
577
577
|
vueIndentScriptAndStyle: true,
|
|
578
578
|
endOfLine: "lf",
|
|
579
|
-
singleAttributePerLine: true
|
|
579
|
+
singleAttributePerLine: true,
|
|
580
|
+
...prettier
|
|
580
581
|
};
|
|
581
582
|
const pluginFormat = await interopDefault(import("eslint-plugin-format"));
|
|
582
583
|
const tailwindPluginPath = resolveModule("prettier-plugin-tailwindcss", { paths: [fileURLToPath(import.meta.url)] });
|
|
@@ -2045,7 +2046,8 @@ function configure(options = {}, ...userConfigs) {
|
|
|
2045
2046
|
regexp: true,
|
|
2046
2047
|
typescript: isPackageExists("typescript") ? {} : void 0,
|
|
2047
2048
|
unicorn: true,
|
|
2048
|
-
vue: VuePackages.some((i) => isPackageExists(i)) ? {} : void 0
|
|
2049
|
+
vue: VuePackages.some((i) => isPackageExists(i)) ? {} : void 0,
|
|
2050
|
+
prettier: true
|
|
2049
2051
|
};
|
|
2050
2052
|
const { autoRenamePlugins, componentExts = [], gitignore: enableGitignore, jsx: enableJsx, pnpm: enableCatalogs, regexp: enableRegexp, typescript: enableTypeScript, unicorn: enableUnicorn, vue: enableVue } = Object.assign(defaultConfig, options);
|
|
2051
2053
|
let isInEditor = options.isInEditor;
|
|
@@ -2086,7 +2088,8 @@ function configure(options = {}, ...userConfigs) {
|
|
|
2086
2088
|
if (options.yaml ?? true) configs$1.push(yaml({ stylistic: stylisticOptions }));
|
|
2087
2089
|
if (options.toml ?? true) configs$1.push(toml({ stylistic: stylisticOptions }));
|
|
2088
2090
|
if (options.markdown ?? true) configs$1.push(markdown({ componentExts }));
|
|
2089
|
-
configs$1.push(formatters(
|
|
2091
|
+
if (typeof options.prettier === "object") configs$1.push(formatters(options.stylistic, options.prettier));
|
|
2092
|
+
else if (options.prettier ?? true) configs$1.push(formatters(options.stylistic));
|
|
2090
2093
|
configs$1.push(disables());
|
|
2091
2094
|
if ("files" in options) throw new Error("[@svifty7/eslint-config] The first argument should not contain the \"files\" property as the options are supposed to be global. Place it in the second or later config instead.");
|
|
2092
2095
|
const fusedConfig = flatConfigProps.reduce((acc, key) => {
|
|
@@ -2109,8 +2112,4 @@ function resolveSubOptions(options, key) {
|
|
|
2109
2112
|
}
|
|
2110
2113
|
|
|
2111
2114
|
//#endregion
|
|
2112
|
-
|
|
2113
|
-
var src_default = configure;
|
|
2114
|
-
|
|
2115
|
-
//#endregion
|
|
2116
|
-
export { GLOB_ALL_SRC, 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_STYLE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, StylisticConfigDefaults, combine, command, comments, configure, src_default as default, defaultPluginRenaming, disables, formatters, ignores, imports, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, javascript, jsdoc, jsonc, jsx, markdown, node, parserPlain, perfectionist, pnpm, regexp, renameRules, resolveSubOptions, sortPackageJson, sortTsconfig, stylistic, test, toml, typescript, unicorn, vue, yaml };
|
|
2115
|
+
export { GLOB_ALL_SRC, 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_STYLE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, StylisticConfigDefaults, combine, command, comments, configure, defaultPluginRenaming, disables, formatters, ignores, imports, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, javascript, jsdoc, jsonc, jsx, markdown, node, parserPlain, perfectionist, pnpm, regexp, renameRules, resolveSubOptions, sortPackageJson, sortTsconfig, stylistic, test, toml, typescript, unicorn, vue, yaml };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@svifty7/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.6",
|
|
5
5
|
"description": "ESLint config by svifty7 based on @antfu/eslint-config",
|
|
6
6
|
"author": "svifty7 (https://github.com/svifty7)",
|
|
7
7
|
"license": "MIT",
|
|
@@ -20,11 +20,12 @@
|
|
|
20
20
|
"exports": {
|
|
21
21
|
".": {
|
|
22
22
|
"types": "./dist/index.d.ts",
|
|
23
|
-
"import": "./dist/index.
|
|
24
|
-
"require": "./dist/index.
|
|
23
|
+
"import": "./dist/index.mjs",
|
|
24
|
+
"require": "./dist/index.cjs"
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
|
-
"main": "./dist/index.
|
|
27
|
+
"main": "./dist/index.cjs",
|
|
28
|
+
"module": "./dist/index.mjs",
|
|
28
29
|
"types": "./dist/index.d.ts",
|
|
29
30
|
"files": [
|
|
30
31
|
"dist"
|