@vida0905/eslint-config 2.1.1 → 2.2.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.
@@ -1,2 +1 @@
1
-
2
- export { }
1
+ export { };
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.1.1";
9
+ var version = "2.2.0";
10
10
 
11
11
  //#endregion
12
12
  //#region src/cli/constants.ts
@@ -63,7 +63,7 @@ const vscodeSettingsString = `
63
63
  `;
64
64
 
65
65
  //#endregion
66
- //#region src/cli/update-vscode-settings.ts
66
+ //#region src/cli/update/update-vscode-settings.ts
67
67
  async function updateVSCodeSettings() {
68
68
  const cwd = process.cwd();
69
69
  const dotVscodePath = path.join(cwd, ".vscode");
@@ -83,17 +83,17 @@ async function updateVSCodeSettings() {
83
83
  }
84
84
 
85
85
  //#endregion
86
- //#region src/cli/run.ts
87
- async function run(options = {}) {
88
- if (options.vscode) await updateVSCodeSettings();
86
+ //#region src/cli/update/index.ts
87
+ async function update(files = []) {
88
+ if (files.includes("vscode")) await updateVSCodeSettings();
89
89
  }
90
90
 
91
91
  //#endregion
92
92
  //#region src/cli/index.ts
93
93
  const cli = cac("@vida0905/eslint-config");
94
- cli.command("update", "update configuration files").option("--vscode", "Update .vscode/settings.json").action(async (args) => {
94
+ cli.command("update [...files]", "Update configuration files for specified files").alias("up").option("vscode", "Update .vscode/settings.json").action(async (files) => {
95
95
  try {
96
- await run(args);
96
+ await update(files);
97
97
  } catch (error) {
98
98
  console.error(`✘ ${String(error)}`);
99
99
  process.exit(1);
package/dist/index.d.ts CHANGED
@@ -1,84 +1,92 @@
1
- import { OptionsConfig as OptionsConfig$1, TypedFlatConfigItem as TypedFlatConfigItem$1, ConfigNames } from '@antfu/eslint-config';
2
- export * from '@antfu/eslint-config';
3
- import { FlatConfigComposer } from 'eslint-flat-config-utils';
4
- import { Linter } from 'eslint';
1
+ import { ConfigNames, OptionsConfig, TypedFlatConfigItem } from "@antfu/eslint-config";
2
+ import { FlatConfigComposer } from "eslint-flat-config-utils";
3
+ import { Linter } from "eslint";
4
+ export * from "@antfu/eslint-config";
5
5
 
6
+ //#region src/typegen.d.ts
6
7
  interface RuleOptions {
7
- /**
8
- * Transforms the negation of a conjunction !(A && B) into the equivalent !A || !B according to De Morgan’s law
9
- * @see https://github.com/azat-io/eslint-plugin-de-morgan/blob/main/docs/no-negated-conjunction.md
10
- */
11
- "de-morgan/no-negated-conjunction"?: Linter.RuleEntry<[]>;
12
- /**
13
- * Transforms the negation of a disjunction !(A || B) into the equivalent !A && !B according to De Morgan’s law
14
- * @see https://github.com/azat-io/eslint-plugin-de-morgan/blob/main/docs/no-negated-disjunction.md
15
- */
16
- "de-morgan/no-negated-disjunction"?: Linter.RuleEntry<[]>;
17
- /**
18
- * Never export an initialized named or default store.
19
- * @see https://github.com/lisilinhart/eslint-plugin-pinia/blob/main/docs/rules/never-export-initialized-store.md
20
- */
21
- "pinia/never-export-initialized-store"?: Linter.RuleEntry<[]>;
22
- /**
23
- * Disallow duplicate store ids.
24
- * @see https://github.com/lisilinhart/eslint-plugin-pinia/blob/main/docs/rules/no-duplicate-store-ids.md
25
- */
26
- "pinia/no-duplicate-store-ids"?: Linter.RuleEntry<[]>;
27
- /**
28
- * Disallows returning globally provided properties from Pinia stores.
29
- * @see https://github.com/lisilinhart/eslint-plugin-pinia/blob/main/docs/rules/no-return-global-properties.md
30
- */
31
- "pinia/no-return-global-properties"?: Linter.RuleEntry<[]>;
32
- /**
33
- * Disallow use of storeToRefs inside defineStore
34
- * @see https://github.com/lisilinhart/eslint-plugin-pinia/blob/main/docs/rules/no-store-to-refs-in-store.md
35
- */
36
- "pinia/no-store-to-refs-in-store"?: Linter.RuleEntry<[]>;
37
- /**
38
- * Encourages defining each store in a separate file.
39
- * @see https://github.com/lisilinhart/eslint-plugin-pinia/blob/main/docs/rules/prefer-single-store-per-file.md
40
- */
41
- "pinia/prefer-single-store-per-file"?: Linter.RuleEntry<[]>;
42
- /**
43
- * Enforces the convention of naming stores with the prefix `use` followed by the store name.
44
- * @see https://github.com/lisilinhart/eslint-plugin-pinia/blob/main/docs/rules/prefer-use-store-naming-convention.md
45
- */
46
- "pinia/prefer-use-store-naming-convention"?: Linter.RuleEntry<PiniaPreferUseStoreNamingConvention>;
47
- /**
48
- * In setup stores all state properties must be exported.
49
- * @see https://github.com/lisilinhart/eslint-plugin-pinia/blob/main/docs/rules/require-setup-store-properties-export.md
50
- */
51
- "pinia/require-setup-store-properties-export"?: Linter.RuleEntry<[]>;
8
+ /**
9
+ * Transforms the negation of a conjunction !(A && B) into the equivalent !A || !B according to De Morgan’s law
10
+ * @see https://github.com/azat-io/eslint-plugin-de-morgan/blob/main/docs/no-negated-conjunction.md
11
+ */
12
+ 'de-morgan/no-negated-conjunction'?: Linter.RuleEntry<[]>;
13
+ /**
14
+ * Transforms the negation of a disjunction !(A || B) into the equivalent !A && !B according to De Morgan’s law
15
+ * @see https://github.com/azat-io/eslint-plugin-de-morgan/blob/main/docs/no-negated-disjunction.md
16
+ */
17
+ 'de-morgan/no-negated-disjunction'?: Linter.RuleEntry<[]>;
18
+ /**
19
+ * Never export an initialized named or default store.
20
+ * @see https://github.com/lisilinhart/eslint-plugin-pinia/blob/main/docs/rules/never-export-initialized-store.md
21
+ */
22
+ 'pinia/never-export-initialized-store'?: Linter.RuleEntry<[]>;
23
+ /**
24
+ * Disallow duplicate store ids.
25
+ * @see https://github.com/lisilinhart/eslint-plugin-pinia/blob/main/docs/rules/no-duplicate-store-ids.md
26
+ */
27
+ 'pinia/no-duplicate-store-ids'?: Linter.RuleEntry<[]>;
28
+ /**
29
+ * Disallows returning globally provided properties from Pinia stores.
30
+ * @see https://github.com/lisilinhart/eslint-plugin-pinia/blob/main/docs/rules/no-return-global-properties.md
31
+ */
32
+ 'pinia/no-return-global-properties'?: Linter.RuleEntry<[]>;
33
+ /**
34
+ * Disallow use of storeToRefs inside defineStore
35
+ * @see https://github.com/lisilinhart/eslint-plugin-pinia/blob/main/docs/rules/no-store-to-refs-in-store.md
36
+ */
37
+ 'pinia/no-store-to-refs-in-store'?: Linter.RuleEntry<[]>;
38
+ /**
39
+ * Encourages defining each store in a separate file.
40
+ * @see https://github.com/lisilinhart/eslint-plugin-pinia/blob/main/docs/rules/prefer-single-store-per-file.md
41
+ */
42
+ 'pinia/prefer-single-store-per-file'?: Linter.RuleEntry<[]>;
43
+ /**
44
+ * Enforces the convention of naming stores with the prefix `use` followed by the store name.
45
+ * @see https://github.com/lisilinhart/eslint-plugin-pinia/blob/main/docs/rules/prefer-use-store-naming-convention.md
46
+ */
47
+ 'pinia/prefer-use-store-naming-convention'?: Linter.RuleEntry<PiniaPreferUseStoreNamingConvention>;
48
+ /**
49
+ * In setup stores all state properties must be exported.
50
+ * @see https://github.com/lisilinhart/eslint-plugin-pinia/blob/main/docs/rules/require-setup-store-properties-export.md
51
+ */
52
+ 'pinia/require-setup-store-properties-export'?: Linter.RuleEntry<[]>;
52
53
  }
54
+
55
+ /* ======= Declarations ======= */
56
+ // ----- pinia/prefer-use-store-naming-convention -----
53
57
  type PiniaPreferUseStoreNamingConvention = [] | [{
54
- checkStoreNameMismatch?: boolean
55
- storeSuffix?: string
56
- [k: string]: unknown | undefined
58
+ checkStoreNameMismatch?: boolean;
59
+ storeSuffix?: string;
60
+ [k: string]: unknown | undefined;
57
61
  }];
58
-
62
+ // Names of all the configs
63
+ //#endregion
64
+ //#region src/types.d.ts
59
65
  type Rules = RuleOptions;
60
- type TypedFlatConfigItem = Omit<Linter.Config<Linter.RulesRecord & Rules>, "plugins"> & {
61
- /**
62
- * 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.
63
- *
64
- * @see [Using plugins in your configuration](https://eslint.org/docs/latest/user-guide/configuring/configuration-files-new#using-plugins-in-your-configuration)
65
- */
66
- plugins?: Record<string, any>
66
+ type TypedFlatConfigItem$1 = Omit<Linter.Config<Linter.RulesRecord & Rules>, "plugins"> & {
67
+ /**
68
+ * 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.
69
+ *
70
+ * @see [Using plugins in your configuration](https://eslint.org/docs/latest/user-guide/configuring/configuration-files-new#using-plugins-in-your-configuration)
71
+ */
72
+ plugins?: Record<string, any>;
67
73
  };
68
74
  interface OptionsOverrides {
69
- overrides?: TypedFlatConfigItem["rules"];
75
+ overrides?: TypedFlatConfigItem$1["rules"];
70
76
  }
71
- type OptionsConfig = Omit<OptionsConfig$1, "overrides"> & {
72
- /**
73
- * Enable Pinia support.
74
- *
75
- * @default auto-detect based on the dependencies
76
- */
77
- pinia?: boolean | OptionsOverrides
77
+ type OptionsConfig$1 = Omit<OptionsConfig, "overrides"> & {
78
+ /**
79
+ * Enable Pinia support.
80
+ *
81
+ * @default auto-detect based on the dependencies
82
+ */
83
+ pinia?: boolean | OptionsOverrides;
78
84
  };
79
-
85
+ //#endregion
86
+ //#region src/utils.d.ts
80
87
  declare function deepMerge<T extends object>(target: T, source: T): T;
81
-
82
- declare function defineConfig(options?: OptionsConfig & TypedFlatConfigItem$1, ...userConfigs: TypedFlatConfigItem$1[]): FlatConfigComposer<TypedFlatConfigItem$1, ConfigNames>;
83
-
84
- export { deepMerge, defineConfig as default, defineConfig };
88
+ //#endregion
89
+ //#region src/index.d.ts
90
+ declare function defineConfig(options?: OptionsConfig$1 & TypedFlatConfigItem, ...userConfigs: TypedFlatConfigItem[]): FlatConfigComposer<TypedFlatConfigItem, ConfigNames>;
91
+ //#endregion
92
+ export { deepMerge, defineConfig as default, defineConfig };
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@vida0905/eslint-config",
3
3
  "type": "module",
4
- "version": "2.1.1",
5
- "packageManager": "pnpm@10.4.1",
4
+ "version": "2.2.0",
5
+ "packageManager": "pnpm@10.11.1",
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",
@@ -33,39 +33,45 @@
33
33
  "typegen": "tsx scripts/typegen",
34
34
  "typecheck": "tsc --noEmit",
35
35
  "lint": "eslint .",
36
- "lint:fix": "eslint . --fix",
37
- "prepack": "npm run build",
38
- "prepare": "npm run typegen && simple-git-hooks"
36
+ "check": "npm run typecheck && npm run lint",
37
+ "prepare": "npm run typegen && npm run build"
39
38
  },
40
39
  "peerDependencies": {
41
40
  "eslint": ">=9.10.0"
42
41
  },
43
42
  "dependencies": {
44
- "@antfu/eslint-config": "^4.3.0",
45
- "ansis": "^3.15.0",
43
+ "@antfu/eslint-config": "^4.13.3",
44
+ "ansis": "^4.1.0",
46
45
  "cac": "^6.7.14",
47
- "eslint-flat-config-utils": "^2.0.1",
48
- "eslint-import-resolver-oxc": "^0.11.0",
49
- "eslint-plugin-de-morgan": "^1.0.1",
46
+ "eslint-flat-config-utils": "^2.1.0",
47
+ "eslint-import-resolver-oxc": "^0.15.0",
48
+ "eslint-plugin-de-morgan": "^1.2.1",
50
49
  "eslint-plugin-pinia": "^0.4.1",
51
- "local-pkg": "^1.0.0"
50
+ "local-pkg": "^1.1.1"
52
51
  },
53
52
  "devDependencies": {
54
- "@eslint/config-inspector": "^1.0.0",
55
- "@types/node": "^22.13.4",
56
- "eslint": "^9.20.1",
57
- "eslint-typegen": "^2.0.0",
58
- "lint-staged": "^15.4.3",
59
- "oxc-transform": "^0.51.0",
60
- "simple-git-hooks": "^2.11.1",
61
- "tsdown": "^0.5.10",
62
- "tsx": "^4.19.2",
63
- "typescript": "^5.7.3"
53
+ "@types/node": "^22.15.30",
54
+ "eslint": "^9.28.0",
55
+ "eslint-typegen": "^2.2.0",
56
+ "nano-staged": "^0.8.0",
57
+ "simple-git-hooks": "^2.13.0",
58
+ "tsdown": "^0.12.7",
59
+ "tsx": "^4.19.4",
60
+ "typescript": "^5.8.3"
61
+ },
62
+ "pnpm": {
63
+ "overrides": {
64
+ "eslint-import-resolver-node": "-",
65
+ "unrs-resolver": "-"
66
+ },
67
+ "patchedDependencies": {
68
+ "eslint-plugin-import-x": "patches/eslint-plugin-import-x.patch"
69
+ }
64
70
  },
65
71
  "simple-git-hooks": {
66
- "pre-commit": "pnpm lint-staged"
72
+ "pre-commit": "npx nano-staged"
67
73
  },
68
- "lint-staged": {
74
+ "nano-staged": {
69
75
  "*": "eslint --fix"
70
76
  }
71
77
  }