@phaicom/eslint-config 0.10.4 → 0.11.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.
@@ -0,0 +1,25 @@
1
+ import antfu, { OptionsConfig, TypedFlatConfigItem } from "@antfu/eslint-config";
2
+
3
+ //#region src/types.d.ts
4
+ type EslintConfigReturn = ReturnType<typeof antfu>;
5
+ type UserConfigParams = Parameters<typeof antfu>[1];
6
+ interface OptionsConfig$1 extends Omit<OptionsConfig, 'ignores'>, Omit<TypedFlatConfigItem, 'ignores'> {
7
+ /**
8
+ * Used phaicom's base rules:
9
+ * @default true
10
+ */
11
+ phaicom?: boolean;
12
+ /**
13
+ * Used recommended rules:
14
+ * @see https://github.com/schoero/eslint-plugin-readable-tailwind
15
+ * @default false
16
+ */
17
+ tailwind?: boolean;
18
+ ignores?: string[];
19
+ }
20
+ type EslintConfig = (options: OptionsConfig$1, ...configs: UserConfigParams[]) => EslintConfigReturn;
21
+ //#endregion
22
+ //#region src/index.d.ts
23
+ declare const eslintConfig: EslintConfig;
24
+ //#endregion
25
+ export { eslintConfig as default };
package/dist/index.mjs ADDED
@@ -0,0 +1,57 @@
1
+ import antfu, { ensurePackages, interopDefault } from "@antfu/eslint-config";
2
+
3
+ //#region src/configs/base.ts
4
+ const phaicom = {
5
+ base: {
6
+ name: "phaicom/base",
7
+ rules: {
8
+ "curly": ["error", "all"],
9
+ "style/arrow-parens": ["error", "always"],
10
+ "style/function-call-spacing": ["error", "never"],
11
+ "unicorn/prevent-abbreviations": "off",
12
+ "unicorn/consistent-function-scoping": "off"
13
+ }
14
+ },
15
+ vue: {
16
+ name: "phaicom/vue",
17
+ rules: { "vue/max-attributes-per-line": ["error", {
18
+ singleline: { max: 10 },
19
+ multiline: { max: 1 }
20
+ }] }
21
+ }
22
+ };
23
+ var base_default = phaicom;
24
+
25
+ //#endregion
26
+ //#region src/configs/tailwind.ts
27
+ async function tailwind() {
28
+ await ensurePackages(["eslint-plugin-better-tailwindcss"]);
29
+ const [pluginTailwind] = await Promise.all([interopDefault(import("eslint-plugin-better-tailwindcss"))]);
30
+ return [{
31
+ name: "phaicom/tailwind",
32
+ plugins: { "better-tailwindcss": pluginTailwind },
33
+ rules: {
34
+ ...pluginTailwind.configs["recommended-error"].rules,
35
+ "better-tailwindcss/no-unknown-classes": "warn"
36
+ }
37
+ }];
38
+ }
39
+
40
+ //#endregion
41
+ //#region src/index.ts
42
+ const eslintConfig = (options, ...configs) => {
43
+ const { phaicom: enablePhaicom = true, tailwind: enableTailwind = false, vue: enableVue, rules: customRules = {} } = options;
44
+ const baseConfigs = [];
45
+ if (enableTailwind) baseConfigs.push(tailwind());
46
+ if (enablePhaicom) {
47
+ options.unicorn = true;
48
+ baseConfigs.push(base_default.base);
49
+ if (enableVue) baseConfigs.push(base_default.vue);
50
+ }
51
+ const { rules, ...restOptions } = options;
52
+ return antfu(restOptions, ...baseConfigs, { rules: customRules }, ...configs);
53
+ };
54
+ var src_default = eslintConfig;
55
+
56
+ //#endregion
57
+ export { src_default as default };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@phaicom/eslint-config",
3
3
  "type": "module",
4
- "version": "0.10.4",
4
+ "version": "0.11.0",
5
5
  "description": "Phaicom's config based on @antfu/eslint-config",
6
6
  "author": "Reawpai Chunsoi <reawpai.chunsoi@gmail.com> (https://github.com/phaicom)",
7
7
  "license": "MIT",
@@ -21,7 +21,7 @@
21
21
  "node": ">=22"
22
22
  },
23
23
  "peerDependencies": {
24
- "eslint-plugin-better-tailwindcss": ">=3.7.11"
24
+ "eslint-plugin-better-tailwindcss": ">=4.0.1"
25
25
  },
26
26
  "peerDependenciesMeta": {
27
27
  "eslint-plugin-better-tailwindcss": {
@@ -29,18 +29,19 @@
29
29
  }
30
30
  },
31
31
  "dependencies": {
32
- "@antfu/eslint-config": "^6.7.3",
32
+ "@antfu/eslint-config": "^7.0.1",
33
33
  "eslint": "^9.39.2"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@commitlint/cli": "^20.3.1",
37
37
  "@commitlint/config-conventional": "^20.3.1",
38
38
  "bumpp": "^10.4.0",
39
- "eslint-plugin-better-tailwindcss": "^3.8.0",
39
+ "eslint-plugin-better-tailwindcss": "^4.0.1",
40
40
  "eslint-plugin-format": "^1.3.1",
41
41
  "lint-staged": "^16.2.7",
42
42
  "simple-git-hooks": "^2.13.1",
43
- "tsup": "^8.5.1",
43
+ "tailwindcss": "^4.1.18",
44
+ "tsdown": "0.20.0-beta.3",
44
45
  "typescript": "^5.9.3"
45
46
  },
46
47
  "commitlint": {
@@ -56,11 +57,11 @@
56
57
  "*": "eslint --fix"
57
58
  },
58
59
  "scripts": {
59
- "build": "tsup --clean --dts",
60
- "stub": "tsup",
60
+ "build": "tsdown --clean --dts",
61
+ "stub": "tsdown",
61
62
  "dev": "npx @eslint/config-inspector --config eslint.config.ts",
62
63
  "build:inspector": "pnpm run build && npx @eslint/config-inspector build",
63
- "watch": "tsup --watch",
64
+ "watch": "tsdown --watch",
64
65
  "release": "bumpp && pnpm publish --access=public",
65
66
  "lint": "eslint . --cache",
66
67
  "lint:fix": "eslint . --fix --cache",
package/dist/index.d.ts DELETED
@@ -1,23 +0,0 @@
1
- import antfu, { OptionsConfig as OptionsConfig$1, TypedFlatConfigItem } from '@antfu/eslint-config';
2
-
3
- type EslintConfigReturn = ReturnType<typeof antfu>;
4
- type UserConfigParams = Parameters<typeof antfu>[1];
5
- interface OptionsConfig extends Omit<OptionsConfig$1, 'ignores'>, Omit<TypedFlatConfigItem, 'ignores'> {
6
- /**
7
- * Used phaicom's base rules:
8
- * @default true
9
- */
10
- phaicom?: boolean;
11
- /**
12
- * Used recommended rules:
13
- * @see https://github.com/schoero/eslint-plugin-readable-tailwind
14
- * @default false
15
- */
16
- tailwind?: boolean;
17
- ignores?: string[];
18
- }
19
- type EslintConfig = (options: OptionsConfig, ...configs: UserConfigParams[]) => EslintConfigReturn;
20
-
21
- declare const eslintConfig: EslintConfig;
22
-
23
- export { eslintConfig as default };
package/dist/index.js DELETED
@@ -1,83 +0,0 @@
1
- // src/index.ts
2
- import antfu from "@antfu/eslint-config";
3
-
4
- // src/configs/base.ts
5
- var base = {
6
- name: "phaicom/base",
7
- rules: {
8
- "curly": ["error", "all"],
9
- // style rule customizations
10
- "style/arrow-parens": ["error", "always"],
11
- "style/function-call-spacing": ["error", "never"],
12
- // unicorn rule customizations
13
- "unicorn/prevent-abbreviations": "off",
14
- "unicorn/consistent-function-scoping": "off"
15
- }
16
- };
17
- var vue = {
18
- name: "phaicom/vue",
19
- rules: {
20
- // vue rule customizations
21
- "vue/max-attributes-per-line": ["error", {
22
- singleline: { max: 10 },
23
- multiline: { max: 1 }
24
- }]
25
- }
26
- };
27
- var phaicom = { base, vue };
28
- var base_default = phaicom;
29
-
30
- // src/configs/tailwind.ts
31
- import { interopDefault } from "@antfu/eslint-config";
32
- async function tailwind() {
33
- const [
34
- pluginTailwind
35
- ] = await Promise.all([
36
- interopDefault(import("eslint-plugin-better-tailwindcss"))
37
- ]);
38
- return [
39
- {
40
- name: "phaicom/tailwind",
41
- plugins: {
42
- "better-tailwindcss": pluginTailwind
43
- },
44
- rules: {
45
- // enable all recommended rules to error
46
- ...pluginTailwind.configs["recommended-error"].rules,
47
- "better-tailwindcss/no-unregistered-classes": "warn"
48
- }
49
- }
50
- ];
51
- }
52
-
53
- // src/index.ts
54
- var eslintConfig = (options, ...configs) => {
55
- const {
56
- phaicom: enablePhaicom = true,
57
- tailwind: enableTailwind = false,
58
- vue: enableVue,
59
- rules: customRules = {}
60
- } = options;
61
- const baseConfigs = [];
62
- if (enableTailwind) {
63
- baseConfigs.push(tailwind());
64
- }
65
- if (enablePhaicom) {
66
- options.unicorn = true;
67
- baseConfigs.push(base_default.base);
68
- if (enableVue) {
69
- baseConfigs.push(base_default.vue);
70
- }
71
- }
72
- const { rules, ...restOptions } = options;
73
- return antfu(
74
- restOptions,
75
- ...baseConfigs,
76
- { rules: customRules },
77
- ...configs
78
- );
79
- };
80
- var index_default = eslintConfig;
81
- export {
82
- index_default as default
83
- };