@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,115 @@
|
|
|
1
|
+
import { GLOB_SRC_EXT } from "../globs.js";
|
|
2
|
+
import { ensurePackages, interopDefault } from "../utils.js";
|
|
3
|
+
import { join } from "pathe";
|
|
4
|
+
|
|
5
|
+
//#region src/configs/adonisjs.ts
|
|
6
|
+
async function adonisjs(options = {}) {
|
|
7
|
+
const { overrides = {}, dirs = {} } = options;
|
|
8
|
+
await ensurePackages(["@adonisjs/eslint-plugin"]);
|
|
9
|
+
const pluginAdonisJS = await interopDefault(import("@adonisjs/eslint-plugin"));
|
|
10
|
+
dirs.root = dirs.root || ".";
|
|
11
|
+
const appPath = `${dirs.root}/app`;
|
|
12
|
+
dirs.controllers = dirs.controllers || `${appPath}/controllers`;
|
|
13
|
+
dirs.exceptions = dirs.exceptions || `${appPath}/exceptions`;
|
|
14
|
+
dirs.models = dirs.models || `${appPath}/models`;
|
|
15
|
+
dirs.mails = dirs.mails || `${appPath}/mails`;
|
|
16
|
+
dirs.services = dirs.services || `${appPath}/services`;
|
|
17
|
+
dirs.listeners = dirs.listeners || `${appPath}/listeners`;
|
|
18
|
+
dirs.events = dirs.events || `${appPath}/events`;
|
|
19
|
+
dirs.middleware = dirs.middleware || `${appPath}/middleware`;
|
|
20
|
+
dirs.validators = dirs.validators || `${appPath}/validators`;
|
|
21
|
+
dirs.policies = dirs.policies || `${appPath}/policies`;
|
|
22
|
+
dirs.abilities = dirs.abilities || `${appPath}/abilities`;
|
|
23
|
+
dirs.providers = dirs.providers || `${dirs.root}/providers`;
|
|
24
|
+
dirs.database = dirs.database || `${dirs.root}/database`;
|
|
25
|
+
dirs.bin = dirs.bin || `${dirs.root}/bin`;
|
|
26
|
+
dirs.start = dirs.start || `${dirs.root}/start`;
|
|
27
|
+
dirs.tests = dirs.tests || `${dirs.root}/tests`;
|
|
28
|
+
dirs.config = dirs.config || `${dirs.root}/config`;
|
|
29
|
+
dirs.commands = dirs.commands || `${dirs.root}/commands`;
|
|
30
|
+
const nestedGlobPattern = `**/*.${GLOB_SRC_EXT}`;
|
|
31
|
+
const fileRoutes = [...Object.values(dirs).map((dir) => join(dir, nestedGlobPattern)), `${dirs.root}/ace.js`];
|
|
32
|
+
const commonRulesSet = {
|
|
33
|
+
"@typescript-eslint/require-await": "off",
|
|
34
|
+
"@typescript-eslint/explicit-function-return-type": "off",
|
|
35
|
+
"@typescript-eslint/explicit-module-boundary-types": "off",
|
|
36
|
+
"@typescript-eslint/no-floating-promises": "off",
|
|
37
|
+
"@typescript-eslint/no-unsafe-return": "off",
|
|
38
|
+
"unicorn/no-anonymous-default-export": "off"
|
|
39
|
+
};
|
|
40
|
+
return [
|
|
41
|
+
{
|
|
42
|
+
name: "eienjs/adonisjs/rules",
|
|
43
|
+
plugins: { "@adonisjs": pluginAdonisJS },
|
|
44
|
+
rules: {
|
|
45
|
+
"@adonisjs/prefer-lazy-controller-import": "error",
|
|
46
|
+
"@adonisjs/prefer-lazy-listener-import": "error",
|
|
47
|
+
...overrides
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
files: fileRoutes,
|
|
52
|
+
name: "eienjs/adonisjs/disables",
|
|
53
|
+
rules: { "antfu/no-top-level-await": "off" }
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
files: [join(dirs.database, nestedGlobPattern)],
|
|
57
|
+
name: "eienjs/adonisjs/database-disables",
|
|
58
|
+
rules: { ...commonRulesSet }
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
files: [join(dirs.bin, nestedGlobPattern)],
|
|
62
|
+
name: "eienjs/adonisjs/bin-disables",
|
|
63
|
+
rules: {
|
|
64
|
+
...commonRulesSet,
|
|
65
|
+
"@typescript-eslint/no-misused-promises": "off"
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
files: [join(dirs.commands, nestedGlobPattern)],
|
|
70
|
+
name: "eienjs/adonisjs/commands-disables",
|
|
71
|
+
rules: { ...commonRulesSet }
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
files: [join(dirs.middleware, nestedGlobPattern)],
|
|
75
|
+
name: "eienjs/adonisjs/middleware-disables",
|
|
76
|
+
rules: { ...commonRulesSet }
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
files: [join(dirs.exceptions, nestedGlobPattern)],
|
|
80
|
+
name: "eienjs/adonisjs/exceptions-disables",
|
|
81
|
+
rules: { ...commonRulesSet }
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
files: [join(dirs.controllers, nestedGlobPattern)],
|
|
85
|
+
name: "eienjs/adonisjs/controllers-disables",
|
|
86
|
+
rules: {
|
|
87
|
+
"@typescript-eslint/explicit-function-return-type": "off",
|
|
88
|
+
"@typescript-eslint/explicit-module-boundary-types": "off"
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
files: [join(dirs.config, nestedGlobPattern)],
|
|
93
|
+
name: "eienjs/adonisjs/config-disables",
|
|
94
|
+
rules: { "@typescript-eslint/consistent-type-definitions": "off" }
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
files: [join(dirs.providers, nestedGlobPattern)],
|
|
98
|
+
name: "eienjs/adonisjs/providers-disables",
|
|
99
|
+
rules: { "@typescript-eslint/consistent-type-definitions": "off" }
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
files: [join(dirs.tests, nestedGlobPattern)],
|
|
103
|
+
name: "eienjs/adonisjs/tests-disables",
|
|
104
|
+
rules: {
|
|
105
|
+
"@typescript-eslint/unbound-method": "off",
|
|
106
|
+
"@typescript-eslint/explicit-function-return-type": "off",
|
|
107
|
+
"@typescript-eslint/explicit-module-boundary-types": "off",
|
|
108
|
+
"@typescript-eslint/no-unsafe-assignment": "off"
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
];
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
//#endregion
|
|
115
|
+
export { adonisjs };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { OptionsFiles, OptionsOverrides, OptionsStylistic, TypedFlatConfigItem } from "../types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/configs/astro.d.ts
|
|
4
|
+
declare function astro(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<TypedFlatConfigItem[]>;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { astro };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { GLOB_ASTRO } from "../globs.js";
|
|
2
|
+
import { interopDefault } from "../utils.js";
|
|
3
|
+
|
|
4
|
+
//#region src/configs/astro.ts
|
|
5
|
+
async function astro(options = {}) {
|
|
6
|
+
const { files = [GLOB_ASTRO], overrides = {}, stylistic = true } = options;
|
|
7
|
+
const [pluginAstro, parserAstro, parserTs] = await Promise.all([
|
|
8
|
+
interopDefault(import("eslint-plugin-astro")),
|
|
9
|
+
interopDefault(import("astro-eslint-parser")),
|
|
10
|
+
interopDefault(import("@typescript-eslint/parser"))
|
|
11
|
+
]);
|
|
12
|
+
return [{
|
|
13
|
+
name: "eienjs/astro/setup",
|
|
14
|
+
plugins: { astro: pluginAstro }
|
|
15
|
+
}, {
|
|
16
|
+
files,
|
|
17
|
+
languageOptions: {
|
|
18
|
+
globals: pluginAstro.environments.astro.globals,
|
|
19
|
+
parser: parserAstro,
|
|
20
|
+
parserOptions: {
|
|
21
|
+
extraFileExtensions: [".astro"],
|
|
22
|
+
parser: parserTs
|
|
23
|
+
},
|
|
24
|
+
sourceType: "module"
|
|
25
|
+
},
|
|
26
|
+
name: "eienjs/astro/rules",
|
|
27
|
+
processor: "astro/client-side-ts",
|
|
28
|
+
rules: {
|
|
29
|
+
"antfu/no-top-level-await": "off",
|
|
30
|
+
"astro/missing-client-only-directive-value": "error",
|
|
31
|
+
"astro/no-conflict-set-directives": "error",
|
|
32
|
+
"astro/no-deprecated-astro-canonicalurl": "error",
|
|
33
|
+
"astro/no-deprecated-astro-fetchcontent": "error",
|
|
34
|
+
"astro/no-deprecated-astro-resolve": "error",
|
|
35
|
+
"astro/no-deprecated-getentrybyslug": "error",
|
|
36
|
+
"astro/no-set-html-directive": "off",
|
|
37
|
+
"astro/no-unused-define-vars-in-style": "error",
|
|
38
|
+
"astro/semi": "off",
|
|
39
|
+
"astro/valid-compile": "error",
|
|
40
|
+
...stylistic ? {} : {
|
|
41
|
+
"@stylistic/indent": "off",
|
|
42
|
+
"@stylistic/jsx-closing-tag-location": "off",
|
|
43
|
+
"@stylistic/jsx-one-expression-per-line": "off",
|
|
44
|
+
"@stylistic/no-multiple-empty-lines": "off"
|
|
45
|
+
},
|
|
46
|
+
...overrides
|
|
47
|
+
}
|
|
48
|
+
}];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
//#endregion
|
|
52
|
+
export { astro };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { pluginComments } from "../plugins.js";
|
|
2
|
+
|
|
3
|
+
//#region src/configs/comments.ts
|
|
4
|
+
function comments() {
|
|
5
|
+
return [{
|
|
6
|
+
name: "eienjs/eslint-comments/rules",
|
|
7
|
+
plugins: { "@eslint-community/eslint-comments": pluginComments },
|
|
8
|
+
rules: {
|
|
9
|
+
"@eslint-community/eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }],
|
|
10
|
+
"@eslint-community/eslint-comments/no-aggregating-enable": "error",
|
|
11
|
+
"@eslint-community/eslint-comments/no-duplicate-disable": "error",
|
|
12
|
+
"@eslint-community/eslint-comments/no-unlimited-disable": "error",
|
|
13
|
+
"@eslint-community/eslint-comments/no-unused-enable": "error"
|
|
14
|
+
}
|
|
15
|
+
}];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
export { comments };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { GLOB_ASTRO, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_SRC, GLOB_SRC_EXT, GLOB_TOML, GLOB_YAML } from "../globs.js";
|
|
2
|
+
|
|
3
|
+
//#region src/configs/disables.ts
|
|
4
|
+
function disables() {
|
|
5
|
+
return [
|
|
6
|
+
{
|
|
7
|
+
files: [`**/scripts/${GLOB_SRC}`],
|
|
8
|
+
name: "eienjs/disables/scripts",
|
|
9
|
+
rules: {
|
|
10
|
+
"antfu/no-top-level-await": "off",
|
|
11
|
+
"no-console": "off",
|
|
12
|
+
"@typescript-eslint/explicit-function-return-type": "off",
|
|
13
|
+
"@typescript-eslint/no-deprecated": "off"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
files: [`**/cli/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
|
|
18
|
+
name: "eienjs/disables/cli",
|
|
19
|
+
rules: {
|
|
20
|
+
"antfu/no-top-level-await": "off",
|
|
21
|
+
"no-console": "off",
|
|
22
|
+
"unicorn/no-process-exit": "off",
|
|
23
|
+
"@typescript-eslint/no-unnecessary-condition": "off"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
files: ["**/bin/**/*", `**/bin.${GLOB_SRC_EXT}`],
|
|
28
|
+
name: "eienjs/disables/bin",
|
|
29
|
+
rules: {
|
|
30
|
+
"antfu/no-import-dist": "off",
|
|
31
|
+
"antfu/no-import-node-modules-by-path": "off"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
files: ["**/*.d.?([cm])ts"],
|
|
36
|
+
name: "eienjs/disables/dts",
|
|
37
|
+
rules: {
|
|
38
|
+
"@eslint-community/eslint-comments/no-unlimited-disable": "off",
|
|
39
|
+
"no-restricted-syntax": "off",
|
|
40
|
+
"unused-imports/no-unused-vars": "off"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
files: ["**/*.js", "**/*.cjs"],
|
|
45
|
+
name: "eienjs/disables/cjs",
|
|
46
|
+
rules: { "@typescript-eslint/no-require-imports": "off" }
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
files: [`**/*.config.${GLOB_SRC_EXT}`, `**/*.config.*.${GLOB_SRC_EXT}`],
|
|
50
|
+
name: "eienjs/disables/config-files",
|
|
51
|
+
rules: {
|
|
52
|
+
"antfu/no-top-level-await": "off",
|
|
53
|
+
"no-console": "off",
|
|
54
|
+
"@typescript-eslint/explicit-function-return-type": "off"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
files: [
|
|
59
|
+
GLOB_JSON,
|
|
60
|
+
GLOB_JSON5,
|
|
61
|
+
GLOB_JSONC
|
|
62
|
+
],
|
|
63
|
+
name: "eienjs/disables/json",
|
|
64
|
+
rules: { "@stylistic/max-len": "off" }
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
files: [GLOB_YAML],
|
|
68
|
+
name: "eienjs/disables/yaml",
|
|
69
|
+
rules: { "@stylistic/max-len": "off" }
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
files: [GLOB_TOML],
|
|
73
|
+
name: "eienjs/disables/toml",
|
|
74
|
+
rules: { "@stylistic/max-len": "off" }
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
files: [GLOB_ASTRO],
|
|
78
|
+
name: "eienjs/disables/astro",
|
|
79
|
+
rules: { "@stylistic/max-len": "off" }
|
|
80
|
+
}
|
|
81
|
+
];
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
//#endregion
|
|
85
|
+
export { disables };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { OptionsFormatters, StylisticConfig, TypedFlatConfigItem } from "../types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/configs/formatters.d.ts
|
|
4
|
+
declare function formatters(options?: OptionsFormatters | true, stylistic?: StylisticConfig): Promise<TypedFlatConfigItem[]>;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { formatters };
|
|
@@ -0,0 +1,134 @@
|
|
|
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";
|
|
4
|
+
|
|
5
|
+
//#region src/configs/formatters.ts
|
|
6
|
+
function mergePrettierOptions(options, overrides = {}) {
|
|
7
|
+
return {
|
|
8
|
+
...options,
|
|
9
|
+
...overrides,
|
|
10
|
+
plugins: [...overrides.plugins ?? [], ...options.plugins ?? []]
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
async function formatters(options = {}, stylistic = {}) {
|
|
14
|
+
if (options === true) {
|
|
15
|
+
const isPrettierPluginXmlInScope = isPackageInScope("@prettier/plugin-xml");
|
|
16
|
+
options = {
|
|
17
|
+
astro: isPackageInScope("prettier-plugin-astro"),
|
|
18
|
+
css: true,
|
|
19
|
+
html: true,
|
|
20
|
+
markdown: true,
|
|
21
|
+
svg: isPrettierPluginXmlInScope,
|
|
22
|
+
xml: isPrettierPluginXmlInScope
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
await ensurePackages([
|
|
26
|
+
"eslint-plugin-format",
|
|
27
|
+
options.astro ? "prettier-plugin-astro" : void 0,
|
|
28
|
+
options.xml || options.svg ? "@prettier/plugin-xml" : void 0
|
|
29
|
+
]);
|
|
30
|
+
const { indent, quotes } = {
|
|
31
|
+
...StylisticConfigDefaults,
|
|
32
|
+
...stylistic
|
|
33
|
+
};
|
|
34
|
+
const prettierOptions = Object.assign({
|
|
35
|
+
arrowParens: "always",
|
|
36
|
+
endOfLine: "lf",
|
|
37
|
+
printWidth: 120,
|
|
38
|
+
semi: true,
|
|
39
|
+
singleQuote: quotes === "single",
|
|
40
|
+
tabWidth: typeof indent === "number" ? indent : 2,
|
|
41
|
+
trailingComma: "all",
|
|
42
|
+
useTabs: indent === "tab"
|
|
43
|
+
}, options.prettierOptions ?? {});
|
|
44
|
+
const prettierXmlOptions = {
|
|
45
|
+
xmlQuoteAttributes: "double",
|
|
46
|
+
xmlSelfClosingSpace: true,
|
|
47
|
+
xmlSortAttributesByKey: false,
|
|
48
|
+
xmlWhitespaceSensitivity: "ignore"
|
|
49
|
+
};
|
|
50
|
+
const configs = [{
|
|
51
|
+
name: "eienjs/formatter/setup",
|
|
52
|
+
plugins: { format: await interopDefault(import("eslint-plugin-format")) }
|
|
53
|
+
}];
|
|
54
|
+
if (options.css) configs.push({
|
|
55
|
+
files: [GLOB_CSS, GLOB_POSTCSS],
|
|
56
|
+
languageOptions: { parser: parserPlain },
|
|
57
|
+
name: "eienjs/formatter/css",
|
|
58
|
+
rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, { parser: "css" })] }
|
|
59
|
+
}, {
|
|
60
|
+
files: [GLOB_SCSS],
|
|
61
|
+
languageOptions: { parser: parserPlain },
|
|
62
|
+
name: "eienjs/formatter/scss",
|
|
63
|
+
rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, { parser: "scss" })] }
|
|
64
|
+
}, {
|
|
65
|
+
files: [GLOB_LESS],
|
|
66
|
+
languageOptions: { parser: parserPlain },
|
|
67
|
+
name: "eienjs/formatter/less",
|
|
68
|
+
rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, { parser: "less" })] }
|
|
69
|
+
});
|
|
70
|
+
if (options.html) configs.push({
|
|
71
|
+
files: [GLOB_HTML],
|
|
72
|
+
languageOptions: { parser: parserPlain },
|
|
73
|
+
name: "eienjs/formatter/html",
|
|
74
|
+
rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, { parser: "html" })] }
|
|
75
|
+
});
|
|
76
|
+
if (options.xml) configs.push({
|
|
77
|
+
files: [GLOB_XML],
|
|
78
|
+
languageOptions: { parser: parserPlain },
|
|
79
|
+
name: "eienjs/formatter/xml",
|
|
80
|
+
rules: { "format/prettier": ["error", mergePrettierOptions({
|
|
81
|
+
...prettierXmlOptions,
|
|
82
|
+
...prettierOptions
|
|
83
|
+
}, {
|
|
84
|
+
parser: "xml",
|
|
85
|
+
plugins: ["@prettier/plugin-xml"]
|
|
86
|
+
})] }
|
|
87
|
+
});
|
|
88
|
+
if (options.svg) configs.push({
|
|
89
|
+
files: [GLOB_SVG],
|
|
90
|
+
languageOptions: { parser: parserPlain },
|
|
91
|
+
name: "eienjs/formatter/svg",
|
|
92
|
+
rules: { "format/prettier": ["error", mergePrettierOptions({
|
|
93
|
+
...prettierXmlOptions,
|
|
94
|
+
...prettierOptions
|
|
95
|
+
}, {
|
|
96
|
+
parser: "xml",
|
|
97
|
+
plugins: ["@prettier/plugin-xml"]
|
|
98
|
+
})] }
|
|
99
|
+
});
|
|
100
|
+
if (options.markdown) configs.push({
|
|
101
|
+
files: [GLOB_MARKDOWN],
|
|
102
|
+
languageOptions: { parser: parserPlain },
|
|
103
|
+
name: "eienjs/formatter/markdown",
|
|
104
|
+
rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, {
|
|
105
|
+
embeddedLanguageFormatting: "off",
|
|
106
|
+
parser: "markdown"
|
|
107
|
+
})] }
|
|
108
|
+
});
|
|
109
|
+
if (options.astro) configs.push({
|
|
110
|
+
files: [GLOB_ASTRO],
|
|
111
|
+
languageOptions: { parser: parserPlain },
|
|
112
|
+
name: "eienjs/formatter/astro",
|
|
113
|
+
rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, {
|
|
114
|
+
parser: "astro",
|
|
115
|
+
plugins: ["prettier-plugin-astro"]
|
|
116
|
+
})] }
|
|
117
|
+
}, {
|
|
118
|
+
files: [GLOB_ASTRO, GLOB_ASTRO_TS],
|
|
119
|
+
name: "eienjs/formatter/astro/disables",
|
|
120
|
+
rules: {
|
|
121
|
+
"@stylistic/arrow-parens": "off",
|
|
122
|
+
"@stylistic/block-spacing": "off",
|
|
123
|
+
"@stylistic/comma-dangle": "off",
|
|
124
|
+
"@stylistic/indent": "off",
|
|
125
|
+
"@stylistic/no-multi-spaces": "off",
|
|
126
|
+
"@stylistic/quotes": "off",
|
|
127
|
+
"@stylistic/semi": "off"
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
return configs;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
//#endregion
|
|
134
|
+
export { formatters };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { pluginAntfu, pluginImportLite } from "../plugins.js";
|
|
2
|
+
|
|
3
|
+
//#region src/configs/imports.ts
|
|
4
|
+
function imports(options = {}) {
|
|
5
|
+
const { overrides = {}, stylistic = true } = options;
|
|
6
|
+
return [{
|
|
7
|
+
name: "eienjs/imports/rules",
|
|
8
|
+
plugins: {
|
|
9
|
+
antfu: pluginAntfu,
|
|
10
|
+
import: pluginImportLite
|
|
11
|
+
},
|
|
12
|
+
rules: {
|
|
13
|
+
"antfu/import-dedupe": "error",
|
|
14
|
+
"antfu/no-import-dist": "error",
|
|
15
|
+
"antfu/no-import-node-modules-by-path": "error",
|
|
16
|
+
"import/consistent-type-specifier-style": ["error", "top-level"],
|
|
17
|
+
"import/first": "error",
|
|
18
|
+
"import/no-duplicates": "error",
|
|
19
|
+
"import/no-mutable-exports": "error",
|
|
20
|
+
"import/no-named-default": "error",
|
|
21
|
+
...stylistic ? { "import/newline-after-import": ["error", { count: 1 }] } : {},
|
|
22
|
+
...overrides
|
|
23
|
+
}
|
|
24
|
+
}];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
export { imports };
|
package/dist/configs/index.d.ts
CHANGED
|
@@ -1,96 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
//#endregion
|
|
27
|
-
//#region src/configs/javascript.d.ts
|
|
28
|
-
declare function javascript(options?: OptionsIsInEditor & OptionsOverrides): TypedFlatConfigItem[];
|
|
29
|
-
//#endregion
|
|
30
|
-
//#region src/configs/jsdoc.d.ts
|
|
31
|
-
declare function jsdoc(options?: OptionsStylistic): Promise<TypedFlatConfigItem[]>;
|
|
32
|
-
//#endregion
|
|
33
|
-
//#region src/configs/jsonc.d.ts
|
|
34
|
-
declare function jsonc(options?: OptionsFiles & OptionsStylistic & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
35
|
-
//#endregion
|
|
36
|
-
//#region src/configs/markdown.d.ts
|
|
37
|
-
declare function markdown(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
38
|
-
//#endregion
|
|
39
|
-
//#region src/configs/node.d.ts
|
|
40
|
-
declare function node(): TypedFlatConfigItem[];
|
|
41
|
-
//#endregion
|
|
42
|
-
//#region src/configs/nuxt.d.ts
|
|
43
|
-
declare function nuxt(options?: OptionsNuxt & OptionsStylistic): Promise<TypedFlatConfigItem[]>;
|
|
44
|
-
//#endregion
|
|
45
|
-
//#region src/configs/perfectionist.d.ts
|
|
46
|
-
/**
|
|
47
|
-
* Perfectionist plugin for props and items sorting.
|
|
48
|
-
*
|
|
49
|
-
* @see https://github.com/azat-io/eslint-plugin-perfectionist
|
|
50
|
-
*/
|
|
51
|
-
declare function perfectionist(): TypedFlatConfigItem[];
|
|
52
|
-
//#endregion
|
|
53
|
-
//#region src/configs/pnpm.d.ts
|
|
54
|
-
declare function pnpm(): Promise<TypedFlatConfigItem[]>;
|
|
55
|
-
//#endregion
|
|
56
|
-
//#region src/configs/regexp.d.ts
|
|
57
|
-
declare function regexp(options?: OptionsRegExp & OptionsOverrides): TypedFlatConfigItem[];
|
|
58
|
-
//#endregion
|
|
59
|
-
//#region src/configs/sort.d.ts
|
|
60
|
-
/**
|
|
61
|
-
* Sort package.json
|
|
62
|
-
*
|
|
63
|
-
* Requires `jsonc` config
|
|
64
|
-
*/
|
|
65
|
-
declare function sortPackageJson(): TypedFlatConfigItem[];
|
|
66
|
-
/**
|
|
67
|
-
* Sort tsconfig.json
|
|
68
|
-
*
|
|
69
|
-
* Requires `jsonc` config
|
|
70
|
-
*/
|
|
71
|
-
declare function sortTsconfig(): TypedFlatConfigItem[];
|
|
72
|
-
//#endregion
|
|
73
|
-
//#region src/configs/stylistic.d.ts
|
|
74
|
-
declare const StylisticConfigDefaults: StylisticConfig;
|
|
75
|
-
interface StylisticOptions extends StylisticConfig, OptionsOverrides {}
|
|
76
|
-
declare function stylistic(options?: StylisticOptions): Promise<TypedFlatConfigItem[]>;
|
|
77
|
-
//#endregion
|
|
78
|
-
//#region src/configs/test.d.ts
|
|
79
|
-
declare function test(options?: OptionsFiles & OptionsIsInEditor & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
80
|
-
//#endregion
|
|
81
|
-
//#region src/configs/toml.d.ts
|
|
82
|
-
declare function toml(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<TypedFlatConfigItem[]>;
|
|
83
|
-
//#endregion
|
|
84
|
-
//#region src/configs/typescript.d.ts
|
|
85
|
-
declare function typescript(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions & OptionsStylistic): Promise<TypedFlatConfigItem[]>;
|
|
86
|
-
//#endregion
|
|
87
|
-
//#region src/configs/unicorn.d.ts
|
|
88
|
-
declare function unicorn(options?: OptionsOverrides): TypedFlatConfigItem[];
|
|
89
|
-
//#endregion
|
|
90
|
-
//#region src/configs/vue.d.ts
|
|
91
|
-
declare function vue(options?: OptionsVue & OptionsHasTypeScript & OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<TypedFlatConfigItem[]>;
|
|
92
|
-
//#endregion
|
|
93
|
-
//#region src/configs/yaml.d.ts
|
|
94
|
-
declare function yaml(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<TypedFlatConfigItem[]>;
|
|
95
|
-
//#endregion
|
|
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 { formatters } from "./formatters.js";
|
|
7
|
+
import { ignores } from "./ignores.js";
|
|
8
|
+
import { imports } from "./imports.js";
|
|
9
|
+
import { javascript } from "./javascript.js";
|
|
10
|
+
import { jsdoc } from "./jsdoc.js";
|
|
11
|
+
import { jsonc } from "./jsonc.js";
|
|
12
|
+
import { markdown } from "./markdown.js";
|
|
13
|
+
import { node } from "./node.js";
|
|
14
|
+
import { nuxt } from "./nuxt.js";
|
|
15
|
+
import { perfectionist } from "./perfectionist.js";
|
|
16
|
+
import { pnpm } from "./pnpm.js";
|
|
17
|
+
import { regexp } from "./regexp.js";
|
|
18
|
+
import { sortPackageJson, sortTsconfig } from "./sort.js";
|
|
19
|
+
import { StylisticConfigDefaults, StylisticOptions, stylistic } from "./stylistic.js";
|
|
20
|
+
import { test } from "./test.js";
|
|
21
|
+
import { toml } from "./toml.js";
|
|
22
|
+
import { typescript } from "./typescript.js";
|
|
23
|
+
import { unicorn } from "./unicorn.js";
|
|
24
|
+
import { vue } from "./vue.js";
|
|
25
|
+
import { yaml } from "./yaml.js";
|
|
96
26
|
export { StylisticConfigDefaults, StylisticOptions, adonisjs, astro, command, comments, disables, formatters, ignores, imports, javascript, jsdoc, jsonc, markdown, node, nuxt, perfectionist, pnpm, regexp, sortPackageJson, sortTsconfig, stylistic, test, toml, typescript, unicorn, vue, yaml };
|