@phaicom/eslint-config 0.2.0 → 0.2.2
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 +102 -13
- package/dist/index.js +7 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,27 +1,116 @@
|
|
|
1
1
|
# `@phaicom/eslint-config`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Personal ESLint configuration preset.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
-
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
5
|
+
✨ Features:
|
|
6
|
+
- Built on [antfu/eslint-config](https://github.com/antfu/eslint-config)
|
|
7
|
+
- Enforces curly brackets for all blocks
|
|
8
|
+
- Custom rule sets for unicorn, stylistic, and Vue
|
|
9
|
+
- Tailwind support with [eslint-plugin-readable-tailwind](https://github.com/schoero/eslint-plugin-readable-tailwind)
|
|
10
10
|
|
|
11
|
-
## Usage
|
|
12
|
-
Start by install **eslint-plugin-readable-tailwind**
|
|
11
|
+
## Usage
|
|
13
12
|
|
|
13
|
+
1. Install the package:
|
|
14
14
|
```bash
|
|
15
|
-
pnpm
|
|
15
|
+
pnpm i -D @phaicom/eslint-config
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
2. Create `eslint.config.mjs` in your project root:
|
|
19
|
+
```js
|
|
20
|
+
// eslint.config.mjs
|
|
21
|
+
import configs from '@phaicom/eslint-config'
|
|
22
|
+
|
|
23
|
+
export default configs()
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
3. Configure VS Code:
|
|
27
|
+
- Install [VS Code ESLint extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
|
|
28
|
+
- Add the following settings to `.vscode/settings.json`:
|
|
29
|
+
|
|
30
|
+
```jsonc
|
|
31
|
+
{
|
|
32
|
+
// Disable the default formatter, use eslint instead
|
|
33
|
+
"prettier.enable": false,
|
|
34
|
+
"editor.formatOnSave": false,
|
|
35
|
+
|
|
36
|
+
// Auto fix
|
|
37
|
+
"editor.codeActionsOnSave": {
|
|
38
|
+
"source.fixAll.eslint": "explicit",
|
|
39
|
+
"source.organizeImports": "never"
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
// Silent the stylistic rules in you IDE, but still auto fix them
|
|
43
|
+
"eslint.rules.customizations": [
|
|
44
|
+
{ "rule": "style/*", "severity": "off", "fixable": true },
|
|
45
|
+
{ "rule": "format/*", "severity": "off", "fixable": true },
|
|
46
|
+
{ "rule": "*-indent", "severity": "off", "fixable": true },
|
|
47
|
+
{ "rule": "*-spacing", "severity": "off", "fixable": true },
|
|
48
|
+
{ "rule": "*-spaces", "severity": "off", "fixable": true },
|
|
49
|
+
{ "rule": "*-order", "severity": "off", "fixable": true },
|
|
50
|
+
{ "rule": "*-dangle", "severity": "off", "fixable": true },
|
|
51
|
+
{ "rule": "*-newline", "severity": "off", "fixable": true },
|
|
52
|
+
{ "rule": "*quotes", "severity": "off", "fixable": true },
|
|
53
|
+
{ "rule": "*semi", "severity": "off", "fixable": true }
|
|
54
|
+
],
|
|
55
|
+
|
|
56
|
+
// Enable eslint for all supported languages
|
|
57
|
+
"eslint.validate": [
|
|
58
|
+
"javascript",
|
|
59
|
+
"javascriptreact",
|
|
60
|
+
"typescript",
|
|
61
|
+
"typescriptreact",
|
|
62
|
+
"vue",
|
|
63
|
+
"html",
|
|
64
|
+
"markdown",
|
|
65
|
+
"json",
|
|
66
|
+
"jsonc",
|
|
67
|
+
"yaml",
|
|
68
|
+
"toml",
|
|
69
|
+
"xml",
|
|
70
|
+
"gql",
|
|
71
|
+
"graphql",
|
|
72
|
+
"astro",
|
|
73
|
+
"svelte",
|
|
74
|
+
"css",
|
|
75
|
+
"less",
|
|
76
|
+
"scss",
|
|
77
|
+
"pcss",
|
|
78
|
+
"postcss"
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Disable base rules
|
|
84
|
+
You can disable the base rules by setting `phaicom: false`:
|
|
19
85
|
|
|
20
86
|
```js
|
|
21
|
-
|
|
87
|
+
// eslint.config.mjs
|
|
88
|
+
import configs from '@phaicom/eslint-config'
|
|
22
89
|
|
|
23
|
-
export default
|
|
90
|
+
export default configs({
|
|
91
|
+
phaicom: false,
|
|
92
|
+
})
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Tailwind Support
|
|
96
|
+
To enable Tailwind support and enforce consistent class ordering:
|
|
97
|
+
|
|
98
|
+
1. Install the required plugin:
|
|
99
|
+
```bash
|
|
100
|
+
pnpm i -D eslint-plugin-readable-tailwind@beta
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
2. Enable Tailwind support in your config:
|
|
104
|
+
```js
|
|
105
|
+
// eslint.config.mjs
|
|
106
|
+
import configs from '@phaicom/eslint-config'
|
|
107
|
+
|
|
108
|
+
export default configs({
|
|
24
109
|
tailwind: true,
|
|
25
110
|
})
|
|
26
111
|
```
|
|
27
|
-
|
|
112
|
+
|
|
113
|
+
This will enforce consistent ordering of Tailwind classes for better readability.
|
|
114
|
+
## Additional Configurations
|
|
115
|
+
|
|
116
|
+
For other configuration options like TypeScript, Vue, React, Prettier, and more, please refer to [antfu/eslint-config](https://github.com/antfu/eslint-config).
|
package/dist/index.js
CHANGED
|
@@ -73,14 +73,19 @@ async function tailwind() {
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
// src/index.ts
|
|
76
|
-
var eslintConfig = (
|
|
76
|
+
var eslintConfig = (options, ...configs) => {
|
|
77
|
+
const {
|
|
78
|
+
phaicom: enablePhaicom = true,
|
|
79
|
+
tailwind: enableTailwind = false,
|
|
80
|
+
vue: enableVue
|
|
81
|
+
} = options;
|
|
77
82
|
if (enableTailwind) {
|
|
78
83
|
configs.push(tailwind());
|
|
79
84
|
}
|
|
80
85
|
if (enablePhaicom) {
|
|
81
86
|
options.unicorn = true;
|
|
82
87
|
configs.push(base_default.base);
|
|
83
|
-
if (
|
|
88
|
+
if (enableVue) {
|
|
84
89
|
configs.push(base_default.vue);
|
|
85
90
|
}
|
|
86
91
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phaicom/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.2",
|
|
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",
|
|
@@ -37,11 +37,11 @@
|
|
|
37
37
|
"@commitlint/config-conventional": "^19.6.0",
|
|
38
38
|
"bumpp": "^10.0.1",
|
|
39
39
|
"eslint-plugin-format": "^1.0.1",
|
|
40
|
+
"eslint-plugin-readable-tailwind": "^2.0.0-beta.1",
|
|
40
41
|
"lint-staged": "^15.4.3",
|
|
41
42
|
"simple-git-hooks": "^2.11.1",
|
|
42
43
|
"tsup": "^8.3.6",
|
|
43
|
-
"typescript": "^5.7.3"
|
|
44
|
-
"eslint-plugin-readable-tailwind": "2.0.0-beta.0"
|
|
44
|
+
"typescript": "^5.7.3"
|
|
45
45
|
},
|
|
46
46
|
"commitlint": {
|
|
47
47
|
"extends": [
|