@vida0905/eslint-config 2.7.0 → 2.8.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.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import '../dist/cli/index.js'
2
+ import '../dist/cli/index.mjs'
@@ -6,7 +6,7 @@ import path from "node:path";
6
6
  import { styleText } from "node:util";
7
7
 
8
8
  //#region package.json
9
- var version = "2.7.0";
9
+ var version = "2.8.0";
10
10
 
11
11
  //#endregion
12
12
  //#region src/cli/constants.ts
@@ -6,11 +6,10 @@ export * from "@antfu/eslint-config"
6
6
  //#region src/configs/de-morgan.ts
7
7
  async function deMorgan(options = {}) {
8
8
  const { files = [GLOB_SRC] } = options;
9
- const pluginDeMorgan = await interopDefault(import("eslint-plugin-de-morgan"));
10
9
  return [{
11
10
  name: "vida/de-morgan/rules",
12
11
  files,
13
- ...pluginDeMorgan.configs.recommended
12
+ ...(await interopDefault(import("eslint-plugin-de-morgan"))).configs.recommended
14
13
  }];
15
14
  }
16
15
 
@@ -93,15 +92,23 @@ const stylistic = {
93
92
  }
94
93
  };
95
94
 
95
+ //#endregion
96
+ //#region src/overrides/typescript.ts
97
+ const typescript = { overrides: { "ts/array-type": "error" } };
98
+
96
99
  //#endregion
97
100
  //#region src/overrides/vue.ts
98
- const vue = { overrides: { "vue/max-attributes-per-line": ["error", { multiline: 1 }] } };
101
+ const vue = { overrides: {
102
+ "vue/max-attributes-per-line": ["error", { multiline: 1 }],
103
+ "vue/prefer-use-template-ref": ["error"]
104
+ } };
99
105
 
100
106
  //#endregion
101
107
  //#region src/overrides/index.ts
102
- const antfuConfig = Object.freeze({
108
+ const antfuOverrides = Object.freeze({
103
109
  javascript,
104
110
  stylistic,
111
+ typescript,
105
112
  vue
106
113
  });
107
114
 
@@ -115,20 +122,31 @@ function deepMerge(target, source) {
115
122
 
116
123
  //#endregion
117
124
  //#region src/index.ts
118
- function defineConfig(options = {}, ...userConfigs) {
119
- const { deMorgan: enableDeMorgan = true, nuxt: enableNuxt = isPackageExists("nuxt") } = options;
125
+ const VuePackages = [
126
+ "vue",
127
+ "nuxt",
128
+ "vitepress",
129
+ "@slidev/cli"
130
+ ];
131
+ function defineConfig(options = {
132
+ deMorgan: true,
133
+ nuxt: isPackageExists("nuxt"),
134
+ vue: VuePackages.some((i) => isPackageExists(i)),
135
+ typescript: isPackageExists("typescript")
136
+ }, ...userConfigs) {
137
+ const { deMorgan: enableDeMorgan, nuxt: enableNuxt } = options;
120
138
  const configs = [];
121
139
  if (enableDeMorgan) configs.push(deMorgan());
122
140
  if (enableNuxt) configs.push(nuxt());
123
141
  return antfu(applyOptions(options), ...configs, ...userConfigs);
124
142
  }
125
143
  function applyOptions(options) {
126
- Object.keys(antfuConfig).forEach((key) => {
144
+ for (const key in antfuOverrides) {
127
145
  const optionVal = options[key];
128
- const defaultVal = antfuConfig[key];
146
+ const defaultVal = antfuOverrides[key];
129
147
  if (optionVal === true) options[key] = defaultVal;
130
- else if (optionVal !== false) options[key] = optionVal ? deepMerge(optionVal, defaultVal) : defaultVal;
131
- });
148
+ else if (optionVal !== false) options[key] = optionVal ? deepMerge(defaultVal, optionVal) : defaultVal;
149
+ }
132
150
  return options;
133
151
  }
134
152
  var src_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.7.0",
4
+ "version": "2.8.0",
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",
@@ -17,11 +17,11 @@
17
17
  "eslint-config"
18
18
  ],
19
19
  "exports": {
20
- ".": "./dist/index.js"
20
+ ".": "./dist/index.mjs"
21
21
  },
22
- "main": "./dits/index.js",
23
- "types": "./dist/index.d.ts",
24
- "bin": "./bin/index.js",
22
+ "main": "./dits/index.mjs",
23
+ "types": "./dist/index.d.mts",
24
+ "bin": "./bin/index.mjs",
25
25
  "files": [
26
26
  "bin",
27
27
  "dist"
@@ -40,22 +40,22 @@
40
40
  }
41
41
  },
42
42
  "dependencies": {
43
- "@antfu/eslint-config": "^5.4.1",
43
+ "@antfu/eslint-config": "^6.7.3",
44
44
  "cac": "^6.7.14",
45
45
  "eslint-flat-config-utils": "^2.1.4",
46
46
  "eslint-plugin-de-morgan": "^2.0.0",
47
47
  "local-pkg": "^1.1.2"
48
48
  },
49
49
  "devDependencies": {
50
- "@types/node": "^24.6.1",
51
- "eslint": "^9.36.0",
50
+ "@types/node": "^25.0.3",
51
+ "eslint": "^9.39.2",
52
52
  "eslint-typegen": "^2.3.0",
53
53
  "husky": "^9.1.7",
54
- "nano-staged": "^0.8.0",
55
- "tsdown": "^0.15.6",
56
- "tsx": "^4.20.6",
54
+ "nano-staged": "^0.9.0",
55
+ "tsdown": "^0.18.3",
56
+ "tsx": "^4.21.0",
57
57
  "typescript": "^5.9.3",
58
- "vitest": "^3.2.4"
58
+ "vitest": "^4.0.16"
59
59
  },
60
60
  "nano-staged": {
61
61
  "*": "eslint --fix"
@@ -68,6 +68,6 @@
68
68
  "test": "vitest",
69
69
  "lint": "eslint .",
70
70
  "check": "npm run typecheck && npm run lint",
71
- "inspect": "npx @eslint/config-inspector --config eslint-inspector.config.ts"
71
+ "inspect": "npx eslint --inspect-config --config eslint-inspector.config.ts"
72
72
  }
73
73
  }
File without changes