@vida0905/eslint-config 2.3.0 → 2.4.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/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.3.0";
9
+ var version = "2.4.1";
10
10
 
11
11
  //#endregion
12
12
  //#region src/cli/constants.ts
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ConfigNames, OptionsConfig, TypedFlatConfigItem } from "@antfu/eslint-config";
1
+ import { Awaitable, ConfigNames, OptionsConfig, 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";
@@ -15,6 +15,16 @@ interface RuleOptions {
15
15
  * @see https://github.com/azat-io/eslint-plugin-de-morgan/blob/main/docs/no-negated-disjunction.md
16
16
  */
17
17
  'de-morgan/no-negated-disjunction'?: Linter.RuleEntry<[]>;
18
+ /**
19
+ * Prefer recommended order of Nuxt config properties
20
+ * @see https://eslint.nuxt.com/packages/plugin#nuxtnuxt-config-keys-order
21
+ */
22
+ 'nuxt/nuxt-config-keys-order'?: Linter.RuleEntry<[]>;
23
+ /**
24
+ * Prefer using `import.meta.*` over `process.*`
25
+ * @see https://eslint.nuxt.com/packages/plugin#nuxtprefer-import-meta
26
+ */
27
+ 'nuxt/prefer-import-meta'?: Linter.RuleEntry<[]>;
18
28
  }
19
29
 
20
30
  /* ======= Declarations ======= */
@@ -22,7 +32,7 @@ interface RuleOptions {
22
32
  // Names of all the configs
23
33
  //#endregion
24
34
  //#region src/types.d.ts
25
- type Rules = RuleOptions;
35
+ interface Rules extends RuleOptions {}
26
36
  type TypedFlatConfigItem$1 = Omit<Linter.Config<Linter.RulesRecord & Rules>, "plugins"> & {
27
37
  /**
28
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.
@@ -35,18 +45,14 @@ interface OptionsOverrides {
35
45
  overrides?: TypedFlatConfigItem$1["rules"];
36
46
  }
37
47
  type OptionsConfig$1 = Omit<OptionsConfig, "overrides"> & {
38
- /**
39
- * Enable Pinia support.
40
- *
41
- * @default auto-detect based on the dependencies
42
- */
43
- pinia?: boolean | OptionsOverrides;
48
+ deMorgan?: boolean | OptionsOverrides;
49
+ nuxt?: boolean | OptionsOverrides;
44
50
  };
45
51
  //#endregion
46
52
  //#region src/utils.d.ts
47
53
  declare function deepMerge<T extends object>(target: T, source: T): T;
48
54
  //#endregion
49
55
  //#region src/index.d.ts
50
- declare function defineConfig(options?: OptionsConfig$1 & TypedFlatConfigItem, ...userConfigs: TypedFlatConfigItem[]): FlatConfigComposer<TypedFlatConfigItem, ConfigNames>;
56
+ declare function defineConfig(options?: OptionsConfig$1 & Omit<TypedFlatConfigItem, "files">, ...userConfigs: Awaitable<TypedFlatConfigItem>[]): FlatConfigComposer<TypedFlatConfigItem, ConfigNames>;
51
57
  //#endregion
52
58
  export { deepMerge, defineConfig as default, defineConfig };
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
- import antfu, { GLOB_SRC } from "@antfu/eslint-config";
2
- import _deMorgan from "eslint-plugin-de-morgan";
1
+ import antfu, { GLOB_SRC, ensurePackages, interopDefault } from "@antfu/eslint-config";
2
+ import { isPackageExists } from "local-pkg";
3
+ import pluginDeMorgan from "eslint-plugin-de-morgan";
3
4
 
4
5
  export * from "@antfu/eslint-config"
5
6
 
@@ -9,7 +10,24 @@ function deMorgan(options = {}) {
9
10
  return [{
10
11
  name: "vida/de-morgan/rules",
11
12
  files,
12
- ..._deMorgan.configs.recommended
13
+ ...pluginDeMorgan.configs.recommended
14
+ }];
15
+ }
16
+
17
+ //#endregion
18
+ //#region src/configs/nuxt.ts
19
+ async function nuxt(options = {}) {
20
+ const { files = [GLOB_SRC] } = options;
21
+ await ensurePackages(["@nuxt/eslint-plugin"]);
22
+ const pluginNuxt = await interopDefault(import("@nuxt/eslint-plugin"));
23
+ return [{
24
+ name: "vida/nuxt/rules",
25
+ files,
26
+ plugins: { nuxt: pluginNuxt },
27
+ rules: {
28
+ "nuxt/prefer-import-meta": "error",
29
+ "nuxt/nuxt-config-keys-order": "error"
30
+ }
13
31
  }];
14
32
  }
15
33
 
@@ -24,6 +42,14 @@ const javascript = {
24
42
  //#endregion
25
43
  //#region src/overrides/stylistic.ts
26
44
  const stylistic = {
45
+ "style/quotes": [
46
+ "error",
47
+ "single",
48
+ {
49
+ avoidEscape: true,
50
+ allowTemplateLiterals: "avoidEscape"
51
+ }
52
+ ],
27
53
  "style/arrow-parens": ["error", "always"],
28
54
  "style/brace-style": [
29
55
  "error",
@@ -32,19 +58,11 @@ const stylistic = {
32
58
  ]
33
59
  };
34
60
 
35
- //#endregion
36
- //#region src/overrides/vue.ts
37
- const vue = { "vue/max-attributes-per-line": ["error", {
38
- singleline: 5,
39
- multiline: 1
40
- }] };
41
-
42
61
  //#endregion
43
62
  //#region src/overrides/index.ts
44
63
  const overrides = {
45
64
  javascript,
46
- stylistic,
47
- vue
65
+ stylistic
48
66
  };
49
67
 
50
68
  //#endregion
@@ -59,6 +77,7 @@ function deepMerge(target, source) {
59
77
  //#region src/index.ts
60
78
  function defineConfig(options = {}, ...userConfigs) {
61
79
  const configs = [deMorgan()];
80
+ if (isPackageExists("nuxt")) configs.push(nuxt());
62
81
  const antfuConfig = {
63
82
  stylistic: {
64
83
  indent: 2,
@@ -66,8 +85,7 @@ function defineConfig(options = {}, ...userConfigs) {
66
85
  semi: false,
67
86
  overrides: overrides.stylistic
68
87
  },
69
- javascript: { overrides: overrides.javascript },
70
- vue: { overrides: overrides.vue }
88
+ javascript: { overrides: overrides.javascript }
71
89
  };
72
90
  return antfu(deepMerge(antfuConfig, options), ...configs, ...userConfigs);
73
91
  }
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "@vida0905/eslint-config",
3
3
  "type": "module",
4
- "version": "2.3.0",
5
- "packageManager": "pnpm@10.11.1",
4
+ "version": "2.4.1",
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,33 +26,31 @@
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
- "lint": "eslint .",
36
- "check": "npm run typecheck && npm run lint",
37
- "prepare": "npm run typegen && npm run build"
38
- },
39
29
  "peerDependencies": {
30
+ "@nuxt/eslint-plugin": "*",
40
31
  "eslint": ">=9.10.0"
41
32
  },
33
+ "peerDependenciesMeta": {
34
+ "@nuxt/eslint-plugin": {
35
+ "optional": true
36
+ }
37
+ },
42
38
  "dependencies": {
43
39
  "@antfu/eslint-config": "^4.14.1",
44
40
  "ansis": "^4.1.0",
45
41
  "cac": "^6.7.14",
46
42
  "eslint-flat-config-utils": "^2.1.0",
47
- "eslint-plugin-de-morgan": "^1.2.1"
43
+ "eslint-plugin-de-morgan": "^1.3.0",
44
+ "local-pkg": "^1.1.1"
48
45
  },
49
46
  "devDependencies": {
50
- "@types/node": "^22.15.30",
47
+ "@types/node": "^24.0.1",
51
48
  "eslint": "^9.28.0",
52
49
  "eslint-typegen": "^2.2.0",
53
50
  "nano-staged": "^0.8.0",
54
51
  "simple-git-hooks": "^2.13.0",
55
52
  "tsdown": "^0.12.7",
56
- "tsx": "^4.19.4",
53
+ "tsx": "^4.20.1",
57
54
  "typescript": "^5.8.3"
58
55
  },
59
56
  "simple-git-hooks": {
@@ -61,5 +58,13 @@
61
58
  },
62
59
  "nano-staged": {
63
60
  "*": "eslint --fix"
61
+ },
62
+ "scripts": {
63
+ "dev": "tsdown --watch",
64
+ "build": "tsdown",
65
+ "typegen": "tsx scripts/typegen",
66
+ "typecheck": "tsc --noEmit",
67
+ "lint": "eslint .",
68
+ "check": "npm run typecheck && npm run lint"
64
69
  }
65
- }
70
+ }
@@ -1 +0,0 @@
1
- export { };