@vida0905/eslint-config 2.5.0 → 2.5.3

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/index.js CHANGED
@@ -6,7 +6,7 @@ import path from "node:path";
6
6
  import { green } from "ansis";
7
7
 
8
8
  //#region package.json
9
- var version = "2.5.0";
9
+ var version = "2.5.3";
10
10
 
11
11
  //#endregion
12
12
  //#region src/cli/constants.ts
package/dist/index.d.ts CHANGED
@@ -33,18 +33,18 @@ interface RuleOptions {
33
33
  //#endregion
34
34
  //#region src/types.d.ts
35
35
  interface Rules extends RuleOptions {}
36
- type TypedFlatConfigItem$1 = Omit<Linter.Config<Linter.RulesRecord & Rules>, "plugins"> & {
36
+ type TypedFlatConfigItem$1 = Omit<Linter.Config<Linter.RulesRecord & Rules>, 'plugins'> & {
37
37
  /**
38
- * An object containing a name-value mapping of plugin names to plugin objects. When `files` is specified, these plugins are only available to the matching files.
39
- *
40
- * @see [Using plugins in your configuration](https://eslint.org/docs/latest/user-guide/configuring/configuration-files-new#using-plugins-in-your-configuration)
41
- */
38
+ * An object containing a name-value mapping of plugin names to plugin objects. When `files` is specified, these plugins are only available to the matching files.
39
+ *
40
+ * @see [Using plugins in your configuration](https://eslint.org/docs/latest/user-guide/configuring/configuration-files-new#using-plugins-in-your-configuration)
41
+ */
42
42
  plugins?: Record<string, any>;
43
43
  };
44
44
  interface OptionsOverrides {
45
- overrides?: TypedFlatConfigItem$1["rules"];
45
+ overrides?: TypedFlatConfigItem$1['rules'];
46
46
  }
47
- type OptionsConfig$1 = Omit<OptionsConfig, "overrides"> & {
47
+ type OptionsConfig$1 = Omit<OptionsConfig, 'overrides'> & {
48
48
  deMorgan?: boolean | OptionsOverrides;
49
49
  nuxt?: boolean | OptionsOverrides;
50
50
  };
@@ -53,6 +53,7 @@ type OptionsConfig$1 = Omit<OptionsConfig, "overrides"> & {
53
53
  declare function deepMerge<T extends object>(target: T, source: T): T;
54
54
  //#endregion
55
55
  //#region src/index.d.ts
56
- declare function defineConfig(options?: OptionsConfig$1 & Omit<TypedFlatConfigItem, "files">, ...userConfigs: Awaitable<TypedFlatConfigItem>[]): FlatConfigComposer<TypedFlatConfigItem, ConfigNames>;
56
+ declare function defineConfig(options?: OptionsConfig$1, ...userConfigs: Awaitable<TypedFlatConfigItem>[]): FlatConfigComposer<TypedFlatConfigItem, ConfigNames>;
57
+ declare function applyOptions(options: OptionsConfig$1): OptionsConfig$1;
57
58
  //#endregion
58
- export { deepMerge, defineConfig as default, defineConfig };
59
+ export { applyOptions, deepMerge, defineConfig as default, defineConfig };
package/dist/index.js CHANGED
@@ -33,64 +33,74 @@ async function nuxt(options = {}) {
33
33
 
34
34
  //#endregion
35
35
  //#region src/overrides/javascript.ts
36
- const javascript = {
36
+ const javascript = { overrides: {
37
37
  "arrow-body-style": ["error", "as-needed"],
38
38
  "no-unused-private-class-members": "error",
39
39
  "require-atomic-updates": ["error", { allowProperties: true }]
40
- };
40
+ } };
41
41
 
42
42
  //#endregion
43
43
  //#region src/overrides/stylistic.ts
44
44
  const stylistic = {
45
- "style/indent": [
46
- "error",
47
- 2,
48
- {
49
- SwitchCase: 1,
50
- VariableDeclarator: "first",
51
- outerIIFEBody: 1,
52
- MemberExpression: 1,
53
- FunctionDeclaration: {
54
- parameters: 1,
55
- body: 1
56
- },
57
- FunctionExpression: {
58
- parameters: 1,
59
- body: 1
60
- },
61
- StaticBlock: { body: 1 },
62
- CallExpression: { arguments: 1 },
63
- ArrayExpression: 1,
64
- ObjectExpression: 1,
65
- ImportDeclaration: 1,
66
- flatTernaryExpressions: true,
67
- offsetTernaryExpressions: true,
68
- ignoreComments: false,
69
- tabLength: 2
70
- }
71
- ],
72
- "style/quotes": [
73
- "error",
74
- "single",
75
- {
76
- avoidEscape: true,
77
- allowTemplateLiterals: "avoidEscape"
78
- }
79
- ],
80
- "style/arrow-parens": ["error", "always"],
81
- "style/brace-style": [
82
- "error",
83
- "1tbs",
84
- { allowSingleLine: true }
85
- ]
45
+ indent: 2,
46
+ quotes: "single",
47
+ semi: false,
48
+ overrides: {
49
+ "style/indent": [
50
+ "error",
51
+ 2,
52
+ {
53
+ SwitchCase: 1,
54
+ VariableDeclarator: "first",
55
+ outerIIFEBody: 1,
56
+ MemberExpression: 1,
57
+ FunctionDeclaration: {
58
+ parameters: 1,
59
+ body: 1
60
+ },
61
+ FunctionExpression: {
62
+ parameters: 1,
63
+ body: 1
64
+ },
65
+ StaticBlock: { body: 1 },
66
+ CallExpression: { arguments: 1 },
67
+ ArrayExpression: 1,
68
+ ObjectExpression: 1,
69
+ ImportDeclaration: 1,
70
+ flatTernaryExpressions: true,
71
+ offsetTernaryExpressions: true,
72
+ ignoreComments: false,
73
+ tabLength: 2
74
+ }
75
+ ],
76
+ "style/quotes": [
77
+ "error",
78
+ "single",
79
+ {
80
+ avoidEscape: true,
81
+ allowTemplateLiterals: "avoidEscape"
82
+ }
83
+ ],
84
+ "style/arrow-parens": ["error", "always"],
85
+ "style/brace-style": [
86
+ "error",
87
+ "1tbs",
88
+ { allowSingleLine: true }
89
+ ]
90
+ }
86
91
  };
87
92
 
93
+ //#endregion
94
+ //#region src/overrides/vue.ts
95
+ const vue = { overrides: { "vue/max-attributes-per-line": ["error", { multiline: 1 }] } };
96
+
88
97
  //#endregion
89
98
  //#region src/overrides/index.ts
90
- const overrides = {
99
+ const antfuConfig = Object.freeze({
91
100
  javascript,
92
- stylistic
93
- };
101
+ stylistic,
102
+ vue
103
+ });
94
104
 
95
105
  //#endregion
96
106
  //#region src/utils.ts
@@ -107,18 +117,18 @@ function defineConfig(options = {}, ...userConfigs) {
107
117
  const configs = [];
108
118
  if (enableDeMorgan) configs.push(deMorgan());
109
119
  if (enableNuxt) configs.push(nuxt());
110
- const antfuConfig = {
111
- stylistic: {
112
- indent: 2,
113
- quotes: "single",
114
- semi: false,
115
- overrides: overrides.stylistic
116
- },
117
- javascript: { overrides: overrides.javascript }
118
- };
119
- return antfu(deepMerge(antfuConfig, options), ...configs, ...userConfigs);
120
+ return antfu(applyOptions(options), ...configs, ...userConfigs);
121
+ }
122
+ function applyOptions(options) {
123
+ Object.keys(antfuConfig).forEach((key) => {
124
+ const optionVal = options[key];
125
+ const defaultVal = antfuConfig[key];
126
+ if (optionVal === true) options[key] = defaultVal;
127
+ else if (optionVal !== false) options[key] = optionVal ? deepMerge(optionVal, defaultVal) : defaultVal;
128
+ });
129
+ return options;
120
130
  }
121
131
  var src_default = defineConfig;
122
132
 
123
133
  //#endregion
124
- export { deepMerge, src_default as default, defineConfig };
134
+ export { applyOptions, deepMerge, src_default as default, defineConfig };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vida0905/eslint-config",
3
3
  "type": "module",
4
- "version": "2.5.0",
4
+ "version": "2.5.3",
5
5
  "description": "Vida Xie's ESLint Config",
6
6
  "author": "Vida Xie <vida_2020@163.com> (https://github.com/9romise/)",
7
7
  "license": "MIT",
@@ -36,25 +36,23 @@
36
36
  }
37
37
  },
38
38
  "dependencies": {
39
- "@antfu/eslint-config": "^5.0.0",
39
+ "@antfu/eslint-config": "^5.2.0",
40
40
  "ansis": "^4.1.0",
41
41
  "cac": "^6.7.14",
42
- "eslint-flat-config-utils": "^2.1.0",
43
- "eslint-plugin-de-morgan": "^1.3.0",
42
+ "eslint-flat-config-utils": "^2.1.1",
43
+ "eslint-plugin-de-morgan": "^1.3.1",
44
44
  "local-pkg": "^1.1.1"
45
45
  },
46
46
  "devDependencies": {
47
- "@types/node": "^24.1.0",
48
- "eslint": "^9.31.0",
47
+ "@types/node": "^24.2.0",
48
+ "eslint": "^9.32.0",
49
49
  "eslint-typegen": "^2.3.0",
50
+ "husky": "^9.1.7",
50
51
  "nano-staged": "^0.8.0",
51
- "simple-git-hooks": "^2.13.0",
52
- "tsdown": "^0.13.0",
52
+ "tsdown": "^0.13.1",
53
53
  "tsx": "^4.20.3",
54
- "typescript": "^5.8.3"
55
- },
56
- "simple-git-hooks": {
57
- "pre-commit": "npx nano-staged"
54
+ "typescript": "^5.9.2",
55
+ "vitest": "^3.2.4"
58
56
  },
59
57
  "nano-staged": {
60
58
  "*": "eslint --fix"
@@ -64,6 +62,7 @@
64
62
  "build": "tsdown",
65
63
  "typegen": "tsx scripts/typegen",
66
64
  "typecheck": "tsc --noEmit",
65
+ "test": "vitest",
67
66
  "lint": "eslint .",
68
67
  "check": "npm run typecheck && npm run lint",
69
68
  "inspect": "npx @eslint/config-inspector"