@eienjs/eslint-config 1.11.4 → 2.0.1
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/LICENSE +1 -1
- package/dist/cli/constants_generated.js +2 -2
- package/dist/cli/run.js +1 -1
- package/dist/config_presets.js +2 -0
- package/dist/configs/formatters.js +1 -1
- package/dist/configs/javascript.js +1 -6
- package/dist/configs/markdown.js +0 -15
- package/dist/configs/perfectionist.d.ts +2 -2
- package/dist/configs/perfectionist.js +4 -2
- package/dist/configs/pnpm.js +1 -4
- package/dist/configs/stylistic.js +4 -2
- package/dist/configs/vue.js +17 -9
- package/dist/factory.js +8 -5
- package/dist/globs.js +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/package.js +1 -1
- package/dist/typegen.d.ts +551 -227
- package/dist/types.d.ts +13 -1
- package/dist/vendored/prettier_types.d.ts +1 -1
- package/package.json +82 -57
package/LICENSE
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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.
|
|
4
|
+
"@nuxt/eslint-plugin": "^1.16.0",
|
|
5
5
|
"astro-eslint-parser": "^1.4.0",
|
|
6
|
-
"eslint": "^10.
|
|
6
|
+
"eslint": "^10.4.1",
|
|
7
7
|
"eslint-plugin-astro": "^1.7.0",
|
|
8
8
|
"eslint-plugin-format": "^2.0.1",
|
|
9
9
|
"prettier-plugin-astro": "^0.14.1"
|
package/dist/cli/run.js
CHANGED
|
@@ -43,7 +43,7 @@ async function run(options = {}) {
|
|
|
43
43
|
});
|
|
44
44
|
},
|
|
45
45
|
extra: async ({ results }) => {
|
|
46
|
-
const isArgExtraValid = argExtra?.length && argExtra.
|
|
46
|
+
const isArgExtraValid = argExtra?.length && !argExtra.some((element) => !extra.includes(element));
|
|
47
47
|
if (!results.uncommittedConfirmed || isArgExtraValid) return;
|
|
48
48
|
const message = argExtra ? `"${argExtra.toString()}" isn't a valid extra util. Please choose from below: ` : "Select a extra utils:";
|
|
49
49
|
return p.multiselect({
|
package/dist/config_presets.js
CHANGED
|
@@ -10,6 +10,7 @@ const CONFIG_PRESET_FULL_ON = {
|
|
|
10
10
|
markdown: true,
|
|
11
11
|
node: true,
|
|
12
12
|
nuxt: true,
|
|
13
|
+
perfectionist: true,
|
|
13
14
|
pnpm: true,
|
|
14
15
|
regexp: true,
|
|
15
16
|
stylistic: { experimental: true },
|
|
@@ -34,6 +35,7 @@ const CONFIG_PRESET_FULL_OFF = {
|
|
|
34
35
|
markdown: false,
|
|
35
36
|
node: false,
|
|
36
37
|
nuxt: false,
|
|
38
|
+
perfectionist: false,
|
|
37
39
|
pnpm: false,
|
|
38
40
|
regexp: false,
|
|
39
41
|
stylistic: false,
|
|
@@ -33,7 +33,7 @@ async function formatters(options = {}, stylistic = {}) {
|
|
|
33
33
|
const prettierOptions = Object.assign({
|
|
34
34
|
arrowParens: "always",
|
|
35
35
|
endOfLine: "lf",
|
|
36
|
-
printWidth:
|
|
36
|
+
printWidth: 160,
|
|
37
37
|
semi: true,
|
|
38
38
|
singleQuote: quotes === "single",
|
|
39
39
|
tabWidth: typeof indent === "number" ? indent : 2,
|
|
@@ -203,12 +203,7 @@ function javascript(options = {}) {
|
|
|
203
203
|
allowTaggedTemplates: true,
|
|
204
204
|
allowTernary: true
|
|
205
205
|
}],
|
|
206
|
-
"no-unused-vars":
|
|
207
|
-
args: "none",
|
|
208
|
-
caughtErrors: "none",
|
|
209
|
-
ignoreRestSiblings: true,
|
|
210
|
-
vars: "all"
|
|
211
|
-
}],
|
|
206
|
+
"no-unused-vars": "off",
|
|
212
207
|
"no-use-before-define": ["error", {
|
|
213
208
|
classes: false,
|
|
214
209
|
functions: false,
|
package/dist/configs/markdown.js
CHANGED
|
@@ -31,21 +31,6 @@ async function markdown(options = {}) {
|
|
|
31
31
|
...overridesMarkdown
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
|
-
{
|
|
35
|
-
files,
|
|
36
|
-
name: "eienjs/markdown/disables/markdown",
|
|
37
|
-
rules: {
|
|
38
|
-
"@stylistic/indent": "off",
|
|
39
|
-
"command/command": "off",
|
|
40
|
-
"no-irregular-whitespace": "off",
|
|
41
|
-
"perfectionist/sort-exports": "off",
|
|
42
|
-
"perfectionist/sort-imports": "off",
|
|
43
|
-
"regexp/no-legacy-features": "off",
|
|
44
|
-
"regexp/no-missing-g-flag": "off",
|
|
45
|
-
"regexp/no-useless-dollar-replacements": "off",
|
|
46
|
-
"regexp/no-useless-flag": "off"
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
34
|
{
|
|
50
35
|
files: [
|
|
51
36
|
GLOB_MARKDOWN,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TypedFlatConfigItem } from "../types.js";
|
|
1
|
+
import { OptionsOverrides, TypedFlatConfigItem } from "../types.js";
|
|
2
2
|
|
|
3
3
|
//#region src/configs/perfectionist.d.ts
|
|
4
4
|
/**
|
|
@@ -6,6 +6,6 @@ import { TypedFlatConfigItem } from "../types.js";
|
|
|
6
6
|
*
|
|
7
7
|
* @see https://github.com/azat-io/eslint-plugin-perfectionist
|
|
8
8
|
*/
|
|
9
|
-
declare function perfectionist(): TypedFlatConfigItem[];
|
|
9
|
+
declare function perfectionist(options: OptionsOverrides): TypedFlatConfigItem[];
|
|
10
10
|
//#endregion
|
|
11
11
|
export { perfectionist };
|
|
@@ -5,7 +5,8 @@ import { pluginPerfectionist } from "../plugins.js";
|
|
|
5
5
|
*
|
|
6
6
|
* @see https://github.com/azat-io/eslint-plugin-perfectionist
|
|
7
7
|
*/
|
|
8
|
-
function perfectionist() {
|
|
8
|
+
function perfectionist(options) {
|
|
9
|
+
const { overrides = {} } = options;
|
|
9
10
|
return [{
|
|
10
11
|
name: "eienjs/perfectionist/setup",
|
|
11
12
|
plugins: { perfectionist: pluginPerfectionist },
|
|
@@ -46,7 +47,8 @@ function perfectionist() {
|
|
|
46
47
|
"perfectionist/sort-named-imports": ["error", {
|
|
47
48
|
order: "asc",
|
|
48
49
|
type: "natural"
|
|
49
|
-
}]
|
|
50
|
+
}],
|
|
51
|
+
...overrides
|
|
50
52
|
}
|
|
51
53
|
}];
|
|
52
54
|
}
|
package/dist/configs/pnpm.js
CHANGED
|
@@ -22,10 +22,7 @@ async function pnpm(options) {
|
|
|
22
22
|
name: "eienjs/pnpm/package-json",
|
|
23
23
|
plugins: { pnpm: pluginPnpm },
|
|
24
24
|
rules: {
|
|
25
|
-
...catalogs ? { "pnpm/json-enforce-catalog":
|
|
26
|
-
autofix: !isInEditor,
|
|
27
|
-
ignores: ["@types/vscode"]
|
|
28
|
-
}] } : {},
|
|
25
|
+
...catalogs ? { "pnpm/json-enforce-catalog": "off" } : {},
|
|
29
26
|
"pnpm/json-prefer-workspace-settings": ["error", { autofix: !isInEditor }],
|
|
30
27
|
"pnpm/json-valid-catalog": ["error", { autofix: !isInEditor }]
|
|
31
28
|
}
|
|
@@ -2,17 +2,19 @@ import { interopDefault } from "../utils.js";
|
|
|
2
2
|
import { pluginAntfu } from "../plugins.js";
|
|
3
3
|
//#region src/configs/stylistic.ts
|
|
4
4
|
const StylisticConfigDefaults = {
|
|
5
|
+
braceStyle: "1tbs",
|
|
5
6
|
experimental: false,
|
|
6
7
|
indent: 2,
|
|
7
8
|
quotes: "single"
|
|
8
9
|
};
|
|
9
10
|
async function stylistic(options = {}) {
|
|
10
|
-
const { experimental, indent, maxLineLength =
|
|
11
|
+
const { braceStyle, experimental, indent, maxLineLength = 160, overrides = {}, quotes } = {
|
|
11
12
|
...StylisticConfigDefaults,
|
|
12
13
|
...options
|
|
13
14
|
};
|
|
14
15
|
const pluginStylistic = await interopDefault(import("@stylistic/eslint-plugin"));
|
|
15
16
|
const config = pluginStylistic.configs.customize({
|
|
17
|
+
braceStyle,
|
|
16
18
|
experimental,
|
|
17
19
|
indent,
|
|
18
20
|
quotes,
|
|
@@ -29,7 +31,7 @@ async function stylistic(options = {}) {
|
|
|
29
31
|
"@stylistic/arrow-parens": ["error", "always"],
|
|
30
32
|
"@stylistic/brace-style": [
|
|
31
33
|
"error",
|
|
32
|
-
|
|
34
|
+
braceStyle,
|
|
33
35
|
{ allowSingleLine: true }
|
|
34
36
|
],
|
|
35
37
|
"@stylistic/comma-spacing": "error",
|
package/dist/configs/vue.js
CHANGED
|
@@ -5,7 +5,7 @@ import { mergeProcessors } from "eslint-merge-processors";
|
|
|
5
5
|
async function vue(options = {}) {
|
|
6
6
|
const { componentNameInTemplateCasingGlobals = [], componentNameInTemplateCasingIgnores = [], componentNameInTemplateCasingOnlyRegistered = false, files = [GLOB_VUE], overrides = {}, stylistic = true, typescript } = options;
|
|
7
7
|
const sfcBlocks = options.sfcBlocks === true ? {} : options.sfcBlocks ?? {};
|
|
8
|
-
const { indent = 2, maxLineLength =
|
|
8
|
+
const { braceStyle = "1tbs", indent = 2, maxLineLength = 160 } = typeof stylistic === "boolean" ? {} : stylistic;
|
|
9
9
|
const [pluginVue, parserVue, processorVueBlocks] = await Promise.all([
|
|
10
10
|
interopDefault(import("eslint-plugin-vue")),
|
|
11
11
|
interopDefault(import("vue-eslint-parser")),
|
|
@@ -83,19 +83,21 @@ async function vue(options = {}) {
|
|
|
83
83
|
],
|
|
84
84
|
"vue/component-options-name-casing": ["error", "PascalCase"],
|
|
85
85
|
"vue/custom-event-name-casing": ["error", "camelCase"],
|
|
86
|
-
"vue/define-macros-order": ["error", {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
86
|
+
"vue/define-macros-order": ["error", {
|
|
87
|
+
defineExposeLast: true,
|
|
88
|
+
order: [
|
|
89
|
+
"defineOptions",
|
|
90
|
+
"defineProps",
|
|
91
|
+
"defineEmits",
|
|
92
|
+
"defineSlots"
|
|
93
|
+
]
|
|
94
|
+
}],
|
|
92
95
|
"vue/define-props-declaration": "error",
|
|
93
96
|
"vue/dot-location": ["error", "property"],
|
|
94
97
|
"vue/dot-notation": ["error", { allowKeywords: true }],
|
|
95
98
|
"vue/eqeqeq": ["error", "smart"],
|
|
96
99
|
"vue/html-indent": ["error", indent],
|
|
97
100
|
"vue/html-quotes": ["error", "double"],
|
|
98
|
-
"vue/max-attributes-per-line": "off",
|
|
99
101
|
"vue/multi-word-component-names": "off",
|
|
100
102
|
"vue/no-dupe-keys": "off",
|
|
101
103
|
"vue/no-empty-component-block": "error",
|
|
@@ -154,7 +156,7 @@ async function vue(options = {}) {
|
|
|
154
156
|
}],
|
|
155
157
|
"vue/brace-style": [
|
|
156
158
|
"error",
|
|
157
|
-
|
|
159
|
+
braceStyle,
|
|
158
160
|
{ allowSingleLine: true }
|
|
159
161
|
],
|
|
160
162
|
"vue/comma-dangle": ["error", "always-multiline"],
|
|
@@ -176,9 +178,15 @@ async function vue(options = {}) {
|
|
|
176
178
|
after: true,
|
|
177
179
|
before: true
|
|
178
180
|
}],
|
|
181
|
+
"vue/max-attributes-per-line": ["error", {
|
|
182
|
+
multiline: 1,
|
|
183
|
+
singleline: 3
|
|
184
|
+
}],
|
|
179
185
|
"vue/max-len": ["error", {
|
|
180
186
|
code: maxLineLength,
|
|
181
187
|
comments: maxLineLength,
|
|
188
|
+
ignoreHTMLAttributeValues: true,
|
|
189
|
+
ignoreHTMLTextContents: true,
|
|
182
190
|
template: maxLineLength
|
|
183
191
|
}],
|
|
184
192
|
"vue/object-curly-newline": "off",
|
package/dist/factory.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { findUpSync } from "./node_modules/.pnpm/find-up-simple@1.0.1/node_modules/find-up-simple/index.js";
|
|
2
|
+
import { GLOB_MARKDOWN } from "./globs.js";
|
|
2
3
|
import { interopDefault, isInEditorEnv } from "./utils.js";
|
|
3
4
|
import { adonisjs } from "./configs/adonisjs.js";
|
|
4
5
|
import { astro } from "./configs/astro.js";
|
|
@@ -51,7 +52,7 @@ const defaultPluginRenaming = {
|
|
|
51
52
|
"yml": "yaml"
|
|
52
53
|
};
|
|
53
54
|
function eienjs(options = {}) {
|
|
54
|
-
const { adonisjs: enableAdonisjs = false, astro: enableAstro = false, componentExts = [], e18e: enableE18e = true, gitignore: enableGitignore = true, ignores: userIgnores = [], imports: enableImports = true, jsdoc: enableJsdoc = true, node: enableNode = true, nuxt: enableNuxt = false, pnpm: enableCatalogs = Boolean(findUpSync("pnpm-workspace.yaml")), regexp: enableRegexp = true, typescript: enableTypeScript = isPackageExists("typescript") || isPackageExists("@typescript/native-preview"), unicorn: enableUnicorn = true, vue: enableVue = VuePackages.some((i) => isPackageExists(i)) } = options;
|
|
55
|
+
const { adonisjs: enableAdonisjs = false, astro: enableAstro = false, autoRenamePlugins = true, componentExts = [], e18e: enableE18e = true, gitignore: enableGitignore = true, ignores: userIgnores = [], imports: enableImports = true, jsdoc: enableJsdoc = true, node: enableNode = true, nuxt: enableNuxt = false, perfectionist: enablePerfectionist = true, pnpm: enableCatalogs = Boolean(findUpSync("pnpm-workspace.yaml")), regexp: enableRegexp = true, typescript: enableTypeScript = isPackageExists("typescript") || isPackageExists("@typescript/native-preview"), unicorn: enableUnicorn = true, vue: enableVue = VuePackages.some((i) => isPackageExists(i)) } = options;
|
|
55
56
|
let { isInEditor } = options;
|
|
56
57
|
if (isInEditor == null) {
|
|
57
58
|
isInEditor = isInEditorEnv();
|
|
@@ -71,7 +72,8 @@ function eienjs(options = {}) {
|
|
|
71
72
|
configs.push(ignores(userIgnores, !enableTypeScript), javascript({
|
|
72
73
|
isInEditor,
|
|
73
74
|
overrides: getOverrides(options, "javascript")
|
|
74
|
-
}), comments(), command()
|
|
75
|
+
}), comments(), command());
|
|
76
|
+
if (enablePerfectionist) configs.push(perfectionist({ overrides: getOverrides(options, "perfectionist") }));
|
|
75
77
|
if (enableNode) configs.push(node());
|
|
76
78
|
if (enableJsdoc) configs.push(jsdoc({ stylistic: stylisticOptions }));
|
|
77
79
|
if (enableImports) configs.push(imports({
|
|
@@ -84,8 +86,7 @@ function eienjs(options = {}) {
|
|
|
84
86
|
if (enableTypeScript) configs.push(typescript({
|
|
85
87
|
...typescriptOptions,
|
|
86
88
|
componentExts,
|
|
87
|
-
overrides: getOverrides(options, "typescript")
|
|
88
|
-
stylistic: stylisticOptions
|
|
89
|
+
overrides: getOverrides(options, "typescript")
|
|
89
90
|
}));
|
|
90
91
|
if (stylisticOptions) configs.push(stylistic({
|
|
91
92
|
...stylisticOptions,
|
|
@@ -153,7 +154,9 @@ function eienjs(options = {}) {
|
|
|
153
154
|
}, {});
|
|
154
155
|
if (Object.keys(fusedConfig).length > 0) configs.push([fusedConfig]);
|
|
155
156
|
let composer = new FlatConfigComposer();
|
|
156
|
-
composer = composer.append(...configs)
|
|
157
|
+
composer = composer.append(...configs);
|
|
158
|
+
if (options.markdown ?? true) composer = composer.setDefaultIgnores((prev) => [...prev, GLOB_MARKDOWN]);
|
|
159
|
+
if (autoRenamePlugins) composer = composer.renamePlugins(defaultPluginRenaming);
|
|
157
160
|
if (isInEditor) composer = composer.disableRulesFix([
|
|
158
161
|
"unused-imports/no-unused-imports",
|
|
159
162
|
"test/no-only-tests",
|
package/dist/globs.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -4,4 +4,4 @@ import { ResolvedOptions, defaultPluginRenaming, eienjs, getOverrides, resolveSu
|
|
|
4
4
|
import { CONFIG_PRESET_FULL_OFF, CONFIG_PRESET_FULL_ON } from "./config_presets.js";
|
|
5
5
|
import { GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_EXTS, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML } from "./globs.js";
|
|
6
6
|
import { combine, ensurePackages, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, parserPlain, toArray } from "./utils.js";
|
|
7
|
-
export { Awaitable, CONFIG_PRESET_FULL_OFF, CONFIG_PRESET_FULL_ON, ConfigNames, GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_EXTS, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, OptionsAdonisJS, OptionsComponentExts, OptionsConfig, OptionsE18e, OptionsErasableSyntaxOnly, OptionsFiles, OptionsFormatters, OptionsHasTypeScript, OptionsIsInEditor, OptionsMarkdown, OptionsNuxt, OptionsOverrides, OptionsPnpm, OptionsRegExp, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsTypescript, OptionsTypescriptWithErasableSyntaxOnly, OptionsVue, ResolvedOptions, RuleOptions, Rules, StylisticConfig, TypedFlatConfigItem, combine, eienjs as default, defaultPluginRenaming, eienjs, ensurePackages, getOverrides, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, parserPlain, resolveSubOptions, toArray };
|
|
7
|
+
export { type Awaitable, CONFIG_PRESET_FULL_OFF, CONFIG_PRESET_FULL_ON, type ConfigNames, GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_EXTS, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, type OptionsAdonisJS, type OptionsComponentExts, type OptionsConfig, type OptionsE18e, type OptionsErasableSyntaxOnly, type OptionsFiles, type OptionsFormatters, type OptionsHasTypeScript, type OptionsIsInEditor, type OptionsMarkdown, type OptionsNuxt, type OptionsOverrides, type OptionsPnpm, type OptionsRegExp, type OptionsStylistic, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type OptionsTypescript, type OptionsTypescriptWithErasableSyntaxOnly, type OptionsVue, ResolvedOptions, type RuleOptions, type Rules, type StylisticConfig, type TypedFlatConfigItem, combine, eienjs as default, defaultPluginRenaming, eienjs, ensurePackages, getOverrides, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, parserPlain, resolveSubOptions, toArray };
|
package/dist/package.js
CHANGED