@wongxy/eslint-config 1.1.0 → 2.0.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
@@ -5,7 +5,7 @@ Personal ESLint configuration, based on `@antfu/eslint-config`
5
5
  ## Usage
6
6
 
7
7
  ```bash
8
- pnpm i -D eslint @antfu/eslint-config
8
+ pnpm i -D eslint @wongxy/eslint-config
9
9
  ```
10
10
 
11
11
  And create `eslint.config.mjs` in your project root:
package/dist/index.cjs CHANGED
@@ -29,12 +29,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
29
29
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
30
 
31
31
  // src/index.ts
32
- var src_exports = {};
33
- __export(src_exports, {
32
+ var index_exports = {};
33
+ __export(index_exports, {
34
34
  default: () => wongxy,
35
35
  tailwindcss: () => tailwindcss
36
36
  });
37
- module.exports = __toCommonJS(src_exports);
37
+ module.exports = __toCommonJS(index_exports);
38
38
  var import_eslint_config = require("@antfu/eslint-config");
39
39
  var import_local_pkg = require("local-pkg");
40
40
 
@@ -75,10 +75,11 @@ var types_exports = {};
75
75
  __reExport(types_exports, require("@antfu/eslint-config"));
76
76
 
77
77
  // src/index.ts
78
- __reExport(src_exports, types_exports, module.exports);
78
+ __reExport(index_exports, types_exports, module.exports);
79
79
  var VuePackages = ["vue", "nuxt", "vitepress", "@slidev/cli"];
80
80
  var ReactPackages = ["react", "react-native", "react-dom", "next"];
81
- function wongxy(options = {}, ...userConfigs) {
81
+ function wongxy(options, ...userConfigs) {
82
+ options = options ?? {};
82
83
  const finalOptions = {
83
84
  ...options,
84
85
  vue: options.vue ?? VuePackages.some((i) => (0, import_local_pkg.isPackageExists)(i)),
@@ -87,16 +88,18 @@ function wongxy(options = {}, ...userConfigs) {
87
88
  reactnative: options.reactnative ?? (0, import_local_pkg.isPackageExists)("react-native"),
88
89
  tailwindcss: options.tailwindcss ?? (0, import_local_pkg.isPackageExists)("tailwindcss")
89
90
  };
90
- finalOptions.rules = {
91
+ const rules = {
91
92
  "no-console": "off",
92
93
  "no-alert": "off",
93
94
  "no-multiple-empty-lines": "warn",
94
95
  "antfu/top-level-function": "off",
95
96
  "antfu/if-newline": "off",
96
- "import/order": ["error", { "newlines-between": "always" }],
97
- "style/brace-style": ["error", "1tbs", { allowSingleLine: true }],
98
- ...finalOptions.rules
97
+ // 'import/order': ['error', { 'newlines-between': 'always' }],
98
+ "style/brace-style": ["error", "1tbs", { allowSingleLine: true }]
99
99
  };
100
+ for (const key in finalOptions.rules)
101
+ delete rules[key];
102
+ userConfigs.splice(0, 0, { name: "wongxy/rules", rules });
100
103
  if (finalOptions.vue) {
101
104
  const vue = typeof finalOptions.vue === "object" ? finalOptions.vue : {};
102
105
  finalOptions.vue = {
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Linter } from 'eslint';
2
2
  import { FlatConfigComposer } from 'eslint-flat-config-utils';
3
- import { ConfigNames as ConfigNames$2, TypedFlatConfigItem as TypedFlatConfigItem$1, OptionsConfig as OptionsConfig$1, Awaitable } from '@antfu/eslint-config';
3
+ import { OptionsConfig as OptionsConfig$1, TypedFlatConfigItem as TypedFlatConfigItem$1, Rules as Rules$1, ConfigNames as ConfigNames$2, OptionsOverrides as OptionsOverrides$1, Awaitable } from '@antfu/eslint-config';
4
4
  export * from '@antfu/eslint-config';
5
5
 
6
6
  /* eslint-disable */
@@ -143,7 +143,13 @@ interface OptionsOverrides {
143
143
  }
144
144
  type ConfigNames = ConfigNames$2 & ConfigNames$1;
145
145
  type TypedFlatConfigItem = TypedFlatConfigItem$1 & MyTypedFlatConfigItem;
146
- type MyTypedFlatConfigItem = Omit<Linter.Config<Linter.RulesRecord & RuleOptions>, 'plugins'>;
146
+ interface MyRules extends RuleOptions {
147
+ }
148
+ interface Rules extends MyRules, Rules$1 {
149
+ }
150
+ type MyTypedFlatConfigItem = Omit<Linter.Config<Linter.RulesRecord & Rules>, 'plugins'> & {
151
+ plugins?: Record<string, any>;
152
+ };
147
153
  interface OptionsConfig extends OptionsConfig$1 {
148
154
  /**
149
155
  * Enable Tailwind rules.
@@ -167,8 +173,8 @@ interface OptionsConfig extends OptionsConfig$1 {
167
173
  react?: boolean | OptionsOverrides;
168
174
  }
169
175
 
170
- declare function tailwindcss(options?: OptionsOverrides): Promise<TypedFlatConfigItem$1[]>;
176
+ declare function tailwindcss(options?: OptionsOverrides$1): Promise<TypedFlatConfigItem$1[]>;
171
177
 
172
- declare function wongxy(options?: OptionsConfig & TypedFlatConfigItem, ...userConfigs: Awaitable<TypedFlatConfigItem | TypedFlatConfigItem[] | FlatConfigComposer<any, any> | Linter.Config[]>[]): FlatConfigComposer<TypedFlatConfigItem, ConfigNames>;
178
+ declare function wongxy(options?: OptionsConfig & Omit<TypedFlatConfigItem, 'files'>, ...userConfigs: Awaitable<TypedFlatConfigItem | TypedFlatConfigItem[] | FlatConfigComposer<any, any> | Linter.Config[]>[]): FlatConfigComposer<TypedFlatConfigItem, ConfigNames>;
173
179
 
174
- export { type ConfigNames, type MyTypedFlatConfigItem, type OptionsConfig, type OptionsOverrides, type TypedFlatConfigItem, wongxy as default, tailwindcss };
180
+ export { type ConfigNames, type MyTypedFlatConfigItem, type OptionsConfig, type TypedFlatConfigItem, wongxy as default, tailwindcss };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Linter } from 'eslint';
2
2
  import { FlatConfigComposer } from 'eslint-flat-config-utils';
3
- import { ConfigNames as ConfigNames$2, TypedFlatConfigItem as TypedFlatConfigItem$1, OptionsConfig as OptionsConfig$1, Awaitable } from '@antfu/eslint-config';
3
+ import { OptionsConfig as OptionsConfig$1, TypedFlatConfigItem as TypedFlatConfigItem$1, Rules as Rules$1, ConfigNames as ConfigNames$2, OptionsOverrides as OptionsOverrides$1, Awaitable } from '@antfu/eslint-config';
4
4
  export * from '@antfu/eslint-config';
5
5
 
6
6
  /* eslint-disable */
@@ -143,7 +143,13 @@ interface OptionsOverrides {
143
143
  }
144
144
  type ConfigNames = ConfigNames$2 & ConfigNames$1;
145
145
  type TypedFlatConfigItem = TypedFlatConfigItem$1 & MyTypedFlatConfigItem;
146
- type MyTypedFlatConfigItem = Omit<Linter.Config<Linter.RulesRecord & RuleOptions>, 'plugins'>;
146
+ interface MyRules extends RuleOptions {
147
+ }
148
+ interface Rules extends MyRules, Rules$1 {
149
+ }
150
+ type MyTypedFlatConfigItem = Omit<Linter.Config<Linter.RulesRecord & Rules>, 'plugins'> & {
151
+ plugins?: Record<string, any>;
152
+ };
147
153
  interface OptionsConfig extends OptionsConfig$1 {
148
154
  /**
149
155
  * Enable Tailwind rules.
@@ -167,8 +173,8 @@ interface OptionsConfig extends OptionsConfig$1 {
167
173
  react?: boolean | OptionsOverrides;
168
174
  }
169
175
 
170
- declare function tailwindcss(options?: OptionsOverrides): Promise<TypedFlatConfigItem$1[]>;
176
+ declare function tailwindcss(options?: OptionsOverrides$1): Promise<TypedFlatConfigItem$1[]>;
171
177
 
172
- declare function wongxy(options?: OptionsConfig & TypedFlatConfigItem, ...userConfigs: Awaitable<TypedFlatConfigItem | TypedFlatConfigItem[] | FlatConfigComposer<any, any> | Linter.Config[]>[]): FlatConfigComposer<TypedFlatConfigItem, ConfigNames>;
178
+ declare function wongxy(options?: OptionsConfig & Omit<TypedFlatConfigItem, 'files'>, ...userConfigs: Awaitable<TypedFlatConfigItem | TypedFlatConfigItem[] | FlatConfigComposer<any, any> | Linter.Config[]>[]): FlatConfigComposer<TypedFlatConfigItem, ConfigNames>;
173
179
 
174
- export { type ConfigNames, type MyTypedFlatConfigItem, type OptionsConfig, type OptionsOverrides, type TypedFlatConfigItem, wongxy as default, tailwindcss };
180
+ export { type ConfigNames, type MyTypedFlatConfigItem, type OptionsConfig, type TypedFlatConfigItem, wongxy as default, tailwindcss };
package/dist/index.js CHANGED
@@ -17,8 +17,8 @@ var __copyProps = (to, from, except, desc) => {
17
17
  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
18
18
 
19
19
  // src/index.ts
20
- var src_exports = {};
21
- __export(src_exports, {
20
+ var index_exports = {};
21
+ __export(index_exports, {
22
22
  default: () => wongxy,
23
23
  tailwindcss: () => tailwindcss
24
24
  });
@@ -63,10 +63,11 @@ __reExport(types_exports, eslint_config_star);
63
63
  import * as eslint_config_star from "@antfu/eslint-config";
64
64
 
65
65
  // src/index.ts
66
- __reExport(src_exports, types_exports);
66
+ __reExport(index_exports, types_exports);
67
67
  var VuePackages = ["vue", "nuxt", "vitepress", "@slidev/cli"];
68
68
  var ReactPackages = ["react", "react-native", "react-dom", "next"];
69
- function wongxy(options = {}, ...userConfigs) {
69
+ function wongxy(options, ...userConfigs) {
70
+ options = options ?? {};
70
71
  const finalOptions = {
71
72
  ...options,
72
73
  vue: options.vue ?? VuePackages.some((i) => isPackageExists(i)),
@@ -75,16 +76,18 @@ function wongxy(options = {}, ...userConfigs) {
75
76
  reactnative: options.reactnative ?? isPackageExists("react-native"),
76
77
  tailwindcss: options.tailwindcss ?? isPackageExists("tailwindcss")
77
78
  };
78
- finalOptions.rules = {
79
+ const rules = {
79
80
  "no-console": "off",
80
81
  "no-alert": "off",
81
82
  "no-multiple-empty-lines": "warn",
82
83
  "antfu/top-level-function": "off",
83
84
  "antfu/if-newline": "off",
84
- "import/order": ["error", { "newlines-between": "always" }],
85
- "style/brace-style": ["error", "1tbs", { allowSingleLine: true }],
86
- ...finalOptions.rules
85
+ // 'import/order': ['error', { 'newlines-between': 'always' }],
86
+ "style/brace-style": ["error", "1tbs", { allowSingleLine: true }]
87
87
  };
88
+ for (const key in finalOptions.rules)
89
+ delete rules[key];
90
+ userConfigs.splice(0, 0, { name: "wongxy/rules", rules });
88
91
  if (finalOptions.vue) {
89
92
  const vue = typeof finalOptions.vue === "object" ? finalOptions.vue : {};
90
93
  finalOptions.vue = {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wongxy/eslint-config",
3
3
  "type": "module",
4
- "version": "1.1.0",
4
+ "version": "2.0.0",
5
5
  "description": "xiyaowong's eslint config",
6
6
  "author": "xiyaowong (https://github.com/xiyaowong)",
7
7
  "license": "MIT",
@@ -16,26 +16,26 @@
16
16
  "dist"
17
17
  ],
18
18
  "peerDependencies": {
19
- "@eslint-react/eslint-plugin": "^1.5.8",
20
- "@unocss/eslint-plugin": ">=0.50.0",
21
- "eslint": ">=8.40.0",
22
- "eslint-plugin-react-hooks": "^4.6.0",
23
- "eslint-plugin-react-refresh": "^0.4.4",
24
- "eslint-plugin-tailwindcss": ">=3.17.4"
19
+ "@eslint-react/eslint-plugin": "^1.49.0",
20
+ "@unocss/eslint-plugin": "^66.1.2",
21
+ "eslint": "^9.27.0",
22
+ "eslint-plugin-react-hooks": "^5.2.0",
23
+ "eslint-plugin-react-refresh": "^0.4.20",
24
+ "eslint-plugin-tailwindcss": ">=3.18.0"
25
25
  },
26
26
  "dependencies": {
27
- "@antfu/eslint-config": "^2.24.1",
28
- "local-pkg": "^0.5.0"
27
+ "@antfu/eslint-config": "^4.13.2",
28
+ "local-pkg": "^1.1.1"
29
29
  },
30
30
  "devDependencies": {
31
- "@types/eslint": "^9.6.0",
32
- "@types/node": "^22.2.0",
33
- "bumpp": "^9.4.2",
34
- "eslint": "^9.8.0",
35
- "eslint-flat-config-viewer": "^0.1.20",
36
- "eslint-typegen": "^0.3.0",
37
- "esno": "^4.7.0",
38
- "tsup": "^8.2.4",
31
+ "@types/eslint": "^9.6.1",
32
+ "@types/eslint-plugin-tailwindcss": "3.17.0",
33
+ "@types/node": "^22.15.21",
34
+ "bumpp": "^10.1.1",
35
+ "eslint": "^9.27.0",
36
+ "eslint-typegen": "^2.2.0",
37
+ "esno": "^4.8.0",
38
+ "tsup": "^8.5.0",
39
39
  "typescript": "5.4.5"
40
40
  },
41
41
  "scripts": {
@@ -45,7 +45,7 @@
45
45
  "lint": "pnpm run stub && eslint .",
46
46
  "lint:fix": "pnpm run stub && eslint . --fix",
47
47
  "release": "bumpp && pnpm publish",
48
- "preview": "eslint-flat-config-viewer",
48
+ "inspect": "pnpm build && npx @eslint/config-inspector",
49
49
  "typegen": "esno scripts/typegen.ts",
50
50
  "typecheck": "tsc --noEmit"
51
51
  }