@eienjs/eslint-config 1.9.3 → 1.11.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 +0 -0
- package/dist/cli/{constants.mjs → constants.js} +1 -3
- package/dist/cli/{constants_generated.mjs → constants_generated.js} +4 -5
- package/dist/cli/{index.mjs → index.js} +3 -5
- package/dist/cli/{run.mjs → run.js} +6 -8
- package/dist/cli/stages/{update_eslint_files.mjs → update_eslint_files.js} +8 -9
- package/dist/cli/stages/{update_package_json.mjs → update_package_json.js} +7 -9
- package/dist/cli/stages/{update_vscode_settings.mjs → update_vscode_settings.js} +9 -10
- package/dist/cli/{utils.mjs → utils.js} +1 -3
- package/dist/{config_presets.d.mts → config_presets.d.ts} +1 -1
- package/dist/{config_presets.mjs → config_presets.js} +1 -2
- package/dist/configs/{adonisjs.d.mts → adonisjs.d.ts} +1 -1
- package/dist/configs/{adonisjs.mjs → adonisjs.js} +3 -5
- package/dist/configs/{astro.d.mts → astro.d.ts} +1 -1
- package/dist/configs/{astro.mjs → astro.js} +3 -5
- package/dist/configs/{command.d.mts → command.d.ts} +1 -1
- package/dist/configs/{command.mjs → command.js} +1 -3
- package/dist/configs/{comments.d.mts → comments.d.ts} +1 -1
- package/dist/configs/{comments.mjs → comments.js} +2 -4
- package/dist/configs/{disables.d.mts → disables.d.ts} +1 -1
- package/dist/configs/{disables.mjs → disables.js} +2 -4
- package/dist/configs/e18e.d.ts +6 -0
- package/dist/configs/e18e.js +20 -0
- package/dist/configs/{formatters.d.mts → formatters.d.ts} +1 -1
- package/dist/configs/{formatters.mjs → formatters.js} +4 -6
- package/dist/configs/{ignores.d.mts → ignores.d.ts} +1 -1
- package/dist/configs/{ignores.mjs → ignores.js} +2 -4
- package/dist/configs/{imports.d.mts → imports.d.ts} +1 -1
- package/dist/configs/{imports.mjs → imports.js} +2 -4
- package/dist/configs/index.d.ts +27 -0
- package/dist/configs/index.js +27 -0
- package/dist/configs/{javascript.d.mts → javascript.d.ts} +1 -1
- package/dist/configs/{javascript.mjs → javascript.js} +2 -5
- package/dist/configs/{jsdoc.d.mts → jsdoc.d.ts} +1 -1
- package/dist/configs/{jsdoc.mjs → jsdoc.js} +6 -6
- package/dist/configs/{jsonc.d.mts → jsonc.d.ts} +1 -1
- package/dist/configs/{jsonc.mjs → jsonc.js} +5 -8
- package/dist/configs/markdown.d.ts +6 -0
- package/dist/configs/{markdown.mjs → markdown.js} +31 -8
- package/dist/configs/{node.d.mts → node.d.ts} +1 -1
- package/dist/configs/{node.mjs → node.js} +6 -6
- package/dist/configs/{nuxt.d.mts → nuxt.d.ts} +1 -1
- package/dist/configs/{nuxt.mjs → nuxt.js} +3 -5
- package/dist/configs/{perfectionist.d.mts → perfectionist.d.ts} +1 -1
- package/dist/configs/{perfectionist.mjs → perfectionist.js} +2 -4
- package/dist/configs/{pnpm.d.mts → pnpm.d.ts} +1 -1
- package/dist/configs/{pnpm.mjs → pnpm.js} +6 -9
- package/dist/configs/{regexp.d.mts → regexp.d.ts} +1 -1
- package/dist/configs/{regexp.mjs → regexp.js} +1 -3
- package/dist/configs/{sort.d.mts → sort.d.ts} +1 -1
- package/dist/configs/{sort.mjs → sort.js} +1 -2
- package/dist/configs/{stylistic.d.mts → stylistic.d.ts} +1 -1
- package/dist/configs/{stylistic.mjs → stylistic.js} +3 -5
- package/dist/configs/{test.d.mts → test.d.ts} +1 -1
- package/dist/configs/{test.mjs → test.js} +3 -5
- package/dist/configs/{toml.d.mts → toml.d.ts} +1 -1
- package/dist/configs/{toml.mjs → toml.js} +3 -5
- package/dist/configs/{typescript.d.mts → typescript.d.ts} +1 -1
- package/dist/configs/{typescript.mjs → typescript.js} +11 -13
- package/dist/configs/{unicorn.d.mts → unicorn.d.ts} +1 -1
- package/dist/configs/{unicorn.mjs → unicorn.js} +3 -5
- package/dist/configs/{vue.d.mts → vue.d.ts} +1 -1
- package/dist/configs/{vue.mjs → vue.js} +3 -5
- package/dist/configs/{yaml.d.mts → yaml.d.ts} +1 -1
- package/dist/configs/{yaml.mjs → yaml.js} +3 -5
- package/dist/{factory.d.mts → factory.d.ts} +2 -2
- package/dist/{factory.mjs → factory.js} +35 -32
- package/dist/{globs.mjs → globs.js} +1 -2
- package/dist/{index.d.mts → index.d.ts} +7 -7
- package/dist/{index.mjs → index.js} +5 -7
- package/dist/node_modules/.pnpm/find-up-simple@1.0.1/node_modules/find-up-simple/{index.mjs → index.js} +3 -5
- package/dist/package.js +4 -0
- package/dist/{plugins.mjs → plugins.js} +2 -2
- package/dist/{typegen.d.mts → typegen.d.ts} +159 -30
- package/dist/{types.d.mts → types.d.ts} +46 -5
- package/dist/{utils.d.mts → utils.d.ts} +1 -1
- package/dist/{utils.mjs → utils.js} +2 -4
- package/package.json +40 -36
- package/dist/configs/index.d.mts +0 -26
- package/dist/configs/index.mjs +0 -27
- package/dist/configs/markdown.d.mts +0 -6
- package/dist/package.mjs +0 -5
- /package/dist/cli/{index.d.mts → index.d.ts} +0 -0
- /package/dist/{globs.d.mts → globs.d.ts} +0 -0
- /package/dist/vendored/{prettier_types.d.mts → prettier_types.d.ts} +0 -0
package/bin/index.mjs
CHANGED
|
File without changes
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import c from "ansis";
|
|
2
|
-
|
|
3
2
|
//#region src/cli/constants.ts
|
|
4
3
|
const vscodeSettingsString = `
|
|
5
4
|
// Disable the default formatter, use eslint instead
|
|
@@ -69,6 +68,5 @@ const dependenciesMap = {
|
|
|
69
68
|
nuxt: ["@nuxt/eslint-plugin"],
|
|
70
69
|
vue: []
|
|
71
70
|
};
|
|
72
|
-
|
|
73
71
|
//#endregion
|
|
74
|
-
export { dependenciesMap, extra, extraOptions, frameworkOptions, frameworks, vscodeSettingsString };
|
|
72
|
+
export { dependenciesMap, extra, extraOptions, frameworkOptions, frameworks, vscodeSettingsString };
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
//#region src/cli/constants_generated.ts
|
|
2
2
|
const versionsMap = {
|
|
3
3
|
"@adonisjs/eslint-plugin": "^2.2.2",
|
|
4
|
-
"@nuxt/eslint-plugin": "^1.15.
|
|
4
|
+
"@nuxt/eslint-plugin": "^1.15.2",
|
|
5
5
|
"astro-eslint-parser": "^1.3.0",
|
|
6
|
-
"eslint": "^
|
|
6
|
+
"eslint": "^10.0.3",
|
|
7
7
|
"eslint-plugin-astro": "^1.6.0",
|
|
8
|
-
"eslint-plugin-format": "^
|
|
8
|
+
"eslint-plugin-format": "^2.0.1",
|
|
9
9
|
"prettier-plugin-astro": "^0.14.1"
|
|
10
10
|
};
|
|
11
|
-
|
|
12
11
|
//#endregion
|
|
13
|
-
export { versionsMap };
|
|
12
|
+
export { versionsMap };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { version } from "../package.
|
|
2
|
-
import { run } from "./run.
|
|
1
|
+
import { version } from "../package.js";
|
|
2
|
+
import { run } from "./run.js";
|
|
3
3
|
import process from "node:process";
|
|
4
4
|
import * as p from "@clack/prompts";
|
|
5
5
|
import c from "ansis";
|
|
6
6
|
import { cac } from "cac";
|
|
7
|
-
|
|
8
7
|
//#region src/cli/index.ts
|
|
9
8
|
function header() {
|
|
10
9
|
console.log("\n");
|
|
@@ -24,6 +23,5 @@ cli.command("", "Run the initialization or migration").option("--yes, -y", "Skip
|
|
|
24
23
|
cli.help();
|
|
25
24
|
cli.version(version);
|
|
26
25
|
cli.parse();
|
|
27
|
-
|
|
28
26
|
//#endregion
|
|
29
|
-
export {
|
|
27
|
+
export {};
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { extra, extraOptions, frameworkOptions, frameworks } from "./constants.
|
|
2
|
-
import { isGitClean } from "./utils.
|
|
3
|
-
import { updateEslintFiles } from "./stages/update_eslint_files.
|
|
4
|
-
import { updatePackageJson } from "./stages/update_package_json.
|
|
5
|
-
import { updateVscodeSettings } from "./stages/update_vscode_settings.
|
|
1
|
+
import { extra, extraOptions, frameworkOptions, frameworks } from "./constants.js";
|
|
2
|
+
import { isGitClean } from "./utils.js";
|
|
3
|
+
import { updateEslintFiles } from "./stages/update_eslint_files.js";
|
|
4
|
+
import { updatePackageJson } from "./stages/update_package_json.js";
|
|
5
|
+
import { updateVscodeSettings } from "./stages/update_vscode_settings.js";
|
|
6
6
|
import process from "node:process";
|
|
7
7
|
import fs from "node:fs";
|
|
8
8
|
import path from "node:path";
|
|
9
9
|
import * as p from "@clack/prompts";
|
|
10
10
|
import c from "ansis";
|
|
11
|
-
|
|
12
11
|
//#region src/cli/run.ts
|
|
13
12
|
async function run(options = {}) {
|
|
14
13
|
const argSkipPrompt = Boolean(process.env.SKIP_PROMPT) || options.yes;
|
|
@@ -72,6 +71,5 @@ async function run(options = {}) {
|
|
|
72
71
|
p.log.success(c.green`Setup completed`);
|
|
73
72
|
p.outro(`Now you can update the dependencies by run ${c.blue("pnpm install")} and run ${c.blue("eslint --fix")}\n`);
|
|
74
73
|
}
|
|
75
|
-
|
|
76
74
|
//#endregion
|
|
77
|
-
export { run };
|
|
75
|
+
export { run };
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { getEslintConfigContent } from "../utils.
|
|
1
|
+
import { getEslintConfigContent } from "../utils.js";
|
|
2
2
|
import process from "node:process";
|
|
3
|
-
import
|
|
3
|
+
import fsp from "node:fs/promises";
|
|
4
4
|
import fs from "node:fs";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import * as p from "@clack/prompts";
|
|
7
7
|
import c from "ansis";
|
|
8
8
|
import parse from "parse-gitignore";
|
|
9
|
-
|
|
10
9
|
//#region src/cli/stages/update_eslint_files.ts
|
|
10
|
+
const ESLINT_OR_PRETTIER = /eslint|prettier/;
|
|
11
11
|
async function updateEslintFiles(result) {
|
|
12
12
|
const cwd = process.cwd();
|
|
13
13
|
const pathESLintIgnore = path.join(cwd, ".eslintignore");
|
|
14
14
|
const pathPackageJSON = path.join(cwd, "package.json");
|
|
15
|
-
const pkgContent = await
|
|
15
|
+
const pkgContent = await fsp.readFile(pathPackageJSON, "utf8");
|
|
16
16
|
const configFileName = JSON.parse(pkgContent).type === "module" ? "eslint.config.js" : "eslint.config.mjs";
|
|
17
17
|
const pathFlatConfig = path.join(cwd, configFileName);
|
|
18
18
|
const eslintIgnores = [];
|
|
19
19
|
if (fs.existsSync(pathESLintIgnore)) {
|
|
20
20
|
p.log.step(c.cyan`Migrating existing .eslintignore`);
|
|
21
|
-
const globs = parse(await
|
|
21
|
+
const globs = parse(await fsp.readFile(pathESLintIgnore, "utf8")).globs();
|
|
22
22
|
for (const glob of globs) if (glob.type === "ignore") eslintIgnores.push(...glob.patterns);
|
|
23
23
|
else if (glob.type === "unignore") eslintIgnores.push(...glob.patterns.map((pattern) => `!${pattern}`));
|
|
24
24
|
}
|
|
@@ -27,13 +27,12 @@ async function updateEslintFiles(result) {
|
|
|
27
27
|
if (result.extra.includes("formatter")) configLines.push("formatters: true,");
|
|
28
28
|
for (const framework of result.frameworks) configLines.push(`${framework}: true,`);
|
|
29
29
|
const eslintConfigContent = getEslintConfigContent(configLines.map((i) => ` ${i}`).join("\n"));
|
|
30
|
-
await
|
|
30
|
+
await fsp.writeFile(pathFlatConfig, eslintConfigContent);
|
|
31
31
|
p.log.success(c.green`Created ${configFileName}`);
|
|
32
32
|
const files = fs.readdirSync(cwd);
|
|
33
33
|
const legacyConfig = [];
|
|
34
|
-
for (const file of files) if (
|
|
34
|
+
for (const file of files) if (ESLINT_OR_PRETTIER.test(file) && !file.includes("eslint.config.")) legacyConfig.push(file);
|
|
35
35
|
if (legacyConfig.length > 0) p.note(c.dim(legacyConfig.join(", ")), "You can now remove those files manually");
|
|
36
36
|
}
|
|
37
|
-
|
|
38
37
|
//#endregion
|
|
39
|
-
export { updateEslintFiles };
|
|
38
|
+
export { updateEslintFiles };
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import { version } from "../../package.
|
|
2
|
-
import { dependenciesMap } from "../constants.
|
|
3
|
-
import { versionsMap } from "../constants_generated.
|
|
1
|
+
import { version } from "../../package.js";
|
|
2
|
+
import { dependenciesMap } from "../constants.js";
|
|
3
|
+
import { versionsMap } from "../constants_generated.js";
|
|
4
4
|
import process from "node:process";
|
|
5
|
-
import
|
|
5
|
+
import fsp from "node:fs/promises";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import * as p from "@clack/prompts";
|
|
8
8
|
import c from "ansis";
|
|
9
|
-
|
|
10
9
|
//#region src/cli/stages/update_package_json.ts
|
|
11
10
|
async function updatePackageJson(result) {
|
|
12
11
|
const cwd = process.cwd();
|
|
13
12
|
const pathPackageJSON = path.join(cwd, "package.json");
|
|
14
13
|
p.log.step(c.cyan`Bumping @eienjs/eslint-config to v${version}`);
|
|
15
|
-
const pkgContent = await
|
|
14
|
+
const pkgContent = await fsp.readFile(pathPackageJSON, "utf8");
|
|
16
15
|
const pkg = JSON.parse(pkgContent);
|
|
17
16
|
pkg.devDependencies = pkg.devDependencies ?? {};
|
|
18
17
|
pkg.devDependencies["@eienjs/eslint-config"] = `^${version}`;
|
|
@@ -38,9 +37,8 @@ async function updatePackageJson(result) {
|
|
|
38
37
|
}
|
|
39
38
|
}
|
|
40
39
|
if (addedPackages.length > 0) p.note(c.dim(addedPackages.join(", ")), "Added packages");
|
|
41
|
-
await
|
|
40
|
+
await fsp.writeFile(pathPackageJSON, JSON.stringify(pkg, null, 2));
|
|
42
41
|
p.log.success(c.green`Changes wrote to package.json`);
|
|
43
42
|
}
|
|
44
|
-
|
|
45
43
|
//#endregion
|
|
46
|
-
export { updatePackageJson };
|
|
44
|
+
export { updatePackageJson };
|
|
@@ -1,30 +1,29 @@
|
|
|
1
|
-
import { vscodeSettingsString } from "../constants.
|
|
1
|
+
import { vscodeSettingsString } from "../constants.js";
|
|
2
2
|
import process from "node:process";
|
|
3
|
-
import
|
|
3
|
+
import fsp from "node:fs/promises";
|
|
4
4
|
import fs from "node:fs";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import * as p from "@clack/prompts";
|
|
7
7
|
import { green } from "ansis";
|
|
8
|
-
|
|
9
8
|
//#region src/cli/stages/update_vscode_settings.ts
|
|
9
|
+
const LAST_LINE_PATTERN = /\s*\}$/;
|
|
10
10
|
async function updateVscodeSettings(result) {
|
|
11
11
|
const cwd = process.cwd();
|
|
12
12
|
if (!result.updateVscodeSettings) return;
|
|
13
13
|
const dotVscodePath = path.join(cwd, ".vscode");
|
|
14
14
|
const settingsPath = path.join(dotVscodePath, "settings.json");
|
|
15
|
-
if (!fs.existsSync(dotVscodePath)) await
|
|
15
|
+
if (!fs.existsSync(dotVscodePath)) await fsp.mkdir(dotVscodePath, { recursive: true });
|
|
16
16
|
if (fs.existsSync(settingsPath)) {
|
|
17
|
-
let settingsContent = await
|
|
18
|
-
settingsContent = settingsContent.trim().replace(
|
|
17
|
+
let settingsContent = await fsp.readFile(settingsPath, "utf8");
|
|
18
|
+
settingsContent = settingsContent.trim().replace(LAST_LINE_PATTERN, "");
|
|
19
19
|
settingsContent += settingsContent.endsWith(",") || settingsContent.endsWith("{") ? "" : ",";
|
|
20
20
|
settingsContent += `${vscodeSettingsString}}\n`;
|
|
21
|
-
await
|
|
21
|
+
await fsp.writeFile(settingsPath, settingsContent, "utf8");
|
|
22
22
|
p.log.success(green`Updated .vscode/settings.json`);
|
|
23
23
|
} else {
|
|
24
|
-
await
|
|
24
|
+
await fsp.writeFile(settingsPath, `{${vscodeSettingsString}}\n`, "utf8");
|
|
25
25
|
p.log.success(green`Created .vscode/settings.json`);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
|
|
29
28
|
//#endregion
|
|
30
|
-
export { updateVscodeSettings };
|
|
29
|
+
export { updateVscodeSettings };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { execSync } from "node:child_process";
|
|
2
|
-
|
|
3
2
|
//#region src/cli/utils.ts
|
|
4
3
|
function isGitClean() {
|
|
5
4
|
try {
|
|
@@ -18,6 +17,5 @@ ${mainConfig}
|
|
|
18
17
|
});
|
|
19
18
|
`.trimStart();
|
|
20
19
|
}
|
|
21
|
-
|
|
22
20
|
//#endregion
|
|
23
|
-
export { getEslintConfigContent, isGitClean };
|
|
21
|
+
export { getEslintConfigContent, isGitClean };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { GLOB_SRC_EXT } from "../globs.
|
|
2
|
-
import { ensurePackages, interopDefault } from "../utils.
|
|
1
|
+
import { GLOB_SRC_EXT } from "../globs.js";
|
|
2
|
+
import { ensurePackages, interopDefault } from "../utils.js";
|
|
3
3
|
import { join } from "pathe";
|
|
4
|
-
|
|
5
4
|
//#region src/configs/adonisjs.ts
|
|
6
5
|
async function adonisjs(options = {}) {
|
|
7
6
|
const { dirs = {}, overrides = {} } = options;
|
|
@@ -147,6 +146,5 @@ async function adonisjs(options = {}) {
|
|
|
147
146
|
}
|
|
148
147
|
];
|
|
149
148
|
}
|
|
150
|
-
|
|
151
149
|
//#endregion
|
|
152
|
-
export { adonisjs };
|
|
150
|
+
export { adonisjs };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OptionsFiles, OptionsOverrides, OptionsStylistic, TypedFlatConfigItem } from "../types.
|
|
1
|
+
import { OptionsFiles, OptionsOverrides, OptionsStylistic, TypedFlatConfigItem } from "../types.js";
|
|
2
2
|
|
|
3
3
|
//#region src/configs/astro.d.ts
|
|
4
4
|
declare function astro(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<TypedFlatConfigItem[]>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { GLOB_ASTRO } from "../globs.
|
|
2
|
-
import { interopDefault } from "../utils.
|
|
3
|
-
|
|
1
|
+
import { GLOB_ASTRO } from "../globs.js";
|
|
2
|
+
import { interopDefault } from "../utils.js";
|
|
4
3
|
//#region src/configs/astro.ts
|
|
5
4
|
async function astro(options = {}) {
|
|
6
5
|
const { files = [GLOB_ASTRO], overrides = {}, stylistic = true } = options;
|
|
@@ -47,6 +46,5 @@ async function astro(options = {}) {
|
|
|
47
46
|
}
|
|
48
47
|
}];
|
|
49
48
|
}
|
|
50
|
-
|
|
51
49
|
//#endregion
|
|
52
|
-
export { astro };
|
|
50
|
+
export { astro };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import createCommand from "eslint-plugin-command/config";
|
|
2
|
-
|
|
3
2
|
//#region src/configs/command.ts
|
|
4
3
|
function command() {
|
|
5
4
|
return [{
|
|
@@ -7,6 +6,5 @@ function command() {
|
|
|
7
6
|
name: "eienjs/command/rules"
|
|
8
7
|
}];
|
|
9
8
|
}
|
|
10
|
-
|
|
11
9
|
//#endregion
|
|
12
|
-
export { command };
|
|
10
|
+
export { command };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { pluginComments } from "../plugins.
|
|
2
|
-
|
|
1
|
+
import { pluginComments } from "../plugins.js";
|
|
3
2
|
//#region src/configs/comments.ts
|
|
4
3
|
function comments() {
|
|
5
4
|
return [{
|
|
@@ -14,6 +13,5 @@ function comments() {
|
|
|
14
13
|
}
|
|
15
14
|
}];
|
|
16
15
|
}
|
|
17
|
-
|
|
18
16
|
//#endregion
|
|
19
|
-
export { comments };
|
|
17
|
+
export { comments };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { GLOB_ASTRO, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_SRC, GLOB_SRC_EXT, GLOB_TOML, GLOB_YAML } from "../globs.
|
|
2
|
-
|
|
1
|
+
import { GLOB_ASTRO, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_SRC, GLOB_SRC_EXT, GLOB_TOML, GLOB_YAML } from "../globs.js";
|
|
3
2
|
//#region src/configs/disables.ts
|
|
4
3
|
function disables() {
|
|
5
4
|
return [
|
|
@@ -89,6 +88,5 @@ function disables() {
|
|
|
89
88
|
}
|
|
90
89
|
];
|
|
91
90
|
}
|
|
92
|
-
|
|
93
91
|
//#endregion
|
|
94
|
-
export { disables };
|
|
92
|
+
export { disables };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { pluginE18e } from "../plugins.js";
|
|
2
|
+
//#region src/configs/e18e.ts
|
|
3
|
+
function e18e(options = {}) {
|
|
4
|
+
const { isInEditor = false, modernization = true, moduleReplacements = isInEditor, overrides = {}, performanceImprovements = true } = options;
|
|
5
|
+
const configs = pluginE18e.configs;
|
|
6
|
+
return [{
|
|
7
|
+
name: "eienjs/e18e/setup",
|
|
8
|
+
plugins: { e18e: pluginE18e }
|
|
9
|
+
}, {
|
|
10
|
+
name: "eienjs/e18e/rules",
|
|
11
|
+
rules: {
|
|
12
|
+
...modernization ? { ...configs.modernization.rules } : {},
|
|
13
|
+
...moduleReplacements ? { ...configs.moduleReplacements.rules } : {},
|
|
14
|
+
...performanceImprovements ? { ...configs.performanceImprovements.rules } : {},
|
|
15
|
+
...overrides
|
|
16
|
+
}
|
|
17
|
+
}];
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { e18e };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OptionsFormatters, StylisticConfig, TypedFlatConfigItem } from "../types.
|
|
1
|
+
import { OptionsFormatters, StylisticConfig, TypedFlatConfigItem } from "../types.js";
|
|
2
2
|
|
|
3
3
|
//#region src/configs/formatters.d.ts
|
|
4
4
|
declare function formatters(options?: OptionsFormatters | true, stylistic?: StylisticConfig): Promise<TypedFlatConfigItem[]>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_HTML, GLOB_LESS, GLOB_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SVG, GLOB_XML } from "../globs.
|
|
2
|
-
import { ensurePackages, interopDefault, isPackageInScope, parserPlain } from "../utils.
|
|
3
|
-
import { StylisticConfigDefaults } from "./stylistic.
|
|
4
|
-
|
|
1
|
+
import { GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_HTML, GLOB_LESS, GLOB_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SVG, GLOB_XML } from "../globs.js";
|
|
2
|
+
import { ensurePackages, interopDefault, isPackageInScope, parserPlain } from "../utils.js";
|
|
3
|
+
import { StylisticConfigDefaults } from "./stylistic.js";
|
|
5
4
|
//#region src/configs/formatters.ts
|
|
6
5
|
function mergePrettierOptions(options, overrides) {
|
|
7
6
|
return {
|
|
@@ -129,6 +128,5 @@ async function formatters(options = {}, stylistic = {}) {
|
|
|
129
128
|
});
|
|
130
129
|
return configs;
|
|
131
130
|
}
|
|
132
|
-
|
|
133
131
|
//#endregion
|
|
134
|
-
export { formatters };
|
|
132
|
+
export { formatters };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TypedFlatConfigItem } from "../types.
|
|
1
|
+
import { TypedFlatConfigItem } from "../types.js";
|
|
2
2
|
|
|
3
3
|
//#region src/configs/ignores.d.ts
|
|
4
4
|
declare function ignores(userIgnores?: string[] | ((originals: string[]) => string[]), ignoreTypescript?: boolean): TypedFlatConfigItem[];
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { GLOB_EXCLUDE, GLOB_TS, GLOB_TSX } from "../globs.
|
|
2
|
-
|
|
1
|
+
import { GLOB_EXCLUDE, GLOB_TS, GLOB_TSX } from "../globs.js";
|
|
3
2
|
//#region src/configs/ignores.ts
|
|
4
3
|
function ignores(userIgnores = [], ignoreTypescript = false) {
|
|
5
4
|
let ignores = [...GLOB_EXCLUDE];
|
|
@@ -10,6 +9,5 @@ function ignores(userIgnores = [], ignoreTypescript = false) {
|
|
|
10
9
|
name: "eienjs/ignores"
|
|
11
10
|
}];
|
|
12
11
|
}
|
|
13
|
-
|
|
14
12
|
//#endregion
|
|
15
|
-
export { ignores };
|
|
13
|
+
export { ignores };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OptionsOverrides, OptionsStylistic, TypedFlatConfigItem } from "../types.
|
|
1
|
+
import { OptionsOverrides, OptionsStylistic, TypedFlatConfigItem } from "../types.js";
|
|
2
2
|
|
|
3
3
|
//#region src/configs/imports.d.ts
|
|
4
4
|
declare function imports(options?: OptionsOverrides & OptionsStylistic): TypedFlatConfigItem[];
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { pluginAntfu, pluginImportLite } from "../plugins.
|
|
2
|
-
|
|
1
|
+
import { pluginAntfu, pluginImportLite } from "../plugins.js";
|
|
3
2
|
//#region src/configs/imports.ts
|
|
4
3
|
function imports(options = {}) {
|
|
5
4
|
const { overrides = {}, stylistic = true } = options;
|
|
@@ -23,6 +22,5 @@ function imports(options = {}) {
|
|
|
23
22
|
}
|
|
24
23
|
}];
|
|
25
24
|
}
|
|
26
|
-
|
|
27
25
|
//#endregion
|
|
28
|
-
export { imports };
|
|
26
|
+
export { imports };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { adonisjs } from "./adonisjs.js";
|
|
2
|
+
import { astro } from "./astro.js";
|
|
3
|
+
import { command } from "./command.js";
|
|
4
|
+
import { comments } from "./comments.js";
|
|
5
|
+
import { disables } from "./disables.js";
|
|
6
|
+
import { e18e } from "./e18e.js";
|
|
7
|
+
import { formatters } from "./formatters.js";
|
|
8
|
+
import { ignores } from "./ignores.js";
|
|
9
|
+
import { imports } from "./imports.js";
|
|
10
|
+
import { javascript } from "./javascript.js";
|
|
11
|
+
import { jsdoc } from "./jsdoc.js";
|
|
12
|
+
import { jsonc } from "./jsonc.js";
|
|
13
|
+
import { markdown } from "./markdown.js";
|
|
14
|
+
import { node } from "./node.js";
|
|
15
|
+
import { nuxt } from "./nuxt.js";
|
|
16
|
+
import { perfectionist } from "./perfectionist.js";
|
|
17
|
+
import { pnpm } from "./pnpm.js";
|
|
18
|
+
import { regexp } from "./regexp.js";
|
|
19
|
+
import { sortPackageJson, sortTsconfig } from "./sort.js";
|
|
20
|
+
import { StylisticConfigDefaults, StylisticOptions, stylistic } from "./stylistic.js";
|
|
21
|
+
import { test } from "./test.js";
|
|
22
|
+
import { toml } from "./toml.js";
|
|
23
|
+
import { typescript } from "./typescript.js";
|
|
24
|
+
import { unicorn } from "./unicorn.js";
|
|
25
|
+
import { vue } from "./vue.js";
|
|
26
|
+
import { yaml } from "./yaml.js";
|
|
27
|
+
export { StylisticConfigDefaults, StylisticOptions, adonisjs, astro, command, comments, disables, e18e, formatters, ignores, imports, javascript, jsdoc, jsonc, markdown, node, nuxt, perfectionist, pnpm, regexp, sortPackageJson, sortTsconfig, stylistic, test, toml, typescript, unicorn, vue, yaml };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { adonisjs } from "./adonisjs.js";
|
|
2
|
+
import { astro } from "./astro.js";
|
|
3
|
+
import { command } from "./command.js";
|
|
4
|
+
import { comments } from "./comments.js";
|
|
5
|
+
import { disables } from "./disables.js";
|
|
6
|
+
import { e18e } from "./e18e.js";
|
|
7
|
+
import { StylisticConfigDefaults, stylistic } from "./stylistic.js";
|
|
8
|
+
import { formatters } from "./formatters.js";
|
|
9
|
+
import { ignores } from "./ignores.js";
|
|
10
|
+
import { imports } from "./imports.js";
|
|
11
|
+
import { javascript } from "./javascript.js";
|
|
12
|
+
import { jsdoc } from "./jsdoc.js";
|
|
13
|
+
import { jsonc } from "./jsonc.js";
|
|
14
|
+
import { markdown } from "./markdown.js";
|
|
15
|
+
import { node } from "./node.js";
|
|
16
|
+
import { nuxt } from "./nuxt.js";
|
|
17
|
+
import { perfectionist } from "./perfectionist.js";
|
|
18
|
+
import { pnpm } from "./pnpm.js";
|
|
19
|
+
import { regexp } from "./regexp.js";
|
|
20
|
+
import { sortPackageJson, sortTsconfig } from "./sort.js";
|
|
21
|
+
import { test } from "./test.js";
|
|
22
|
+
import { toml } from "./toml.js";
|
|
23
|
+
import { typescript } from "./typescript.js";
|
|
24
|
+
import { unicorn } from "./unicorn.js";
|
|
25
|
+
import { vue } from "./vue.js";
|
|
26
|
+
import { yaml } from "./yaml.js";
|
|
27
|
+
export { StylisticConfigDefaults, adonisjs, astro, command, comments, disables, e18e, formatters, ignores, imports, javascript, jsdoc, jsonc, markdown, node, nuxt, perfectionist, pnpm, regexp, sortPackageJson, sortTsconfig, stylistic, test, toml, typescript, unicorn, vue, yaml };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OptionsIsInEditor, OptionsOverrides, TypedFlatConfigItem } from "../types.
|
|
1
|
+
import { OptionsIsInEditor, OptionsOverrides, TypedFlatConfigItem } from "../types.js";
|
|
2
2
|
|
|
3
3
|
//#region src/configs/javascript.d.ts
|
|
4
4
|
declare function javascript(options?: OptionsIsInEditor & OptionsOverrides): TypedFlatConfigItem[];
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { pluginAntfu, pluginUnusedImports } from "../plugins.
|
|
1
|
+
import { pluginAntfu, pluginUnusedImports } from "../plugins.js";
|
|
2
2
|
import globals from "globals";
|
|
3
|
-
|
|
4
3
|
//#region src/configs/javascript.ts
|
|
5
4
|
function javascript(options = {}) {
|
|
6
5
|
const { isInEditor = false, overrides = {} } = options;
|
|
@@ -45,7 +44,6 @@ function javascript(options = {}) {
|
|
|
45
44
|
"default-case-last": "error",
|
|
46
45
|
"dot-notation": ["error", { allowKeywords: true }],
|
|
47
46
|
"eqeqeq": ["error", "smart"],
|
|
48
|
-
"logical-assignment-operators": ["error", "never"],
|
|
49
47
|
"new-cap": ["error", {
|
|
50
48
|
capIsNew: false,
|
|
51
49
|
newIsCap: true,
|
|
@@ -284,6 +282,5 @@ function javascript(options = {}) {
|
|
|
284
282
|
}
|
|
285
283
|
}];
|
|
286
284
|
}
|
|
287
|
-
|
|
288
285
|
//#endregion
|
|
289
|
-
export { javascript };
|
|
286
|
+
export { javascript };
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { GLOB_SRC } from "../globs.
|
|
2
|
-
import { interopDefault } from "../utils.
|
|
3
|
-
|
|
1
|
+
import { GLOB_SRC } from "../globs.js";
|
|
2
|
+
import { interopDefault } from "../utils.js";
|
|
4
3
|
//#region src/configs/jsdoc.ts
|
|
5
4
|
async function jsdoc(options = {}) {
|
|
6
5
|
const { stylistic = true } = options;
|
|
7
6
|
return [{
|
|
7
|
+
name: "eienjs/jsdoc/setup",
|
|
8
|
+
plugins: { jsdoc: await interopDefault(import("eslint-plugin-jsdoc")) }
|
|
9
|
+
}, {
|
|
8
10
|
files: [GLOB_SRC],
|
|
9
11
|
name: "eienjs/jsdoc/rules",
|
|
10
|
-
plugins: { jsdoc: await interopDefault(import("eslint-plugin-jsdoc")) },
|
|
11
12
|
rules: {
|
|
12
13
|
"jsdoc/check-access": "warn",
|
|
13
14
|
"jsdoc/check-param-names": "warn",
|
|
@@ -31,6 +32,5 @@ async function jsdoc(options = {}) {
|
|
|
31
32
|
}
|
|
32
33
|
}];
|
|
33
34
|
}
|
|
34
|
-
|
|
35
35
|
//#endregion
|
|
36
|
-
export { jsdoc };
|
|
36
|
+
export { jsdoc };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OptionsFiles, OptionsOverrides, OptionsStylistic, TypedFlatConfigItem } from "../types.
|
|
1
|
+
import { OptionsFiles, OptionsOverrides, OptionsStylistic, TypedFlatConfigItem } from "../types.js";
|
|
2
2
|
|
|
3
3
|
//#region src/configs/jsonc.d.ts
|
|
4
4
|
declare function jsonc(options?: OptionsFiles & OptionsStylistic & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { GLOB_JSON, GLOB_JSON5, GLOB_JSONC } from "../globs.
|
|
2
|
-
import { interopDefault } from "../utils.
|
|
3
|
-
|
|
1
|
+
import { GLOB_JSON, GLOB_JSON5, GLOB_JSONC } from "../globs.js";
|
|
2
|
+
import { interopDefault } from "../utils.js";
|
|
4
3
|
//#region src/configs/jsonc.ts
|
|
5
4
|
async function jsonc(options = {}) {
|
|
6
5
|
const { files = [
|
|
@@ -9,13 +8,12 @@ async function jsonc(options = {}) {
|
|
|
9
8
|
GLOB_JSONC
|
|
10
9
|
], overrides = {}, stylistic = true } = options;
|
|
11
10
|
const { indent = 2 } = typeof stylistic === "boolean" ? {} : stylistic;
|
|
12
|
-
const [pluginJsonc, parserJsonc] = await Promise.all([interopDefault(import("eslint-plugin-jsonc")), interopDefault(import("jsonc-eslint-parser"))]);
|
|
13
11
|
return [{
|
|
14
12
|
name: "eienjs/jsonc/setup",
|
|
15
|
-
plugins: { jsonc:
|
|
13
|
+
plugins: { jsonc: await interopDefault(import("eslint-plugin-jsonc")) }
|
|
16
14
|
}, {
|
|
17
15
|
files,
|
|
18
|
-
|
|
16
|
+
language: "jsonc/x",
|
|
19
17
|
name: "eienjs/jsonc/rules",
|
|
20
18
|
rules: {
|
|
21
19
|
"jsonc/no-bigint-literals": "error",
|
|
@@ -66,6 +64,5 @@ async function jsonc(options = {}) {
|
|
|
66
64
|
}
|
|
67
65
|
}];
|
|
68
66
|
}
|
|
69
|
-
|
|
70
67
|
//#endregion
|
|
71
|
-
export { jsonc };
|
|
68
|
+
export { jsonc };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { OptionsComponentExts, OptionsFiles, OptionsMarkdown, TypedFlatConfigItem } from "../types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/configs/markdown.d.ts
|
|
4
|
+
declare function markdown(options?: OptionsFiles & OptionsComponentExts & OptionsMarkdown): Promise<TypedFlatConfigItem[]>;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { markdown };
|