@eienjs/eslint-config 1.2.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/constants.js +74 -0
- package/dist/cli/constants_generated.js +13 -0
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +3 -268
- package/dist/cli/run.js +77 -0
- package/dist/cli/stages/update_eslint_files.js +41 -0
- package/dist/cli/stages/update_package_json.js +46 -0
- package/dist/cli/stages/update_vscode_settings.js +30 -0
- package/dist/cli/utils.js +23 -0
- package/dist/configs/adonisjs.d.ts +6 -0
- package/dist/configs/adonisjs.js +115 -0
- package/dist/configs/astro.d.ts +6 -0
- package/dist/configs/astro.js +52 -0
- package/dist/configs/command.d.ts +6 -0
- package/dist/configs/command.js +12 -0
- package/dist/configs/comments.d.ts +6 -0
- package/dist/configs/comments.js +19 -0
- package/dist/configs/disables.d.ts +6 -0
- package/dist/configs/disables.js +85 -0
- package/dist/configs/formatters.d.ts +6 -0
- package/dist/configs/formatters.js +134 -0
- package/dist/configs/ignores.d.ts +6 -0
- package/dist/configs/ignores.js +12 -0
- package/dist/configs/imports.d.ts +6 -0
- package/dist/configs/imports.js +28 -0
- package/dist/configs/index.d.ts +25 -95
- package/dist/configs/index.js +25 -1
- package/dist/configs/javascript.d.ts +6 -0
- package/dist/configs/javascript.js +289 -0
- package/dist/configs/jsdoc.d.ts +6 -0
- package/dist/configs/jsdoc.js +34 -0
- package/dist/configs/jsonc.d.ts +6 -0
- package/dist/configs/jsonc.js +71 -0
- package/dist/configs/markdown.d.ts +6 -0
- package/dist/configs/markdown.js +67 -0
- package/dist/configs/node.d.ts +6 -0
- package/dist/configs/node.js +22 -0
- package/dist/configs/nuxt.d.ts +6 -0
- package/dist/configs/nuxt.js +137 -0
- package/dist/configs/perfectionist.d.ts +12 -0
- package/dist/configs/perfectionist.js +56 -0
- package/dist/configs/pnpm.d.ts +6 -0
- package/dist/configs/pnpm.js +33 -0
- package/dist/configs/regexp.d.ts +6 -0
- package/dist/configs/regexp.js +21 -0
- package/dist/configs/sort.d.ts +18 -0
- package/dist/configs/sort.js +239 -0
- package/dist/configs/stylistic.d.ts +8 -0
- package/dist/configs/stylistic.js +76 -0
- package/dist/configs/test.d.ts +6 -0
- package/dist/configs/test.js +42 -0
- package/dist/configs/toml.d.ts +6 -0
- package/dist/configs/toml.js +45 -0
- package/dist/configs/typescript.d.ts +6 -0
- package/dist/configs/typescript.js +213 -0
- package/dist/configs/unicorn.d.ts +6 -0
- package/dist/configs/unicorn.js +42 -0
- package/dist/configs/vue.d.ts +6 -0
- package/dist/configs/vue.js +206 -0
- package/dist/configs/yaml.d.ts +6 -0
- package/dist/configs/yaml.js +83 -0
- package/dist/factory.d.ts +17 -0
- package/dist/factory.js +161 -0
- package/dist/globs.d.ts +32 -0
- package/dist/globs.js +89 -0
- package/dist/index.d.ts +5 -85
- package/dist/index.js +3 -133
- package/dist/package.js +5 -0
- package/dist/plugins.js +9 -0
- package/dist/{types-CThb4-OB.d.ts → typegen.d.ts} +353 -703
- package/dist/types.d.ts +404 -0
- package/dist/utils.d.ts +42 -0
- package/dist/utils.js +62 -0
- package/dist/vendored/prettier_types.d.ts +121 -0
- package/package.json +31 -24
- package/dist/configs-tpIJYMDE.js +0 -2189
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { GLOB_EXTS, GLOB_SRC, GLOB_VUE } from "../globs.js";
|
|
2
|
+
import { ensurePackages, interopDefault } from "../utils.js";
|
|
3
|
+
import { join } from "pathe";
|
|
4
|
+
|
|
5
|
+
//#region src/configs/nuxt.ts
|
|
6
|
+
async function nuxt(options = {}) {
|
|
7
|
+
const { overrides = {}, dirs = {}, version = 4, stylistic = true } = options;
|
|
8
|
+
const { sortConfigKeys = Boolean(stylistic) } = options;
|
|
9
|
+
await ensurePackages(["@nuxt/eslint-plugin"]);
|
|
10
|
+
const pluginNuxt = await interopDefault(import("@nuxt/eslint-plugin"));
|
|
11
|
+
dirs.root = dirs.root ?? [version === 4 ? "./app" : "."];
|
|
12
|
+
dirs.src = dirs.src ?? dirs.root;
|
|
13
|
+
dirs.pages = dirs.pages ?? dirs.src.map((src) => `${src}/pages`);
|
|
14
|
+
dirs.layouts = dirs.layouts ?? dirs.src.map((src) => `${src}/layouts`);
|
|
15
|
+
dirs.components = dirs.components ?? dirs.src.map((src) => `${src}/components`);
|
|
16
|
+
dirs.composables = dirs.composables ?? dirs.src.map((src) => `${src}/composables`);
|
|
17
|
+
dirs.plugins = dirs.plugins ?? dirs.src.map((src) => `${src}/plugins`);
|
|
18
|
+
dirs.modules = dirs.modules ?? dirs.src.map((src) => `${src}/modules`);
|
|
19
|
+
dirs.middleware = dirs.middleware ?? dirs.src.map((src) => `${src}/middleware`);
|
|
20
|
+
dirs.servers = dirs.servers ?? dirs.src.map((src) => `${src}/servers`);
|
|
21
|
+
dirs.utils = dirs.utils ?? dirs.src.map((src) => `${src}/utils`);
|
|
22
|
+
dirs.componentsPrefixed = dirs.componentsPrefixed ?? [];
|
|
23
|
+
const fileSingleRoot = [
|
|
24
|
+
...dirs.layouts.map((layoutsDir) => join(layoutsDir, `**/*.${GLOB_EXTS}`)),
|
|
25
|
+
...dirs.pages.map((pagesDir) => join(pagesDir, `**/*.${GLOB_EXTS}`)),
|
|
26
|
+
...dirs.components.map((componentsDir) => join(componentsDir, `**/*.server.${GLOB_EXTS}`))
|
|
27
|
+
].toSorted();
|
|
28
|
+
const INLINE_ELEMENTS = [
|
|
29
|
+
"a",
|
|
30
|
+
"abbr",
|
|
31
|
+
"audio",
|
|
32
|
+
"b",
|
|
33
|
+
"bdi",
|
|
34
|
+
"bdo",
|
|
35
|
+
"canvas",
|
|
36
|
+
"cite",
|
|
37
|
+
"code",
|
|
38
|
+
"data",
|
|
39
|
+
"del",
|
|
40
|
+
"dfn",
|
|
41
|
+
"em",
|
|
42
|
+
"i",
|
|
43
|
+
"iframe",
|
|
44
|
+
"ins",
|
|
45
|
+
"kbd",
|
|
46
|
+
"label",
|
|
47
|
+
"map",
|
|
48
|
+
"mark",
|
|
49
|
+
"noscript",
|
|
50
|
+
"object",
|
|
51
|
+
"output",
|
|
52
|
+
"picture",
|
|
53
|
+
"q",
|
|
54
|
+
"ruby",
|
|
55
|
+
"s",
|
|
56
|
+
"samp",
|
|
57
|
+
"small",
|
|
58
|
+
"span",
|
|
59
|
+
"strong",
|
|
60
|
+
"sub",
|
|
61
|
+
"sup",
|
|
62
|
+
"svg",
|
|
63
|
+
"time",
|
|
64
|
+
"u",
|
|
65
|
+
"var",
|
|
66
|
+
"video"
|
|
67
|
+
];
|
|
68
|
+
return [
|
|
69
|
+
{
|
|
70
|
+
name: "eienjs/nuxt/setup",
|
|
71
|
+
plugins: { nuxt: pluginNuxt },
|
|
72
|
+
languageOptions: { globals: { $fetch: "readonly" } }
|
|
73
|
+
},
|
|
74
|
+
...fileSingleRoot.length > 0 ? [{
|
|
75
|
+
files: fileSingleRoot,
|
|
76
|
+
name: "eienjs/nuxt/vue/single-root",
|
|
77
|
+
rules: { "vue/no-multiple-template-root": "error" }
|
|
78
|
+
}] : [],
|
|
79
|
+
{
|
|
80
|
+
name: "eienjs/nuxt/rules",
|
|
81
|
+
rules: {
|
|
82
|
+
"nuxt/prefer-import-meta": "error",
|
|
83
|
+
...overrides
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
files: dirs.utils.map((utilsDir) => join(utilsDir, GLOB_SRC)),
|
|
88
|
+
name: "eienjs/nuxt/utils-disables",
|
|
89
|
+
rules: { "@typescript-eslint/explicit-module-boundary-types": "off" }
|
|
90
|
+
},
|
|
91
|
+
...sortConfigKeys ? [{
|
|
92
|
+
files: ["**/nuxt.config.?([cm])[jt]s?(x)"],
|
|
93
|
+
name: "eienjs/nuxt/sort-config",
|
|
94
|
+
rules: { "nuxt/nuxt-config-keys-order": "error" }
|
|
95
|
+
}] : [],
|
|
96
|
+
...stylistic ? [{
|
|
97
|
+
files: [GLOB_VUE],
|
|
98
|
+
name: "eienjs/nuxt/vue/rules",
|
|
99
|
+
rules: {
|
|
100
|
+
"vue/multiline-html-element-content-newline": ["error", {
|
|
101
|
+
ignoreWhenEmpty: true,
|
|
102
|
+
ignores: [
|
|
103
|
+
"pre",
|
|
104
|
+
"textarea",
|
|
105
|
+
"router-link",
|
|
106
|
+
"RouterLink",
|
|
107
|
+
"nuxt-link",
|
|
108
|
+
"NuxtLink",
|
|
109
|
+
"u-link",
|
|
110
|
+
"ULink",
|
|
111
|
+
...INLINE_ELEMENTS
|
|
112
|
+
],
|
|
113
|
+
allowEmptyLines: false
|
|
114
|
+
}],
|
|
115
|
+
"vue/singleline-html-element-content-newline": ["error", {
|
|
116
|
+
ignoreWhenNoAttributes: true,
|
|
117
|
+
ignoreWhenEmpty: true,
|
|
118
|
+
ignores: [
|
|
119
|
+
"pre",
|
|
120
|
+
"textarea",
|
|
121
|
+
"router-link",
|
|
122
|
+
"RouterLink",
|
|
123
|
+
"nuxt-link",
|
|
124
|
+
"NuxtLink",
|
|
125
|
+
"u-link",
|
|
126
|
+
"ULink",
|
|
127
|
+
...INLINE_ELEMENTS
|
|
128
|
+
],
|
|
129
|
+
externalIgnores: []
|
|
130
|
+
}]
|
|
131
|
+
}
|
|
132
|
+
}] : []
|
|
133
|
+
];
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
//#endregion
|
|
137
|
+
export { nuxt };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TypedFlatConfigItem } from "../types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/configs/perfectionist.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Perfectionist plugin for props and items sorting.
|
|
7
|
+
*
|
|
8
|
+
* @see https://github.com/azat-io/eslint-plugin-perfectionist
|
|
9
|
+
*/
|
|
10
|
+
declare function perfectionist(): TypedFlatConfigItem[];
|
|
11
|
+
//#endregion
|
|
12
|
+
export { perfectionist };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { pluginPerfectionist } from "../plugins.js";
|
|
2
|
+
|
|
3
|
+
//#region src/configs/perfectionist.ts
|
|
4
|
+
/**
|
|
5
|
+
* Perfectionist plugin for props and items sorting.
|
|
6
|
+
*
|
|
7
|
+
* @see https://github.com/azat-io/eslint-plugin-perfectionist
|
|
8
|
+
*/
|
|
9
|
+
function perfectionist() {
|
|
10
|
+
return [{
|
|
11
|
+
name: "eienjs/perfectionist/setup",
|
|
12
|
+
plugins: { perfectionist: pluginPerfectionist },
|
|
13
|
+
rules: {
|
|
14
|
+
"perfectionist/sort-exports": ["error", {
|
|
15
|
+
order: "asc",
|
|
16
|
+
type: "natural"
|
|
17
|
+
}],
|
|
18
|
+
"perfectionist/sort-imports": ["error", {
|
|
19
|
+
groups: [
|
|
20
|
+
"type",
|
|
21
|
+
[
|
|
22
|
+
"parent-type",
|
|
23
|
+
"sibling-type",
|
|
24
|
+
"index-type",
|
|
25
|
+
"internal-type"
|
|
26
|
+
],
|
|
27
|
+
"builtin",
|
|
28
|
+
"external",
|
|
29
|
+
"internal",
|
|
30
|
+
[
|
|
31
|
+
"parent",
|
|
32
|
+
"sibling",
|
|
33
|
+
"index"
|
|
34
|
+
],
|
|
35
|
+
"side-effect",
|
|
36
|
+
"object",
|
|
37
|
+
"unknown"
|
|
38
|
+
],
|
|
39
|
+
newlinesBetween: "ignore",
|
|
40
|
+
order: "asc",
|
|
41
|
+
type: "natural"
|
|
42
|
+
}],
|
|
43
|
+
"perfectionist/sort-named-exports": ["error", {
|
|
44
|
+
order: "asc",
|
|
45
|
+
type: "natural"
|
|
46
|
+
}],
|
|
47
|
+
"perfectionist/sort-named-imports": ["error", {
|
|
48
|
+
order: "asc",
|
|
49
|
+
type: "natural"
|
|
50
|
+
}]
|
|
51
|
+
}
|
|
52
|
+
}];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
//#endregion
|
|
56
|
+
export { perfectionist };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { interopDefault } from "../utils.js";
|
|
2
|
+
|
|
3
|
+
//#region src/configs/pnpm.ts
|
|
4
|
+
async function pnpm() {
|
|
5
|
+
const [pluginPnpm, yamlParser, jsoncParser] = await Promise.all([
|
|
6
|
+
interopDefault(import("eslint-plugin-pnpm")),
|
|
7
|
+
interopDefault(import("yaml-eslint-parser")),
|
|
8
|
+
interopDefault(import("jsonc-eslint-parser"))
|
|
9
|
+
]);
|
|
10
|
+
return [{
|
|
11
|
+
files: ["package.json", "**/package.json"],
|
|
12
|
+
languageOptions: { parser: jsoncParser },
|
|
13
|
+
name: "eienjs/pnpm/package-json",
|
|
14
|
+
plugins: { pnpm: pluginPnpm },
|
|
15
|
+
rules: {
|
|
16
|
+
"pnpm/json-enforce-catalog": "error",
|
|
17
|
+
"pnpm/json-prefer-workspace-settings": "error",
|
|
18
|
+
"pnpm/json-valid-catalog": "error"
|
|
19
|
+
}
|
|
20
|
+
}, {
|
|
21
|
+
files: ["pnpm-workspace.yaml"],
|
|
22
|
+
languageOptions: { parser: yamlParser },
|
|
23
|
+
name: "eienjs/pnpm/pnpm-workspace-yaml",
|
|
24
|
+
plugins: { pnpm: pluginPnpm },
|
|
25
|
+
rules: {
|
|
26
|
+
"pnpm/yaml-no-duplicate-catalog-item": "error",
|
|
27
|
+
"pnpm/yaml-no-unused-catalog-item": "error"
|
|
28
|
+
}
|
|
29
|
+
}];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
//#endregion
|
|
33
|
+
export { pnpm };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { configs } from "eslint-plugin-regexp";
|
|
2
|
+
|
|
3
|
+
//#region src/configs/regexp.ts
|
|
4
|
+
function regexp(options = {}) {
|
|
5
|
+
const config = configs["flat/recommended"];
|
|
6
|
+
const rules = { ...config.rules };
|
|
7
|
+
if (options.level === "warn") {
|
|
8
|
+
for (const key in rules) if (rules[key] === "error") rules[key] = "warn";
|
|
9
|
+
}
|
|
10
|
+
return [{
|
|
11
|
+
...config,
|
|
12
|
+
name: "eienjs/regexp/rules",
|
|
13
|
+
rules: {
|
|
14
|
+
...rules,
|
|
15
|
+
...options.overrides
|
|
16
|
+
}
|
|
17
|
+
}];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
export { regexp };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { TypedFlatConfigItem } from "../types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/configs/sort.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Sort package.json
|
|
7
|
+
*
|
|
8
|
+
* Requires `jsonc` config
|
|
9
|
+
*/
|
|
10
|
+
declare function sortPackageJson(): TypedFlatConfigItem[];
|
|
11
|
+
/**
|
|
12
|
+
* Sort tsconfig.json
|
|
13
|
+
*
|
|
14
|
+
* Requires `jsonc` config
|
|
15
|
+
*/
|
|
16
|
+
declare function sortTsconfig(): TypedFlatConfigItem[];
|
|
17
|
+
//#endregion
|
|
18
|
+
export { sortPackageJson, sortTsconfig };
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
//#region src/configs/sort.ts
|
|
2
|
+
/**
|
|
3
|
+
* Sort package.json
|
|
4
|
+
*
|
|
5
|
+
* Requires `jsonc` config
|
|
6
|
+
*/
|
|
7
|
+
function sortPackageJson() {
|
|
8
|
+
return [{
|
|
9
|
+
files: ["**/package.json"],
|
|
10
|
+
name: "eienjs/sort/package-json",
|
|
11
|
+
rules: {
|
|
12
|
+
"jsonc/sort-array-values": ["error", {
|
|
13
|
+
order: { type: "asc" },
|
|
14
|
+
pathPattern: "^files$"
|
|
15
|
+
}],
|
|
16
|
+
"jsonc/sort-keys": [
|
|
17
|
+
"error",
|
|
18
|
+
{
|
|
19
|
+
order: [
|
|
20
|
+
"publisher",
|
|
21
|
+
"name",
|
|
22
|
+
"displayName",
|
|
23
|
+
"type",
|
|
24
|
+
"version",
|
|
25
|
+
"private",
|
|
26
|
+
"packageManager",
|
|
27
|
+
"description",
|
|
28
|
+
"author",
|
|
29
|
+
"contributors",
|
|
30
|
+
"license",
|
|
31
|
+
"funding",
|
|
32
|
+
"homepage",
|
|
33
|
+
"repository",
|
|
34
|
+
"bugs",
|
|
35
|
+
"keywords",
|
|
36
|
+
"categories",
|
|
37
|
+
"sideEffects",
|
|
38
|
+
"imports",
|
|
39
|
+
"exports",
|
|
40
|
+
"main",
|
|
41
|
+
"module",
|
|
42
|
+
"unpkg",
|
|
43
|
+
"jsdelivr",
|
|
44
|
+
"types",
|
|
45
|
+
"typesVersions",
|
|
46
|
+
"bin",
|
|
47
|
+
"icon",
|
|
48
|
+
"files",
|
|
49
|
+
"engines",
|
|
50
|
+
"activationEvents",
|
|
51
|
+
"contributes",
|
|
52
|
+
"scripts",
|
|
53
|
+
"peerDependencies",
|
|
54
|
+
"peerDependenciesMeta",
|
|
55
|
+
"dependencies",
|
|
56
|
+
"optionalDependencies",
|
|
57
|
+
"devDependencies",
|
|
58
|
+
"pnpm",
|
|
59
|
+
"overrides",
|
|
60
|
+
"resolutions",
|
|
61
|
+
"husky",
|
|
62
|
+
"simple-git-hooks",
|
|
63
|
+
"lint-staged",
|
|
64
|
+
"eslintConfig",
|
|
65
|
+
"commitlint",
|
|
66
|
+
"publishConfig",
|
|
67
|
+
"auto-changelog",
|
|
68
|
+
"np"
|
|
69
|
+
],
|
|
70
|
+
pathPattern: "^$"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
order: { type: "asc" },
|
|
74
|
+
pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
order: { type: "asc" },
|
|
78
|
+
pathPattern: "^(?:resolutions|overrides|pnpm.overrides)$"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
order: { type: "asc" },
|
|
82
|
+
pathPattern: String.raw`^workspaces\.catalog$`
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
order: { type: "asc" },
|
|
86
|
+
pathPattern: String.raw`^workspaces\.catalogs\.[^.]+$`
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
order: [
|
|
90
|
+
"types",
|
|
91
|
+
"import",
|
|
92
|
+
"require",
|
|
93
|
+
"default"
|
|
94
|
+
],
|
|
95
|
+
pathPattern: "^exports.*$"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
order: [
|
|
99
|
+
"pre-commit",
|
|
100
|
+
"prepare-commit-msg",
|
|
101
|
+
"commit-msg",
|
|
102
|
+
"post-commit",
|
|
103
|
+
"pre-rebase",
|
|
104
|
+
"post-rewrite",
|
|
105
|
+
"post-checkout",
|
|
106
|
+
"post-merge",
|
|
107
|
+
"pre-push",
|
|
108
|
+
"pre-auto-gc"
|
|
109
|
+
],
|
|
110
|
+
pathPattern: "^(?:gitHooks|husky|simple-git-hooks)$"
|
|
111
|
+
}
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
}];
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Sort tsconfig.json
|
|
118
|
+
*
|
|
119
|
+
* Requires `jsonc` config
|
|
120
|
+
*/
|
|
121
|
+
function sortTsconfig() {
|
|
122
|
+
return [{
|
|
123
|
+
files: ["**/[jt]sconfig.json", "**/[jt]sconfig.*.json"],
|
|
124
|
+
name: "eienjs/sort/tsconfig-json",
|
|
125
|
+
rules: { "jsonc/sort-keys": [
|
|
126
|
+
"error",
|
|
127
|
+
{
|
|
128
|
+
order: [
|
|
129
|
+
"extends",
|
|
130
|
+
"compilerOptions",
|
|
131
|
+
"references",
|
|
132
|
+
"files",
|
|
133
|
+
"include",
|
|
134
|
+
"exclude"
|
|
135
|
+
],
|
|
136
|
+
pathPattern: "^$"
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
order: [
|
|
140
|
+
"incremental",
|
|
141
|
+
"composite",
|
|
142
|
+
"tsBuildInfoFile",
|
|
143
|
+
"disableSourceOfProjectReferenceRedirect",
|
|
144
|
+
"disableSolutionSearching",
|
|
145
|
+
"disableReferencedProjectLoad",
|
|
146
|
+
"target",
|
|
147
|
+
"jsx",
|
|
148
|
+
"jsxFactory",
|
|
149
|
+
"jsxFragmentFactory",
|
|
150
|
+
"jsxImportSource",
|
|
151
|
+
"lib",
|
|
152
|
+
"moduleDetection",
|
|
153
|
+
"noLib",
|
|
154
|
+
"reactNamespace",
|
|
155
|
+
"useDefineForClassFields",
|
|
156
|
+
"emitDecoratorMetadata",
|
|
157
|
+
"experimentalDecorators",
|
|
158
|
+
"libReplacement",
|
|
159
|
+
"baseUrl",
|
|
160
|
+
"rootDir",
|
|
161
|
+
"rootDirs",
|
|
162
|
+
"customConditions",
|
|
163
|
+
"module",
|
|
164
|
+
"moduleResolution",
|
|
165
|
+
"moduleSuffixes",
|
|
166
|
+
"noResolve",
|
|
167
|
+
"paths",
|
|
168
|
+
"resolveJsonModule",
|
|
169
|
+
"resolvePackageJsonExports",
|
|
170
|
+
"resolvePackageJsonImports",
|
|
171
|
+
"typeRoots",
|
|
172
|
+
"types",
|
|
173
|
+
"allowArbitraryExtensions",
|
|
174
|
+
"allowImportingTsExtensions",
|
|
175
|
+
"allowUmdGlobalAccess",
|
|
176
|
+
"allowJs",
|
|
177
|
+
"checkJs",
|
|
178
|
+
"maxNodeModuleJsDepth",
|
|
179
|
+
"strict",
|
|
180
|
+
"strictBindCallApply",
|
|
181
|
+
"strictFunctionTypes",
|
|
182
|
+
"strictNullChecks",
|
|
183
|
+
"strictPropertyInitialization",
|
|
184
|
+
"allowUnreachableCode",
|
|
185
|
+
"allowUnusedLabels",
|
|
186
|
+
"alwaysStrict",
|
|
187
|
+
"exactOptionalPropertyTypes",
|
|
188
|
+
"noFallthroughCasesInSwitch",
|
|
189
|
+
"noImplicitAny",
|
|
190
|
+
"noImplicitOverride",
|
|
191
|
+
"noImplicitReturns",
|
|
192
|
+
"noImplicitThis",
|
|
193
|
+
"noPropertyAccessFromIndexSignature",
|
|
194
|
+
"noUncheckedIndexedAccess",
|
|
195
|
+
"noUnusedLocals",
|
|
196
|
+
"noUnusedParameters",
|
|
197
|
+
"useUnknownInCatchVariables",
|
|
198
|
+
"declaration",
|
|
199
|
+
"declarationDir",
|
|
200
|
+
"declarationMap",
|
|
201
|
+
"downlevelIteration",
|
|
202
|
+
"emitBOM",
|
|
203
|
+
"emitDeclarationOnly",
|
|
204
|
+
"importHelpers",
|
|
205
|
+
"importsNotUsedAsValues",
|
|
206
|
+
"inlineSourceMap",
|
|
207
|
+
"inlineSources",
|
|
208
|
+
"mapRoot",
|
|
209
|
+
"newLine",
|
|
210
|
+
"noEmit",
|
|
211
|
+
"noEmitHelpers",
|
|
212
|
+
"noEmitOnError",
|
|
213
|
+
"outDir",
|
|
214
|
+
"outFile",
|
|
215
|
+
"preserveConstEnums",
|
|
216
|
+
"preserveValueImports",
|
|
217
|
+
"removeComments",
|
|
218
|
+
"sourceMap",
|
|
219
|
+
"sourceRoot",
|
|
220
|
+
"stripInternal",
|
|
221
|
+
"allowSyntheticDefaultImports",
|
|
222
|
+
"esModuleInterop",
|
|
223
|
+
"forceConsistentCasingInFileNames",
|
|
224
|
+
"isolatedDeclarations",
|
|
225
|
+
"isolatedModules",
|
|
226
|
+
"preserveSymlinks",
|
|
227
|
+
"verbatimModuleSyntax",
|
|
228
|
+
"erasableSyntaxOnly",
|
|
229
|
+
"skipDefaultLibCheck",
|
|
230
|
+
"skipLibCheck"
|
|
231
|
+
],
|
|
232
|
+
pathPattern: "^compilerOptions$"
|
|
233
|
+
}
|
|
234
|
+
] }
|
|
235
|
+
}];
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
//#endregion
|
|
239
|
+
export { sortPackageJson, sortTsconfig };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { OptionsOverrides, StylisticConfig, TypedFlatConfigItem } from "../types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/configs/stylistic.d.ts
|
|
4
|
+
declare const StylisticConfigDefaults: StylisticConfig;
|
|
5
|
+
interface StylisticOptions extends StylisticConfig, OptionsOverrides {}
|
|
6
|
+
declare function stylistic(options?: StylisticOptions): Promise<TypedFlatConfigItem[]>;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { StylisticConfigDefaults, StylisticOptions, stylistic };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { interopDefault } from "../utils.js";
|
|
2
|
+
import { pluginAntfu } from "../plugins.js";
|
|
3
|
+
|
|
4
|
+
//#region src/configs/stylistic.ts
|
|
5
|
+
const StylisticConfigDefaults = {
|
|
6
|
+
indent: 2,
|
|
7
|
+
quotes: "single"
|
|
8
|
+
};
|
|
9
|
+
async function stylistic(options = {}) {
|
|
10
|
+
const { indent, overrides = {}, quotes, maxLineLength = 120 } = {
|
|
11
|
+
...StylisticConfigDefaults,
|
|
12
|
+
...options
|
|
13
|
+
};
|
|
14
|
+
const pluginStylistic = await interopDefault(import("@stylistic/eslint-plugin"));
|
|
15
|
+
const config = pluginStylistic.configs.customize({
|
|
16
|
+
indent,
|
|
17
|
+
quotes,
|
|
18
|
+
semi: true
|
|
19
|
+
});
|
|
20
|
+
return [{
|
|
21
|
+
name: "eienjs/stylistic/rules",
|
|
22
|
+
plugins: {
|
|
23
|
+
"antfu": pluginAntfu,
|
|
24
|
+
"@stylistic": pluginStylistic
|
|
25
|
+
},
|
|
26
|
+
rules: {
|
|
27
|
+
...config.rules,
|
|
28
|
+
"antfu/consistent-chaining": "error",
|
|
29
|
+
"antfu/consistent-list-newline": "error",
|
|
30
|
+
"@stylistic/arrow-parens": ["error", "always"],
|
|
31
|
+
"@stylistic/brace-style": [
|
|
32
|
+
"error",
|
|
33
|
+
"1tbs",
|
|
34
|
+
{ allowSingleLine: true }
|
|
35
|
+
],
|
|
36
|
+
"@stylistic/max-len": ["warn", {
|
|
37
|
+
code: maxLineLength,
|
|
38
|
+
ignoreComments: true
|
|
39
|
+
}],
|
|
40
|
+
"@stylistic/padding-line-between-statements": [
|
|
41
|
+
"error",
|
|
42
|
+
{
|
|
43
|
+
blankLine: "always",
|
|
44
|
+
prev: "*",
|
|
45
|
+
next: ["interface", "type"]
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
blankLine: "always",
|
|
49
|
+
next: "return",
|
|
50
|
+
prev: "*"
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
"@stylistic/lines-between-class-members": ["error", "always"],
|
|
54
|
+
"@stylistic/generator-star-spacing": ["error", {
|
|
55
|
+
after: true,
|
|
56
|
+
before: false
|
|
57
|
+
}],
|
|
58
|
+
"@stylistic/quote-props": ["error", "consistent"],
|
|
59
|
+
"@stylistic/quotes": [
|
|
60
|
+
"error",
|
|
61
|
+
quotes,
|
|
62
|
+
{ avoidEscape: true }
|
|
63
|
+
],
|
|
64
|
+
"@stylistic/semi": "error",
|
|
65
|
+
"@stylistic/comma-spacing": "error",
|
|
66
|
+
"@stylistic/yield-star-spacing": ["error", {
|
|
67
|
+
after: true,
|
|
68
|
+
before: false
|
|
69
|
+
}],
|
|
70
|
+
...overrides
|
|
71
|
+
}
|
|
72
|
+
}];
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
//#endregion
|
|
76
|
+
export { StylisticConfigDefaults, stylistic };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { OptionsFiles, OptionsIsInEditor, OptionsOverrides, TypedFlatConfigItem } from "../types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/configs/test.d.ts
|
|
4
|
+
declare function test(options?: OptionsFiles & OptionsIsInEditor & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { test };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { GLOB_TESTS } from "../globs.js";
|
|
2
|
+
import { interopDefault } from "../utils.js";
|
|
3
|
+
|
|
4
|
+
//#region src/configs/test.ts
|
|
5
|
+
let _pluginTest;
|
|
6
|
+
async function test(options = {}) {
|
|
7
|
+
const { files = GLOB_TESTS, isInEditor = false, overrides = {} } = options;
|
|
8
|
+
const [pluginVitest, pluginNoOnlyTests] = await Promise.all([interopDefault(import("@vitest/eslint-plugin")), interopDefault(import("eslint-plugin-no-only-tests"))]);
|
|
9
|
+
_pluginTest = _pluginTest || {
|
|
10
|
+
...pluginVitest,
|
|
11
|
+
rules: {
|
|
12
|
+
...pluginVitest.rules,
|
|
13
|
+
...pluginNoOnlyTests.rules
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
return [{
|
|
17
|
+
name: "eienjs/test/setup",
|
|
18
|
+
plugins: { test: _pluginTest }
|
|
19
|
+
}, {
|
|
20
|
+
files,
|
|
21
|
+
name: "eienjs/test/rules",
|
|
22
|
+
rules: {
|
|
23
|
+
"test/consistent-test-it": ["error", {
|
|
24
|
+
fn: "test",
|
|
25
|
+
withinDescribe: "test"
|
|
26
|
+
}],
|
|
27
|
+
"test/no-identical-title": "error",
|
|
28
|
+
"test/no-import-node-test": "error",
|
|
29
|
+
"test/no-only-tests": isInEditor ? "warn" : "error",
|
|
30
|
+
"test/prefer-hooks-in-order": "error",
|
|
31
|
+
"test/prefer-lowercase-title": "error",
|
|
32
|
+
"antfu/no-top-level-await": "off",
|
|
33
|
+
"no-unused-expressions": "off",
|
|
34
|
+
"n/prefer-global/process": "off",
|
|
35
|
+
"@typescript-eslint/explicit-function-return-type": "off",
|
|
36
|
+
...overrides
|
|
37
|
+
}
|
|
38
|
+
}];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
export { test };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { OptionsFiles, OptionsOverrides, OptionsStylistic, TypedFlatConfigItem } from "../types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/configs/toml.d.ts
|
|
4
|
+
declare function toml(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<TypedFlatConfigItem[]>;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { toml };
|