@vida0905/eslint-config 0.4.1 → 0.4.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/index.cjs CHANGED
@@ -31,8 +31,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
31
31
  // src/index.ts
32
32
  var src_exports = {};
33
33
  __export(src_exports, {
34
+ deepMerge: () => deepMerge,
34
35
  default: () => src_default,
35
- vida: () => vida
36
+ defineConfig: () => defineConfig
36
37
  });
37
38
  module.exports = __toCommonJS(src_exports);
38
39
  var import_eslint_config2 = __toESM(require("@antfu/eslint-config"), 1);
@@ -49,7 +50,7 @@ async function pinia(options = {}) {
49
50
  } = options;
50
51
  return [
51
52
  {
52
- name: "@vida/pinia",
53
+ name: "vida/pinia/rules",
53
54
  files,
54
55
  plugins: {
55
56
  pinia: await (0, import_eslint_config.interopDefault)(import("eslint-plugin-pinia"))
@@ -97,9 +98,23 @@ var overrides = {
97
98
  vue
98
99
  };
99
100
 
101
+ // src/utils.ts
102
+ function deepMerge(target, source) {
103
+ for (const key in source) {
104
+ if (Object.hasOwnProperty.call(source, key)) {
105
+ if (source[key] instanceof Object && target[key] instanceof Object) {
106
+ target[key] = deepMerge(target[key], source[key]);
107
+ } else {
108
+ target[key] = source[key];
109
+ }
110
+ }
111
+ }
112
+ return target;
113
+ }
114
+
100
115
  // src/index.ts
101
116
  __reExport(src_exports, require("@antfu/eslint-config"), module.exports);
102
- function vida(options = {}, ...userConfigs) {
117
+ function defineConfig(options = {}, ...userConfigs) {
103
118
  const {
104
119
  pinia: enablePinia = (0, import_local_pkg.isPackageExists)("pinia")
105
120
  } = options;
@@ -118,23 +133,23 @@ function vida(options = {}, ...userConfigs) {
118
133
  },
119
134
  vue: {
120
135
  overrides: overrides.vue
121
- },
122
- settings: {
123
- "import-x/resolver": "oxc"
124
136
  }
125
137
  };
126
138
  return (0, import_eslint_config2.default)(
127
- {
128
- ...antfuConfig,
129
- ...options
130
- },
139
+ deepMerge(antfuConfig, options),
131
140
  ...configs,
132
141
  ...userConfigs
133
- );
142
+ ).prepend({
143
+ name: "vida/imports/setup",
144
+ settings: {
145
+ "import-x/resolver": "oxc"
146
+ }
147
+ });
134
148
  }
135
- var src_default = vida;
149
+ var src_default = defineConfig;
136
150
  // Annotate the CommonJS export names for ESM import in node:
137
151
  0 && (module.exports = {
138
- vida,
152
+ deepMerge,
153
+ defineConfig,
139
154
  ...require("@antfu/eslint-config")
140
155
  });
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as eslint_flat_config_utils from 'eslint-flat-config-utils';
2
2
  import * as _antfu_eslint_config from '@antfu/eslint-config';
3
- import { antfu, TypedFlatConfigItem as TypedFlatConfigItem$1 } from '@antfu/eslint-config';
3
+ import { OptionsConfig as OptionsConfig$1, TypedFlatConfigItem as TypedFlatConfigItem$1 } from '@antfu/eslint-config';
4
4
  export * from '@antfu/eslint-config';
5
5
  import { Linter } from 'eslint';
6
6
 
@@ -49,9 +49,8 @@ type PiniaPreferUseStoreNamingConvention = []|[{
49
49
  [k: string]: unknown | undefined
50
50
  }]
51
51
 
52
- type AntfuOptions = Parameters<typeof antfu>[0];
53
52
  type Rules = RuleOptions;
54
- type TypedFlatConfigItem = Omit<Linter.FlatConfig<Linter.RulesRecord & Rules>, 'plugins'> & {
53
+ type TypedFlatConfigItem = Omit<Linter.Config<Linter.RulesRecord & Rules>, 'plugins'> & {
55
54
  /**
56
55
  * 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.
57
56
  *
@@ -62,7 +61,7 @@ type TypedFlatConfigItem = Omit<Linter.FlatConfig<Linter.RulesRecord & Rules>, '
62
61
  interface OptionsOverrides {
63
62
  overrides?: TypedFlatConfigItem['rules'];
64
63
  }
65
- type OptionsConfig = Omit<AntfuOptions, 'overrides'> & {
64
+ type OptionsConfig = Omit<OptionsConfig$1, 'overrides'> & {
66
65
  /**
67
66
  * Enable Pinia support.
68
67
  *
@@ -71,6 +70,8 @@ type OptionsConfig = Omit<AntfuOptions, 'overrides'> & {
71
70
  pinia?: boolean | OptionsOverrides;
72
71
  };
73
72
 
74
- declare function vida(options?: OptionsConfig & TypedFlatConfigItem$1, ...userConfigs: TypedFlatConfigItem$1[]): eslint_flat_config_utils.FlatConfigComposer<TypedFlatConfigItem$1, _antfu_eslint_config.ConfigNames>;
73
+ declare function deepMerge<T>(target: T, source: T): T;
75
74
 
76
- export { vida as default, vida };
75
+ declare function defineConfig(options?: OptionsConfig & TypedFlatConfigItem$1, ...userConfigs: TypedFlatConfigItem$1[]): eslint_flat_config_utils.FlatConfigComposer<TypedFlatConfigItem$1, _antfu_eslint_config.ConfigNames>;
76
+
77
+ export { deepMerge, defineConfig as default, defineConfig };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as eslint_flat_config_utils from 'eslint-flat-config-utils';
2
2
  import * as _antfu_eslint_config from '@antfu/eslint-config';
3
- import { antfu, TypedFlatConfigItem as TypedFlatConfigItem$1 } from '@antfu/eslint-config';
3
+ import { OptionsConfig as OptionsConfig$1, TypedFlatConfigItem as TypedFlatConfigItem$1 } from '@antfu/eslint-config';
4
4
  export * from '@antfu/eslint-config';
5
5
  import { Linter } from 'eslint';
6
6
 
@@ -49,9 +49,8 @@ type PiniaPreferUseStoreNamingConvention = []|[{
49
49
  [k: string]: unknown | undefined
50
50
  }]
51
51
 
52
- type AntfuOptions = Parameters<typeof antfu>[0];
53
52
  type Rules = RuleOptions;
54
- type TypedFlatConfigItem = Omit<Linter.FlatConfig<Linter.RulesRecord & Rules>, 'plugins'> & {
53
+ type TypedFlatConfigItem = Omit<Linter.Config<Linter.RulesRecord & Rules>, 'plugins'> & {
55
54
  /**
56
55
  * 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.
57
56
  *
@@ -62,7 +61,7 @@ type TypedFlatConfigItem = Omit<Linter.FlatConfig<Linter.RulesRecord & Rules>, '
62
61
  interface OptionsOverrides {
63
62
  overrides?: TypedFlatConfigItem['rules'];
64
63
  }
65
- type OptionsConfig = Omit<AntfuOptions, 'overrides'> & {
64
+ type OptionsConfig = Omit<OptionsConfig$1, 'overrides'> & {
66
65
  /**
67
66
  * Enable Pinia support.
68
67
  *
@@ -71,6 +70,8 @@ type OptionsConfig = Omit<AntfuOptions, 'overrides'> & {
71
70
  pinia?: boolean | OptionsOverrides;
72
71
  };
73
72
 
74
- declare function vida(options?: OptionsConfig & TypedFlatConfigItem$1, ...userConfigs: TypedFlatConfigItem$1[]): eslint_flat_config_utils.FlatConfigComposer<TypedFlatConfigItem$1, _antfu_eslint_config.ConfigNames>;
73
+ declare function deepMerge<T>(target: T, source: T): T;
75
74
 
76
- export { vida as default, vida };
75
+ declare function defineConfig(options?: OptionsConfig & TypedFlatConfigItem$1, ...userConfigs: TypedFlatConfigItem$1[]): eslint_flat_config_utils.FlatConfigComposer<TypedFlatConfigItem$1, _antfu_eslint_config.ConfigNames>;
76
+
77
+ export { deepMerge, defineConfig as default, defineConfig };
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@ async function pinia(options = {}) {
13
13
  } = options;
14
14
  return [
15
15
  {
16
- name: "@vida/pinia",
16
+ name: "vida/pinia/rules",
17
17
  files,
18
18
  plugins: {
19
19
  pinia: await interopDefault(import("eslint-plugin-pinia"))
@@ -61,9 +61,23 @@ var overrides = {
61
61
  vue
62
62
  };
63
63
 
64
+ // src/utils.ts
65
+ function deepMerge(target, source) {
66
+ for (const key in source) {
67
+ if (Object.hasOwnProperty.call(source, key)) {
68
+ if (source[key] instanceof Object && target[key] instanceof Object) {
69
+ target[key] = deepMerge(target[key], source[key]);
70
+ } else {
71
+ target[key] = source[key];
72
+ }
73
+ }
74
+ }
75
+ return target;
76
+ }
77
+
64
78
  // src/index.ts
65
79
  export * from "@antfu/eslint-config";
66
- function vida(options = {}, ...userConfigs) {
80
+ function defineConfig(options = {}, ...userConfigs) {
67
81
  const {
68
82
  pinia: enablePinia = isPackageExists("pinia")
69
83
  } = options;
@@ -82,22 +96,22 @@ function vida(options = {}, ...userConfigs) {
82
96
  },
83
97
  vue: {
84
98
  overrides: overrides.vue
85
- },
86
- settings: {
87
- "import-x/resolver": "oxc"
88
99
  }
89
100
  };
90
101
  return antfu(
91
- {
92
- ...antfuConfig,
93
- ...options
94
- },
102
+ deepMerge(antfuConfig, options),
95
103
  ...configs,
96
104
  ...userConfigs
97
- );
105
+ ).prepend({
106
+ name: "vida/imports/setup",
107
+ settings: {
108
+ "import-x/resolver": "oxc"
109
+ }
110
+ });
98
111
  }
99
- var src_default = vida;
112
+ var src_default = defineConfig;
100
113
  export {
114
+ deepMerge,
101
115
  src_default as default,
102
- vida
116
+ defineConfig
103
117
  };
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@vida0905/eslint-config",
3
3
  "type": "module",
4
- "version": "0.4.1",
5
- "packageManager": "pnpm@9.5.0",
4
+ "version": "0.4.3",
5
+ "packageManager": "pnpm@9.6.0",
6
6
  "description": "Vida Xie's ESLint Config",
7
7
  "author": "Vida Xie <vida_2020@163.com> (https://github.com/9romise/)",
8
8
  "license": "MIT",
@@ -54,25 +54,25 @@
54
54
  }
55
55
  },
56
56
  "dependencies": {
57
- "@antfu/eslint-config": "^2.22.4",
57
+ "@antfu/eslint-config": "^2.24.1",
58
58
  "eslint-import-resolver-oxc": "^0.2.0",
59
59
  "eslint-plugin-pinia": "^0.2.0",
60
60
  "local-pkg": "^0.5.0"
61
61
  },
62
62
  "devDependencies": {
63
- "@eslint/config-inspector": "^0.5.1",
64
- "@types/node": "^20.14.11",
65
- "bumpp": "^9.4.1",
66
- "eslint": "^9.7.0",
67
- "eslint-typegen": "^0.2.4",
68
- "lint-staged": "^15.2.7",
63
+ "@eslint/config-inspector": "^0.5.2",
64
+ "@types/node": "^22.1.0",
65
+ "bumpp": "^9.4.2",
66
+ "eslint": "^9.8.0",
67
+ "eslint-typegen": "^0.3.0",
68
+ "lint-staged": "^15.2.8",
69
69
  "simple-git-hooks": "^2.11.1",
70
- "tsup": "^8.1.0",
71
- "tsx": "^4.16.2",
72
- "typescript": "^5.5.3"
70
+ "tsup": "^8.2.4",
71
+ "tsx": "^4.16.5",
72
+ "typescript": "^5.5.4"
73
73
  },
74
74
  "simple-git-hooks": {
75
- "pre-commit": "npx lint-staged"
75
+ "pre-commit": "pnpm lint-staged"
76
76
  },
77
77
  "lint-staged": {
78
78
  "*": "eslint --fix"