@phaicom/eslint-config 0.1.4 → 0.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.
package/dist/index.d.ts CHANGED
@@ -4,7 +4,11 @@ type EslintConfigReturn = ReturnType<typeof antfu>;
4
4
  type UserConfigParams = Parameters<typeof antfu>[1];
5
5
  interface OptionsConfig extends OptionsConfig$1, TypedFlatConfigItem {
6
6
  /**
7
- *
7
+ * Used phaicom's base rules:
8
+ * @default true
9
+ */
10
+ phaicom?: boolean;
11
+ /**
8
12
  * Used recommended rules:
9
13
  * @see https://github.com/schoero/eslint-plugin-readable-tailwind
10
14
  * @default false
package/dist/index.js CHANGED
@@ -1,9 +1,8 @@
1
1
  // src/index.ts
2
2
  import antfu from "@antfu/eslint-config";
3
- import pluginReadableTailwind from "eslint-plugin-readable-tailwind";
4
3
 
5
- // src/base.ts
6
- var baseConfig = {
4
+ // src/configs/base.ts
5
+ var base = {
7
6
  name: "phaicom/base",
8
7
  rules: {
9
8
  "curly": ["error", "all"],
@@ -36,7 +35,7 @@ var baseConfig = {
36
35
  "node/prefer-global/process": "off"
37
36
  }
38
37
  };
39
- var vueConfig = {
38
+ var vue = {
40
39
  name: "phaicom/vue",
41
40
  rules: {
42
41
  // vue rule customizations
@@ -48,41 +47,44 @@ var vueConfig = {
48
47
  "vue/singleline-html-element-content-newline": "off"
49
48
  }
50
49
  };
50
+ var phaicom = { base, vue };
51
+ var base_default = phaicom;
51
52
 
52
- // src/index.ts
53
- var eslintConfig = ({ tailwind = false, ...options }, ...configs) => {
54
- if (tailwind) {
55
- const baseFiles = ["**/*.js"];
56
- const frameworkExtensions = {
57
- typescript: ["ts"],
58
- react: ["jsx", options.typescript && "tsx"],
59
- solid: ["jsx", options.typescript && "tsx"],
60
- vue: ["vue"],
61
- astro: ["astro"],
62
- svelte: ["svelte"]
63
- };
64
- const files = [
65
- ...baseFiles,
66
- ...Object.entries(frameworkExtensions).filter(([framework]) => options[framework]).flatMap(([, exts]) => exts.filter(Boolean).map((ext) => `**/*.${ext}`))
67
- ];
68
- configs.unshift({
53
+ // src/configs/tailwind.ts
54
+ import { interopDefault } from "@antfu/eslint-config";
55
+ async function tailwind() {
56
+ const [
57
+ pluginTailwind
58
+ ] = await Promise.all([
59
+ interopDefault(import("eslint-plugin-readable-tailwind"))
60
+ ]);
61
+ return [
62
+ {
69
63
  name: "phaicom/tailwind",
70
- files,
71
64
  plugins: {
72
- "readable-tailwind": pluginReadableTailwind
65
+ "readable-tailwind": pluginTailwind
73
66
  },
74
67
  rules: {
75
68
  // enable all recommended rules to error
76
- ...pluginReadableTailwind.configs.error.rules
69
+ ...pluginTailwind.configs.error.rules
77
70
  }
78
- });
79
- }
80
- const userConfigs = [
81
- baseConfig,
82
- ...options.vue ? [vueConfig] : []
71
+ }
83
72
  ];
84
- options.unicorn = true;
85
- return antfu(options, ...userConfigs, ...configs);
73
+ }
74
+
75
+ // src/index.ts
76
+ var eslintConfig = ({ phaicom: enablePhaicom = true, tailwind: enableTailwind = false, ...options }, ...configs) => {
77
+ if (enableTailwind) {
78
+ configs.push(tailwind());
79
+ }
80
+ if (enablePhaicom) {
81
+ options.unicorn = true;
82
+ configs.push(base_default.base);
83
+ if (options.vue) {
84
+ configs.push(base_default.vue);
85
+ }
86
+ }
87
+ return antfu(options, ...configs);
86
88
  };
87
89
  var index_default = eslintConfig;
88
90
  export {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@phaicom/eslint-config",
3
3
  "type": "module",
4
- "version": "0.1.4",
4
+ "version": "0.2.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",