@eienjs/eslint-config 2.0.1 → 2.1.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/bin/index.mjs +3 -0
- package/dist/cli/{constants.js → constants.mjs} +3 -0
- package/dist/cli/{constants_generated.js → constants_generated.mjs} +6 -3
- package/dist/cli/index.d.mts +2 -0
- package/dist/cli/{index.js → index.mjs} +5 -2
- package/dist/cli/{run.js → run.mjs} +12 -9
- package/dist/cli/stages/{update_eslint_files.js → update_eslint_files.mjs} +4 -1
- package/dist/cli/stages/{update_package_json.js → update_package_json.mjs} +15 -13
- package/dist/cli/stages/{update_vscode_settings.js → update_vscode_settings.mjs} +5 -2
- package/dist/cli/{utils.js → utils.mjs} +3 -0
- package/dist/config_presets.d.mts +9 -0
- package/dist/{config_presets.js → config_presets.mjs} +3 -0
- package/dist/configs/adonisjs.d.mts +8 -0
- package/dist/configs/{adonisjs.js → adonisjs.mjs} +27 -24
- package/dist/configs/{astro.d.ts → astro.d.mts} +3 -1
- package/dist/configs/{astro.js → astro.mjs} +6 -3
- package/dist/configs/command.d.mts +8 -0
- package/dist/configs/{command.js → command.mjs} +3 -0
- package/dist/configs/comments.d.mts +8 -0
- package/dist/configs/{comments.js → comments.mjs} +4 -1
- package/dist/configs/disables.d.mts +8 -0
- package/dist/configs/{disables.js → disables.mjs} +4 -1
- package/dist/configs/e18e.d.mts +8 -0
- package/dist/configs/{e18e.js → e18e.mjs} +7 -4
- package/dist/configs/{formatters.d.ts → formatters.d.mts} +3 -1
- package/dist/configs/{formatters.js → formatters.mjs} +6 -3
- package/dist/configs/ignores.d.mts +8 -0
- package/dist/configs/{ignores.js → ignores.mjs} +6 -3
- package/dist/configs/{imports.d.ts → imports.d.mts} +3 -1
- package/dist/configs/{imports.js → imports.mjs} +5 -2
- package/dist/configs/index.d.mts +29 -0
- package/dist/configs/index.mjs +30 -0
- package/dist/configs/{javascript.d.ts → javascript.d.mts} +3 -1
- package/dist/configs/{javascript.js → javascript.mjs} +4 -1
- package/dist/configs/{jsdoc.d.ts → jsdoc.d.mts} +3 -1
- package/dist/configs/{jsdoc.js → jsdoc.mjs} +7 -4
- package/dist/configs/{jsonc.d.ts → jsonc.d.mts} +3 -1
- package/dist/configs/{jsonc.js → jsonc.mjs} +7 -4
- package/dist/configs/{markdown.d.ts → markdown.d.mts} +3 -1
- package/dist/configs/{markdown.js → markdown.mjs} +5 -2
- package/dist/configs/node.d.mts +8 -0
- package/dist/configs/{node.js → node.mjs} +5 -2
- package/dist/configs/{nuxt.d.ts → nuxt.d.mts} +3 -1
- package/dist/configs/{nuxt.js → nuxt.mjs} +18 -15
- package/dist/configs/{perfectionist.d.ts → perfectionist.d.mts} +3 -1
- package/dist/configs/{perfectionist.js → perfectionist.mjs} +4 -1
- package/dist/configs/pnpm.d.mts +8 -0
- package/dist/configs/{pnpm.js → pnpm.mjs} +6 -3
- package/dist/configs/{regexp.d.ts → regexp.d.mts} +3 -1
- package/dist/configs/{regexp.js → regexp.mjs} +3 -0
- package/dist/configs/{sort.d.ts → sort.d.mts} +3 -1
- package/dist/configs/{sort.js → sort.mjs} +3 -0
- package/dist/configs/{stylistic.d.ts → stylistic.d.mts} +3 -1
- package/dist/configs/{stylistic.js → stylistic.mjs} +5 -2
- package/dist/configs/{test.d.ts → test.d.mts} +3 -1
- package/dist/configs/{test.js → test.mjs} +5 -2
- package/dist/configs/{toml.d.ts → toml.d.mts} +3 -1
- package/dist/configs/{toml.js → toml.mjs} +7 -4
- package/dist/configs/{typescript.d.ts → typescript.d.mts} +3 -1
- package/dist/configs/{typescript.js → typescript.mjs} +17 -14
- package/dist/configs/unicorn.d.mts +8 -0
- package/dist/configs/unicorn.mjs +66 -0
- package/dist/configs/{vue.d.ts → vue.d.mts} +3 -1
- package/dist/configs/{vue.js → vue.mjs} +7 -4
- package/dist/configs/{yaml.d.ts → yaml.d.mts} +3 -1
- package/dist/configs/{yaml.js → yaml.mjs} +7 -4
- package/dist/{factory.d.ts → factory.d.mts} +4 -2
- package/dist/{factory.js → factory.mjs} +36 -33
- package/dist/{globs.d.ts → globs.d.mts} +2 -0
- package/dist/{globs.js → globs.mjs} +3 -0
- package/dist/{index.d.ts → index.d.mts} +9 -7
- package/dist/{index.js → index.mjs} +7 -4
- package/dist/node_modules/.pnpm/find-up-simple@1.0.1/node_modules/find-up-simple/{index.js → index.mjs} +3 -0
- package/dist/package.mjs +7 -0
- package/dist/{plugins.js → plugins.mjs} +3 -0
- package/dist/{typegen.d.ts → typegen.d.mts} +1043 -232
- package/dist/{types.d.ts → types.d.mts} +14 -4
- package/dist/{utils.d.ts → utils.d.mts} +3 -1
- package/dist/{utils.js → utils.mjs} +4 -1
- package/dist/vendored/{prettier_types.d.ts → prettier_types.d.mts} +3 -1
- package/package.json +34 -31
- package/bin/index.js +0 -3
- package/dist/cli/index.d.ts +0 -1
- package/dist/config_presets.d.ts +0 -7
- package/dist/configs/adonisjs.d.ts +0 -6
- package/dist/configs/command.d.ts +0 -6
- package/dist/configs/comments.d.ts +0 -6
- package/dist/configs/disables.d.ts +0 -6
- package/dist/configs/e18e.d.ts +0 -6
- package/dist/configs/ignores.d.ts +0 -6
- package/dist/configs/index.d.ts +0 -27
- package/dist/configs/index.js +0 -27
- package/dist/configs/node.d.ts +0 -6
- package/dist/configs/pnpm.d.ts +0 -6
- package/dist/configs/unicorn.d.ts +0 -6
- package/dist/configs/unicorn.js +0 -40
- package/dist/package.js +0 -4
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN } from "../globs.mjs";
|
|
5
|
+
import { interopDefault } from "../utils.mjs";
|
|
3
6
|
import { mergeProcessors, processorPassThrough } from "eslint-merge-processors";
|
|
4
7
|
//#region src/configs/markdown.ts
|
|
5
8
|
async function markdown(options = {}) {
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { GLOB_SRC } from "../globs.mjs";
|
|
5
|
+
import { pluginNode } from "../plugins.mjs";
|
|
3
6
|
//#region src/configs/node.ts
|
|
4
7
|
function node() {
|
|
5
8
|
return [{
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
import { OptionsNuxt, OptionsStylistic, TypedFlatConfigItem } from "../types.mjs";
|
|
2
4
|
|
|
3
5
|
//#region src/configs/nuxt.d.ts
|
|
4
6
|
declare function nuxt(options?: OptionsNuxt & OptionsStylistic): Promise<TypedFlatConfigItem[]>;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { GLOB_EXTS, GLOB_SRC, GLOB_VUE } from "../globs.mjs";
|
|
5
|
+
import { ensurePackages, interopDefault } from "../utils.mjs";
|
|
3
6
|
import { join } from "pathe";
|
|
4
7
|
//#region src/configs/nuxt.ts
|
|
5
8
|
async function nuxt(options = {}) {
|
|
@@ -7,23 +10,23 @@ async function nuxt(options = {}) {
|
|
|
7
10
|
const { sortConfigKeys = Boolean(stylistic) } = options;
|
|
8
11
|
await ensurePackages(["@nuxt/eslint-plugin"]);
|
|
9
12
|
const pluginNuxt = await interopDefault(import("@nuxt/eslint-plugin"));
|
|
10
|
-
dirs.root
|
|
11
|
-
dirs.src
|
|
12
|
-
dirs.pages
|
|
13
|
-
dirs.layouts
|
|
14
|
-
dirs.components
|
|
15
|
-
dirs.composables
|
|
16
|
-
dirs.plugins
|
|
17
|
-
dirs.modules
|
|
18
|
-
dirs.middleware
|
|
19
|
-
dirs.servers
|
|
20
|
-
dirs.utils
|
|
21
|
-
dirs.componentsPrefixed
|
|
13
|
+
dirs.root ??= [version === 4 ? "./app" : "."];
|
|
14
|
+
dirs.src ??= dirs.root;
|
|
15
|
+
dirs.pages ??= dirs.src.map((src) => `${src}/pages`);
|
|
16
|
+
dirs.layouts ??= dirs.src.map((src) => `${src}/layouts`);
|
|
17
|
+
dirs.components ??= dirs.src.map((src) => `${src}/components`);
|
|
18
|
+
dirs.composables ??= dirs.src.map((src) => `${src}/composables`);
|
|
19
|
+
dirs.plugins ??= dirs.src.map((src) => `${src}/plugins`);
|
|
20
|
+
dirs.modules ??= dirs.src.map((src) => `${src}/modules`);
|
|
21
|
+
dirs.middleware ??= dirs.src.map((src) => `${src}/middleware`);
|
|
22
|
+
dirs.servers ??= dirs.src.map((src) => `${src}/servers`);
|
|
23
|
+
dirs.utils ??= dirs.src.map((src) => `${src}/utils`);
|
|
24
|
+
dirs.componentsPrefixed ??= [];
|
|
22
25
|
const fileSingleRoot = [
|
|
23
26
|
...dirs.layouts.map((layoutsDir) => join(layoutsDir, `**/*.${GLOB_EXTS}`)),
|
|
24
27
|
...dirs.pages.map((pagesDir) => join(pagesDir, `**/*.${GLOB_EXTS}`)),
|
|
25
28
|
...dirs.components.map((componentsDir) => join(componentsDir, `**/*.server.${GLOB_EXTS}`))
|
|
26
|
-
].toSorted();
|
|
29
|
+
].toSorted((a, b) => a.localeCompare(b, void 0, { sensitivity: "base" }));
|
|
27
30
|
const INLINE_ELEMENTS = [
|
|
28
31
|
"a",
|
|
29
32
|
"abbr",
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
import { OptionsOverrides, TypedFlatConfigItem } from "../types.mjs";
|
|
2
4
|
|
|
3
5
|
//#region src/configs/perfectionist.d.ts
|
|
4
6
|
/**
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { pluginPerfectionist } from "../plugins.mjs";
|
|
2
5
|
//#region src/configs/perfectionist.ts
|
|
3
6
|
/**
|
|
4
7
|
* Perfectionist plugin for props and items sorting.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
import { OptionsPnpm, TypedFlatConfigItem } from "../types.mjs";
|
|
4
|
+
|
|
5
|
+
//#region src/configs/pnpm.d.ts
|
|
6
|
+
declare function pnpm(options: OptionsPnpm): Promise<TypedFlatConfigItem[]>;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { pnpm };
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { findUp } from "../node_modules/.pnpm/find-up-simple@1.0.1/node_modules/find-up-simple/index.mjs";
|
|
5
|
+
import { interopDefault } from "../utils.mjs";
|
|
3
6
|
import { readFile } from "node:fs/promises";
|
|
4
7
|
//#region src/configs/pnpm.ts
|
|
5
8
|
async function detectCatalogUsage() {
|
|
@@ -22,7 +25,7 @@ async function pnpm(options) {
|
|
|
22
25
|
name: "eienjs/pnpm/package-json",
|
|
23
26
|
plugins: { pnpm: pluginPnpm },
|
|
24
27
|
rules: {
|
|
25
|
-
...catalogs
|
|
28
|
+
...catalogs && { "pnpm/json-enforce-catalog": "off" },
|
|
26
29
|
"pnpm/json-prefer-workspace-settings": ["error", { autofix: !isInEditor }],
|
|
27
30
|
"pnpm/json-valid-catalog": ["error", { autofix: !isInEditor }]
|
|
28
31
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
import { OptionsOverrides, OptionsRegExp, TypedFlatConfigItem } from "../types.mjs";
|
|
2
4
|
|
|
3
5
|
//#region src/configs/regexp.d.ts
|
|
4
6
|
declare function regexp(options?: OptionsRegExp & OptionsOverrides): TypedFlatConfigItem[];
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
import { OptionsOverrides, StylisticConfig, TypedFlatConfigItem } from "../types.mjs";
|
|
2
4
|
|
|
3
5
|
//#region src/configs/stylistic.d.ts
|
|
4
6
|
declare const StylisticConfigDefaults: StylisticConfig;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { interopDefault } from "../utils.mjs";
|
|
5
|
+
import { pluginAntfu } from "../plugins.mjs";
|
|
3
6
|
//#region src/configs/stylistic.ts
|
|
4
7
|
const StylisticConfigDefaults = {
|
|
5
8
|
braceStyle: "1tbs",
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
import { OptionsFiles, OptionsIsInEditor, OptionsOverrides, TypedFlatConfigItem } from "../types.mjs";
|
|
2
4
|
|
|
3
5
|
//#region src/configs/test.d.ts
|
|
4
6
|
declare function test(options?: OptionsFiles & OptionsIsInEditor & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { GLOB_TESTS } from "../globs.mjs";
|
|
5
|
+
import { interopDefault } from "../utils.mjs";
|
|
3
6
|
//#region src/configs/test.ts
|
|
4
7
|
let _pluginTest;
|
|
5
8
|
async function test(options = {}) {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
import { OptionsFiles, OptionsOverrides, OptionsStylistic, TypedFlatConfigItem } from "../types.mjs";
|
|
2
4
|
|
|
3
5
|
//#region src/configs/toml.d.ts
|
|
4
6
|
declare function toml(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<TypedFlatConfigItem[]>;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { GLOB_TOML } from "../globs.mjs";
|
|
5
|
+
import { interopDefault } from "../utils.mjs";
|
|
3
6
|
//#region src/configs/toml.ts
|
|
4
7
|
async function toml(options = {}) {
|
|
5
8
|
const { files = [GLOB_TOML], overrides = {}, stylistic = true } = options;
|
|
@@ -22,7 +25,7 @@ async function toml(options = {}) {
|
|
|
22
25
|
"toml/precision-of-integer": "error",
|
|
23
26
|
"toml/tables-order": "error",
|
|
24
27
|
"toml/vue-custom-block/no-parsing-error": "error",
|
|
25
|
-
...stylistic
|
|
28
|
+
...stylistic && {
|
|
26
29
|
"toml/array-bracket-newline": "error",
|
|
27
30
|
"toml/array-bracket-spacing": "error",
|
|
28
31
|
"toml/array-element-newline": "error",
|
|
@@ -34,7 +37,7 @@ async function toml(options = {}) {
|
|
|
34
37
|
"toml/quoted-keys": "error",
|
|
35
38
|
"toml/spaced-comment": "error",
|
|
36
39
|
"toml/table-bracket-spacing": "error"
|
|
37
|
-
}
|
|
40
|
+
},
|
|
38
41
|
...overrides
|
|
39
42
|
}
|
|
40
43
|
}];
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
import { OptionsComponentExts, OptionsFiles, OptionsOverrides, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsTypescriptWithErasableSyntaxOnly, TypedFlatConfigItem } from "../types.mjs";
|
|
2
4
|
|
|
3
5
|
//#region src/configs/typescript.d.ts
|
|
4
6
|
declare function typescript(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions & OptionsTypescriptWithErasableSyntaxOnly & OptionsStylistic): Promise<TypedFlatConfigItem[]>;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import "
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import "../globs.mjs";
|
|
5
|
+
import { ensurePackages, interopDefault } from "../utils.mjs";
|
|
6
|
+
import { pluginAntfu } from "../plugins.mjs";
|
|
4
7
|
import process from "node:process";
|
|
5
8
|
//#region src/configs/typescript.ts
|
|
6
9
|
async function typescript(options = {}) {
|
|
@@ -110,26 +113,26 @@ async function typescript(options = {}) {
|
|
|
110
113
|
"no-implied-eval": "off"
|
|
111
114
|
};
|
|
112
115
|
const [pluginTs, parserTs] = await Promise.all([interopDefault(import("@typescript-eslint/eslint-plugin")), interopDefault(import("@typescript-eslint/parser"))]);
|
|
113
|
-
function makeParser(
|
|
116
|
+
function makeParser(isTypeAware, files, ignores) {
|
|
114
117
|
return {
|
|
115
118
|
files,
|
|
116
|
-
...ignores
|
|
119
|
+
...ignores && { ignores },
|
|
117
120
|
languageOptions: {
|
|
118
121
|
parser: parserTs,
|
|
119
122
|
parserOptions: {
|
|
120
123
|
extraFileExtensions: componentExts.map((ext) => `.${ext}`),
|
|
121
124
|
sourceType: "module",
|
|
122
|
-
...
|
|
125
|
+
...isTypeAware && {
|
|
123
126
|
projectService: {
|
|
124
127
|
allowDefaultProject: ["./*.js"],
|
|
125
128
|
defaultProject: tsconfigPath
|
|
126
129
|
},
|
|
127
130
|
tsconfigRootDir: process.cwd()
|
|
128
|
-
}
|
|
131
|
+
},
|
|
129
132
|
...parserOptions
|
|
130
133
|
}
|
|
131
134
|
},
|
|
132
|
-
name: `eienjs/typescript/${
|
|
135
|
+
name: `eienjs/typescript/${isTypeAware ? "type-aware-parser" : "parser"}`
|
|
133
136
|
};
|
|
134
137
|
}
|
|
135
138
|
const rules = [{
|
|
@@ -147,7 +150,7 @@ async function typescript(options = {}) {
|
|
|
147
150
|
rules: {
|
|
148
151
|
...pluginTs.configs["eslint-recommended"].overrides?.[0].rules,
|
|
149
152
|
...pluginTs.configs.strict.rules,
|
|
150
|
-
...stylistic
|
|
153
|
+
...stylistic && pluginTs.configs.stylistic.rules,
|
|
151
154
|
"@typescript-eslint/ban-ts-comment": ["error", { "ts-expect-error": "allow-with-description" }],
|
|
152
155
|
"@typescript-eslint/consistent-type-assertions": "error",
|
|
153
156
|
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
|
|
@@ -201,7 +204,7 @@ async function typescript(options = {}) {
|
|
|
201
204
|
name: "eienjs/typescript/rules-type-aware",
|
|
202
205
|
rules: {
|
|
203
206
|
...pluginTs.configs["strict-type-checked"].rules,
|
|
204
|
-
...stylistic
|
|
207
|
+
...stylistic && pluginTs.configs["stylistic-type-checked"].rules,
|
|
205
208
|
...typeAwareRules,
|
|
206
209
|
...overridesTypeAware
|
|
207
210
|
}
|
|
@@ -219,17 +222,17 @@ async function typescript(options = {}) {
|
|
|
219
222
|
await ensurePackages(["eslint-plugin-erasable-syntax-only"]);
|
|
220
223
|
const pluginErasableSyntaxOnly = await interopDefault(import("eslint-plugin-erasable-syntax-only"));
|
|
221
224
|
const resolvedErasableSyntaxOnly = typeof erasableSyntaxOnly === "boolean" ? {} : erasableSyntaxOnly;
|
|
222
|
-
const
|
|
223
|
-
const
|
|
225
|
+
const isEnums = resolvedErasableSyntaxOnly.enums ?? true;
|
|
226
|
+
const isParameterProperties = resolvedErasableSyntaxOnly.parameterProperties ?? true;
|
|
224
227
|
rules.push({
|
|
225
228
|
files,
|
|
226
229
|
name: "eienjs/typescript/erasable-syntax-only",
|
|
227
230
|
plugins: { "erasable-syntax-only": pluginErasableSyntaxOnly },
|
|
228
231
|
rules: {
|
|
229
|
-
"erasable-syntax-only/enums":
|
|
232
|
+
"erasable-syntax-only/enums": isEnums ? "error" : "off",
|
|
230
233
|
"erasable-syntax-only/import-aliases": "error",
|
|
231
234
|
"erasable-syntax-only/namespaces": "error",
|
|
232
|
-
"erasable-syntax-only/parameter-properties":
|
|
235
|
+
"erasable-syntax-only/parameter-properties": isParameterProperties ? "error" : "off"
|
|
233
236
|
}
|
|
234
237
|
});
|
|
235
238
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
import { OptionsUnicorn, TypedFlatConfigItem } from "../types.mjs";
|
|
4
|
+
|
|
5
|
+
//#region src/configs/unicorn.d.ts
|
|
6
|
+
declare function unicorn(options?: OptionsUnicorn): TypedFlatConfigItem[];
|
|
7
|
+
//#endregion
|
|
8
|
+
export { unicorn };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { GLOB_SRC } from "../globs.mjs";
|
|
5
|
+
import { pluginUnicorn } from "../plugins.mjs";
|
|
6
|
+
//#region src/configs/unicorn.ts
|
|
7
|
+
function unicorn(options = {}) {
|
|
8
|
+
const { allRecommended = true, overrides = {} } = options;
|
|
9
|
+
return [
|
|
10
|
+
{
|
|
11
|
+
name: "eienjs/unicorn/setup",
|
|
12
|
+
plugins: { unicorn: pluginUnicorn }
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
files: [GLOB_SRC],
|
|
16
|
+
name: "eienjs/unicorn/rules",
|
|
17
|
+
rules: {
|
|
18
|
+
...allRecommended ? pluginUnicorn.configs.recommended.rules : {
|
|
19
|
+
"unicorn/consistent-empty-array-spread": "error",
|
|
20
|
+
"unicorn/error-message": "error",
|
|
21
|
+
"unicorn/escape-case": "error",
|
|
22
|
+
"unicorn/new-for-builtins": "error",
|
|
23
|
+
"unicorn/no-instanceof-builtins": "error",
|
|
24
|
+
"unicorn/no-new-array": "error",
|
|
25
|
+
"unicorn/no-new-buffer": "error",
|
|
26
|
+
"unicorn/number-literal-case": "error",
|
|
27
|
+
"unicorn/prefer-dom-node-text-content": "error",
|
|
28
|
+
"unicorn/prefer-includes": "error",
|
|
29
|
+
"unicorn/prefer-node-protocol": "error",
|
|
30
|
+
"unicorn/prefer-number-properties": "error",
|
|
31
|
+
"unicorn/prefer-string-starts-ends-with": "error",
|
|
32
|
+
"unicorn/prefer-type-error": "error",
|
|
33
|
+
"unicorn/throw-new-error": "error"
|
|
34
|
+
},
|
|
35
|
+
"unicorn/consistent-destructuring": "error",
|
|
36
|
+
"unicorn/consistent-function-scoping": ["error", { checkArrowFunctions: false }],
|
|
37
|
+
"unicorn/expiring-todo-comments": "off",
|
|
38
|
+
"unicorn/filename-case": "off",
|
|
39
|
+
"unicorn/name-replacements": "off",
|
|
40
|
+
"unicorn/no-array-reduce": "off",
|
|
41
|
+
"unicorn/no-null": "off",
|
|
42
|
+
"unicorn/no-static-only-class": "off",
|
|
43
|
+
"unicorn/no-thenable": "off",
|
|
44
|
+
"unicorn/no-this-assignment": "off",
|
|
45
|
+
"unicorn/numeric-separators-style": "off",
|
|
46
|
+
"unicorn/prefer-dom-node-append": "off",
|
|
47
|
+
"unicorn/prefer-dom-node-dataset": "off",
|
|
48
|
+
"unicorn/prefer-dom-node-remove": "off",
|
|
49
|
+
"unicorn/prefer-dom-node-text-content": "off",
|
|
50
|
+
"unicorn/prefer-export-from": "off",
|
|
51
|
+
"unicorn/prefer-modern-dom-apis": "off",
|
|
52
|
+
"unicorn/prefer-query-selector": "off",
|
|
53
|
+
"unicorn/prefer-switch": ["error", { emptyDefaultCase: "do-nothing-comment" }],
|
|
54
|
+
"unicorn/prefer-top-level-await": "off",
|
|
55
|
+
...overrides
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
files: [GLOB_SRC],
|
|
60
|
+
name: "eienjs/unicorn/special-rules",
|
|
61
|
+
rules: { "unicorn/filename-case": ["error", { case: "snakeCase" }] }
|
|
62
|
+
}
|
|
63
|
+
];
|
|
64
|
+
}
|
|
65
|
+
//#endregion
|
|
66
|
+
export { unicorn };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
import { OptionsFiles, OptionsHasTypeScript, OptionsOverrides, OptionsStylistic, OptionsVue, TypedFlatConfigItem } from "../types.mjs";
|
|
2
4
|
|
|
3
5
|
//#region src/configs/vue.d.ts
|
|
4
6
|
declare function vue(options?: OptionsVue & OptionsHasTypeScript & OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<TypedFlatConfigItem[]>;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { GLOB_SRC, GLOB_VUE } from "../globs.mjs";
|
|
5
|
+
import { interopDefault } from "../utils.mjs";
|
|
3
6
|
import { mergeProcessors } from "eslint-merge-processors";
|
|
4
7
|
//#region src/configs/vue.ts
|
|
5
8
|
async function vue(options = {}) {
|
|
@@ -143,7 +146,7 @@ async function vue(options = {}) {
|
|
|
143
146
|
words: true
|
|
144
147
|
}],
|
|
145
148
|
"vue/static-class-names-order": "off",
|
|
146
|
-
...stylistic
|
|
149
|
+
...stylistic && {
|
|
147
150
|
"vue/array-bracket-spacing": ["error", "never"],
|
|
148
151
|
"vue/arrow-spacing": ["error", {
|
|
149
152
|
after: true,
|
|
@@ -197,7 +200,7 @@ async function vue(options = {}) {
|
|
|
197
200
|
"vue/quote-props": ["error", "consistent-as-needed"],
|
|
198
201
|
"vue/space-in-parens": ["error", "never"],
|
|
199
202
|
"vue/template-curly-spacing": "error"
|
|
200
|
-
}
|
|
203
|
+
},
|
|
201
204
|
"@stylistic/max-len": "off",
|
|
202
205
|
"@typescript-eslint/explicit-function-return-type": "off",
|
|
203
206
|
"@typescript-eslint/naming-convention": "off",
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
import { OptionsFiles, OptionsOverrides, OptionsStylistic, TypedFlatConfigItem } from "../types.mjs";
|
|
2
4
|
|
|
3
5
|
//#region src/configs/yaml.d.ts
|
|
4
6
|
declare function yaml(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<TypedFlatConfigItem[]>;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { GLOB_YAML } from "../globs.mjs";
|
|
5
|
+
import { interopDefault } from "../utils.mjs";
|
|
3
6
|
//#region src/configs/yaml.ts
|
|
4
7
|
async function yaml(options = {}) {
|
|
5
8
|
const { files = [GLOB_YAML], overrides = {}, stylistic = true } = options;
|
|
@@ -21,7 +24,7 @@ async function yaml(options = {}) {
|
|
|
21
24
|
"yaml/no-irregular-whitespace": "error",
|
|
22
25
|
"yaml/plain-scalar": "error",
|
|
23
26
|
"yaml/vue-custom-block/no-parsing-error": "error",
|
|
24
|
-
...stylistic
|
|
27
|
+
...stylistic && {
|
|
25
28
|
"yaml/block-mapping-question-indicator-newline": "error",
|
|
26
29
|
"yaml/block-sequence-hyphen-indicator-newline": "error",
|
|
27
30
|
"yaml/flow-mapping-curly-newline": "error",
|
|
@@ -36,7 +39,7 @@ async function yaml(options = {}) {
|
|
|
36
39
|
prefer: quotes === "backtick" ? "single" : quotes
|
|
37
40
|
}],
|
|
38
41
|
"yaml/spaced-comment": "error"
|
|
39
|
-
}
|
|
42
|
+
},
|
|
40
43
|
...overrides
|
|
41
44
|
}
|
|
42
45
|
}];
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
import { ConfigNames, RuleOptions } from "./typegen.mjs";
|
|
4
|
+
import { OptionsConfig, TypedFlatConfigItem } from "./types.mjs";
|
|
3
5
|
import { FlatConfigComposer } from "eslint-flat-config-utils";
|
|
4
6
|
import { Linter } from "eslint";
|
|
5
7
|
|
|
@@ -1,33 +1,36 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import "./configs/
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { findUpSync } from "./node_modules/.pnpm/find-up-simple@1.0.1/node_modules/find-up-simple/index.mjs";
|
|
5
|
+
import { GLOB_MARKDOWN } from "./globs.mjs";
|
|
6
|
+
import { interopDefault, isInEditorEnv } from "./utils.mjs";
|
|
7
|
+
import { adonisjs } from "./configs/adonisjs.mjs";
|
|
8
|
+
import { astro } from "./configs/astro.mjs";
|
|
9
|
+
import { command } from "./configs/command.mjs";
|
|
10
|
+
import { comments } from "./configs/comments.mjs";
|
|
11
|
+
import { disables } from "./configs/disables.mjs";
|
|
12
|
+
import { e18e } from "./configs/e18e.mjs";
|
|
13
|
+
import { stylistic } from "./configs/stylistic.mjs";
|
|
14
|
+
import { formatters } from "./configs/formatters.mjs";
|
|
15
|
+
import { ignores } from "./configs/ignores.mjs";
|
|
16
|
+
import { imports } from "./configs/imports.mjs";
|
|
17
|
+
import { javascript } from "./configs/javascript.mjs";
|
|
18
|
+
import { jsdoc } from "./configs/jsdoc.mjs";
|
|
19
|
+
import { jsonc } from "./configs/jsonc.mjs";
|
|
20
|
+
import { markdown } from "./configs/markdown.mjs";
|
|
21
|
+
import { node } from "./configs/node.mjs";
|
|
22
|
+
import { nuxt } from "./configs/nuxt.mjs";
|
|
23
|
+
import { perfectionist } from "./configs/perfectionist.mjs";
|
|
24
|
+
import { pnpm } from "./configs/pnpm.mjs";
|
|
25
|
+
import { regexp } from "./configs/regexp.mjs";
|
|
26
|
+
import { sortPackageJson, sortTsconfig } from "./configs/sort.mjs";
|
|
27
|
+
import { test } from "./configs/test.mjs";
|
|
28
|
+
import { toml } from "./configs/toml.mjs";
|
|
29
|
+
import { typescript } from "./configs/typescript.mjs";
|
|
30
|
+
import { unicorn } from "./configs/unicorn.mjs";
|
|
31
|
+
import { vue } from "./configs/vue.mjs";
|
|
32
|
+
import { yaml } from "./configs/yaml.mjs";
|
|
33
|
+
import "./configs/index.mjs";
|
|
31
34
|
import { FlatConfigComposer } from "eslint-flat-config-utils";
|
|
32
35
|
import { isPackageExists } from "local-pkg";
|
|
33
36
|
//#region src/factory.ts
|
|
@@ -80,7 +83,7 @@ function eienjs(options = {}) {
|
|
|
80
83
|
stylistic: stylisticOptions,
|
|
81
84
|
...resolveSubOptions(options, "imports")
|
|
82
85
|
}));
|
|
83
|
-
if (enableE18e) configs.push(e18e({ ...enableE18e
|
|
86
|
+
if (enableE18e) configs.push(e18e({ ...enableE18e !== true && enableE18e }));
|
|
84
87
|
if (enableUnicorn) configs.push(unicorn(enableUnicorn === true ? {} : enableUnicorn));
|
|
85
88
|
if (enableVue) componentExts.push("vue");
|
|
86
89
|
if (enableTypeScript) configs.push(typescript({
|
|
@@ -149,7 +152,7 @@ function eienjs(options = {}) {
|
|
|
149
152
|
"Place it in the second or later config instead."
|
|
150
153
|
].join(""));
|
|
151
154
|
const fusedConfig = flatConfigProps.reduce((acc, key) => {
|
|
152
|
-
if (key
|
|
155
|
+
if (Object.hasOwn(options, key)) acc[key] = options[key];
|
|
153
156
|
return acc;
|
|
154
157
|
}, {});
|
|
155
158
|
if (Object.keys(fusedConfig).length > 0) configs.push([fusedConfig]);
|
|
@@ -169,7 +172,7 @@ function resolveSubOptions(options, key) {
|
|
|
169
172
|
}
|
|
170
173
|
function getOverrides(options, key) {
|
|
171
174
|
const sub = resolveSubOptions(options, key);
|
|
172
|
-
return { ..."overrides" in sub
|
|
175
|
+
return { ..."overrides" in sub && sub.overrides };
|
|
173
176
|
}
|
|
174
177
|
//#endregion
|
|
175
178
|
export { defaultPluginRenaming, eienjs, getOverrides, resolveSubOptions };
|