@phaicom/eslint-config 0.1.3 → 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/README.md +8 -2
- package/dist/index.d.ts +5 -1
- package/dist/index.js +33 -31
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,8 +8,14 @@ phaicom's ESLint configuration.
|
|
|
8
8
|
- Modified rules including unicorn, stylistic, Vue, etc.
|
|
9
9
|
- Integrated with [eslint-plugin-readable-tailwind](https://github.com/schoero/eslint-plugin-readable-tailwind).
|
|
10
10
|
|
|
11
|
-
## Usage
|
|
12
|
-
|
|
11
|
+
## Usage with tailwind
|
|
12
|
+
Start by install **eslint-plugin-readable-tailwind**
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pnpm install -D eslint-plugin-readable-tailwind@beta
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
And set the **tailwind** flag to true.
|
|
13
19
|
|
|
14
20
|
```js
|
|
15
21
|
import phaicom from '@phaicom/eslint-config'
|
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
|
|
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
|
|
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/
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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":
|
|
65
|
+
"readable-tailwind": pluginTailwind
|
|
73
66
|
},
|
|
74
67
|
rules: {
|
|
75
68
|
// enable all recommended rules to error
|
|
76
|
-
...
|
|
69
|
+
...pluginTailwind.configs.error.rules
|
|
77
70
|
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
const userConfigs = [
|
|
81
|
-
baseConfig,
|
|
82
|
-
...options.vue ? [vueConfig] : []
|
|
71
|
+
}
|
|
83
72
|
];
|
|
84
|
-
|
|
85
|
-
|
|
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.
|
|
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",
|