@vida0905/eslint-config 2.5.2 → 2.6.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/README.md CHANGED
@@ -4,24 +4,23 @@
4
4
 
5
5
  Self use eslint config, extends [antfu's config](https://github.com/antfu/eslint-config)
6
6
 
7
- ### Difference
7
+ ## Difference
8
8
 
9
9
  - More stricter rules.
10
- - Support `pinia`.
11
10
  - Disable `jsx` by default.
12
11
 
13
- ### Setup
12
+ ## Setup
14
13
 
15
14
  ```shell
16
- npm i -D @vida/eslint-config
15
+ npm i -D @vida0905/eslint-config
17
16
  ```
18
17
 
19
18
  in `eslint.config.js`
20
19
 
21
20
  ```js
22
- import { vida } from '@vida0905/eslint-config'
21
+ import { defineConfig } from '@vida0905/eslint-config'
23
22
 
24
- export default vida()
23
+ export default defineConfig()
25
24
  ```
26
25
 
27
26
  in `.vscode/settings.json`, more info to [@antfu/eslint-config](https://github.com/antfu/eslint-config?tab=readme-ov-file#vs-code-support-auto-fix-on-save)
@@ -81,3 +80,8 @@ in `.vscode/settings.json`, more info to [@antfu/eslint-config](https://github.c
81
80
  ]
82
81
  }
83
82
  ```
83
+
84
+ ## License
85
+
86
+ - [MIT](https://github.com/9romise/eslint-config?tab=MIT-1-ov-file) License © 2024-PRESENT [Vida Xie](https://github.com/9romise)
87
+ - @antfu/eslint-config - [MIT](https://github.com/antfu/eslint-config?tab=MIT-1-ov-file) License
package/bin/index.js CHANGED
File without changes
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.2";
9
+ var version = "2.6.0";
10
10
 
11
11
  //#endregion
12
12
  //#region src/cli/constants.ts
@@ -103,4 +103,5 @@ cli.help();
103
103
  cli.version(version);
104
104
  cli.parse();
105
105
 
106
- //#endregion
106
+ //#endregion
107
+ export { };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Awaitable, ConfigNames, OptionsConfig, TypedFlatConfigItem } from "@antfu/eslint-config";
1
+ import { Awaitable, ConfigNames, OptionsConfig, OptionsFiles, TypedFlatConfigItem } from "@antfu/eslint-config";
2
2
  import { FlatConfigComposer } from "eslint-flat-config-utils";
3
3
  import { Linter } from "eslint";
4
4
  export * from "@antfu/eslint-config";
@@ -33,20 +33,34 @@ 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'> & {
48
- deMorgan?: boolean | OptionsOverrides;
49
- nuxt?: boolean | OptionsOverrides;
47
+ type OptionsConfig$1 = Omit<OptionsConfig, "overrides"> & {
48
+ /**
49
+ * Enable de-morgan rules.
50
+ *
51
+ * @see https://github.com/azat-io/eslint-plugin-de-morgan
52
+ * @default true
53
+ */
54
+ deMorgan?: boolean | OptionsFiles;
55
+ /**
56
+ * Enable Nuxt.js rules.
57
+ *
58
+ * Requires installing:
59
+ * - [`@nuxt/eslint-plugin`](https://eslint.nuxt.com/packages/plugin)
60
+ *
61
+ * @default auto-detect based on the dependencies
62
+ */
63
+ nuxt?: boolean | OptionsOverrides & OptionsFiles;
50
64
  };
51
65
  //#endregion
52
66
  //#region src/utils.d.ts
package/dist/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import antfu, { GLOB_SRC, ensurePackages, interopDefault } from "@antfu/eslint-config";
2
2
  import { isPackageExists } from "local-pkg";
3
- import pluginDeMorgan from "eslint-plugin-de-morgan";
4
3
 
5
4
  export * from "@antfu/eslint-config"
6
5
 
7
6
  //#region src/configs/de-morgan.ts
8
- function deMorgan(options = {}) {
7
+ async function deMorgan(options = {}) {
9
8
  const { files = [GLOB_SRC] } = options;
9
+ const pluginDeMorgan = await interopDefault(import("eslint-plugin-de-morgan"));
10
10
  return [{
11
11
  name: "vida/de-morgan/rules",
12
12
  files,
@@ -17,16 +17,20 @@ function deMorgan(options = {}) {
17
17
  //#endregion
18
18
  //#region src/configs/nuxt.ts
19
19
  async function nuxt(options = {}) {
20
- const { files = [GLOB_SRC] } = options;
20
+ const { files = [GLOB_SRC], overrides = {} } = options;
21
21
  await ensurePackages(["@nuxt/eslint-plugin"]);
22
22
  const pluginNuxt = await interopDefault(import("@nuxt/eslint-plugin"));
23
23
  return [{
24
+ name: "vida/nuxt/setup",
25
+ languageOptions: { globals: { defineNuxtConfig: "readonly" } },
26
+ plugins: { nuxt: pluginNuxt }
27
+ }, {
24
28
  name: "vida/nuxt/rules",
25
29
  files,
26
- plugins: { nuxt: pluginNuxt },
27
30
  rules: {
28
31
  "nuxt/prefer-import-meta": "error",
29
- "nuxt/nuxt-config-keys-order": "error"
32
+ "nuxt/nuxt-config-keys-order": "error",
33
+ ...overrides
30
34
  }
31
35
  }];
32
36
  }
@@ -113,7 +117,7 @@ function deepMerge(target, source) {
113
117
  //#endregion
114
118
  //#region src/index.ts
115
119
  function defineConfig(options = {}, ...userConfigs) {
116
- const { deMorgan: enableDeMorgan, nuxt: enableNuxt = isPackageExists("nuxt") } = options;
120
+ const { deMorgan: enableDeMorgan = true, nuxt: enableNuxt = isPackageExists("nuxt") } = options;
117
121
  const configs = [];
118
122
  if (enableDeMorgan) configs.push(deMorgan());
119
123
  if (enableNuxt) configs.push(nuxt());
@@ -128,7 +132,6 @@ function applyOptions(options) {
128
132
  });
129
133
  return options;
130
134
  }
131
- var src_default = defineConfig;
132
135
 
133
136
  //#endregion
134
- export { applyOptions, deepMerge, src_default as default, defineConfig };
137
+ export { applyOptions, deepMerge, defineConfig as default, defineConfig };
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "@vida0905/eslint-config",
3
3
  "type": "module",
4
- "version": "2.5.2",
5
- "packageManager": "pnpm@10.14.0",
4
+ "version": "2.6.0",
6
5
  "description": "Vida Xie's ESLint Config",
7
6
  "author": "Vida Xie <vida_2020@163.com> (https://github.com/9romise/)",
8
7
  "license": "MIT",
@@ -27,46 +26,49 @@
27
26
  "bin",
28
27
  "dist"
29
28
  ],
30
- "scripts": {
31
- "dev": "tsdown --watch",
32
- "build": "tsdown",
33
- "typegen": "tsx scripts/typegen",
34
- "typecheck": "tsc --noEmit",
35
- "test": "vitest",
36
- "lint": "eslint .",
37
- "check": "npm run typecheck && npm run lint",
38
- "prepare": "npm run typegen && npm run build",
39
- "inspect": "npx @eslint/config-inspector"
40
- },
41
29
  "peerDependencies": {
42
- "@nuxt/eslint-plugin": "catalog:plugin",
30
+ "@nuxt/eslint-plugin": "*",
31
+ "@unocss/eslint-plugin": "*",
43
32
  "eslint": ">=9.10.0"
44
33
  },
45
34
  "peerDependenciesMeta": {
46
35
  "@nuxt/eslint-plugin": {
47
36
  "optional": true
37
+ },
38
+ "@unocss/eslint-plugin": {
39
+ "optional": true
48
40
  }
49
41
  },
50
42
  "dependencies": {
51
- "@antfu/eslint-config": "catalog:main",
52
- "ansis": "catalog:cli",
53
- "cac": "catalog:cli",
54
- "eslint-flat-config-utils": "catalog:main",
55
- "eslint-plugin-de-morgan": "catalog:plugin",
56
- "local-pkg": "catalog:main"
43
+ "@antfu/eslint-config": "^5.2.1",
44
+ "ansis": "^4.1.0",
45
+ "cac": "^6.7.14",
46
+ "eslint-flat-config-utils": "^2.1.1",
47
+ "eslint-plugin-de-morgan": "^1.3.1",
48
+ "local-pkg": "^1.1.2"
57
49
  },
58
50
  "devDependencies": {
59
- "@types/node": "catalog:dev",
60
- "eslint": "catalog:dev",
61
- "eslint-typegen": "catalog:dev",
62
- "husky": "catalog:dev",
63
- "nano-staged": "catalog:dev",
64
- "tsdown": "catalog:dev",
65
- "tsx": "catalog:dev",
66
- "typescript": "catalog:dev",
67
- "vitest": "catalog:test"
51
+ "@types/node": "^24.3.0",
52
+ "eslint": "^9.33.0",
53
+ "eslint-typegen": "^2.3.0",
54
+ "husky": "^9.1.7",
55
+ "nano-staged": "^0.8.0",
56
+ "tsdown": "^0.14.1",
57
+ "tsx": "^4.20.4",
58
+ "typescript": "^5.9.2",
59
+ "vitest": "^3.2.4"
68
60
  },
69
61
  "nano-staged": {
70
62
  "*": "eslint --fix"
63
+ },
64
+ "scripts": {
65
+ "dev": "tsdown --watch",
66
+ "build": "tsdown",
67
+ "typegen": "tsx scripts/typegen",
68
+ "typecheck": "tsc --noEmit",
69
+ "test": "vitest",
70
+ "lint": "eslint .",
71
+ "check": "npm run typecheck && npm run lint",
72
+ "inspect": "npx @eslint/config-inspector --config eslint-inspector.config.ts"
71
73
  }
72
- }
74
+ }