@phaicom/eslint-config 0.1.3
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/LICENSE +21 -0
- package/README.md +21 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +90 -0
- package/package.json +69 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-PRESENT Reawpai Chunsoi
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# `@phaicom/eslint-config`
|
|
2
|
+
|
|
3
|
+
phaicom's ESLint configuration.
|
|
4
|
+
|
|
5
|
+
- Based on [antfu/eslint-config](https://github.com/antfu/eslint-config).
|
|
6
|
+
- Enable all unicorn config.
|
|
7
|
+
- Forced to always use curly.
|
|
8
|
+
- Modified rules including unicorn, stylistic, Vue, etc.
|
|
9
|
+
- Integrated with [eslint-plugin-readable-tailwind](https://github.com/schoero/eslint-plugin-readable-tailwind).
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
To enable Tailwind just set the **tailwind** flag to true.
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
import phaicom from '@phaicom/eslint-config'
|
|
16
|
+
|
|
17
|
+
export default phaicom({
|
|
18
|
+
tailwind: true,
|
|
19
|
+
})
|
|
20
|
+
```
|
|
21
|
+
The rest of the config you can refer to https://github.com/antfu/eslint-config
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
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 OptionsConfig$1, TypedFlatConfigItem {
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
* Used recommended rules:
|
|
9
|
+
* @see https://github.com/schoero/eslint-plugin-readable-tailwind
|
|
10
|
+
* @default false
|
|
11
|
+
*/
|
|
12
|
+
tailwind?: boolean;
|
|
13
|
+
}
|
|
14
|
+
type EslintConfig = (options: OptionsConfig, ...configs: UserConfigParams[]) => EslintConfigReturn;
|
|
15
|
+
|
|
16
|
+
declare const eslintConfig: EslintConfig;
|
|
17
|
+
|
|
18
|
+
export { eslintConfig as default };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import antfu from "@antfu/eslint-config";
|
|
3
|
+
import pluginReadableTailwind from "eslint-plugin-readable-tailwind";
|
|
4
|
+
|
|
5
|
+
// src/base.ts
|
|
6
|
+
var baseConfig = {
|
|
7
|
+
name: "phaicom/base",
|
|
8
|
+
rules: {
|
|
9
|
+
"curly": ["error", "all"],
|
|
10
|
+
// style rule customizations
|
|
11
|
+
"style/arrow-parens": ["error", "always"],
|
|
12
|
+
"style/brace-style": ["error", "1tbs", { allowSingleLine: true }],
|
|
13
|
+
"style/quote-props": "off",
|
|
14
|
+
"style/function-call-spacing": ["error", "never"],
|
|
15
|
+
// unicorn rule customizations
|
|
16
|
+
"unicorn/prevent-abbreviations": "off",
|
|
17
|
+
"unicorn/consistent-function-scoping": "off",
|
|
18
|
+
// ignore composable/hook based filenames, LICENSE, and README
|
|
19
|
+
"unicorn/filename-case": [
|
|
20
|
+
"error",
|
|
21
|
+
{
|
|
22
|
+
case: "kebabCase",
|
|
23
|
+
ignore: [
|
|
24
|
+
// This regex matches files that start with 'use' followed by an uppercase letter
|
|
25
|
+
// and then any sequence of characters, ending with '.ts'. Useful for React hooks.
|
|
26
|
+
String.raw`^use[A-Z].*\.ts$`,
|
|
27
|
+
"LICENSE",
|
|
28
|
+
"README",
|
|
29
|
+
"CHANGELOG"
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
// jsonc rule customizations
|
|
34
|
+
"jsonc/sort-keys": "off",
|
|
35
|
+
// node customizations
|
|
36
|
+
"node/prefer-global/process": "off"
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
var vueConfig = {
|
|
40
|
+
name: "phaicom/vue",
|
|
41
|
+
rules: {
|
|
42
|
+
// vue rule customizations
|
|
43
|
+
"vue/max-attributes-per-line": ["error", {
|
|
44
|
+
singleline: { max: 10 },
|
|
45
|
+
multiline: { max: 1 }
|
|
46
|
+
}],
|
|
47
|
+
"vue/multi-word-component-names": "warn",
|
|
48
|
+
"vue/singleline-html-element-content-newline": "off"
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
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({
|
|
69
|
+
name: "phaicom/tailwind",
|
|
70
|
+
files,
|
|
71
|
+
plugins: {
|
|
72
|
+
"readable-tailwind": pluginReadableTailwind
|
|
73
|
+
},
|
|
74
|
+
rules: {
|
|
75
|
+
// enable all recommended rules to error
|
|
76
|
+
...pluginReadableTailwind.configs.error.rules
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
const userConfigs = [
|
|
81
|
+
baseConfig,
|
|
82
|
+
...options.vue ? [vueConfig] : []
|
|
83
|
+
];
|
|
84
|
+
options.unicorn = true;
|
|
85
|
+
return antfu(options, ...userConfigs, ...configs);
|
|
86
|
+
};
|
|
87
|
+
var index_default = eslintConfig;
|
|
88
|
+
export {
|
|
89
|
+
index_default as default
|
|
90
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@phaicom/eslint-config",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.1.3",
|
|
5
|
+
"description": "Phaicom's config based on @antfu/eslint-config",
|
|
6
|
+
"author": "Reawpai Chunsoi <reawpai.chunsoi@gmail.com> (https://github.com/phaicom)",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"homepage": "https://github.com/phaicom/eslint-config",
|
|
9
|
+
"keywords": [
|
|
10
|
+
"eslint-config"
|
|
11
|
+
],
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": ">=20"
|
|
14
|
+
},
|
|
15
|
+
"exports": {
|
|
16
|
+
".": "./dist/index.js"
|
|
17
|
+
},
|
|
18
|
+
"main": "./dist/index.js",
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"files": [
|
|
21
|
+
"dist"
|
|
22
|
+
],
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"eslint-plugin-readable-tailwind": ">=2.0.0-beta.0"
|
|
25
|
+
},
|
|
26
|
+
"peerDependenciesMeta": {
|
|
27
|
+
"eslint-plugin-readable-tailwind": {
|
|
28
|
+
"optional": true
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@antfu/eslint-config": "^4.1.0",
|
|
33
|
+
"eslint": "^9.19.0"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@commitlint/cli": "^19.6.1",
|
|
37
|
+
"@commitlint/config-conventional": "^19.6.0",
|
|
38
|
+
"bumpp": "^10.0.1",
|
|
39
|
+
"eslint-plugin-format": "^1.0.1",
|
|
40
|
+
"lint-staged": "^15.4.3",
|
|
41
|
+
"simple-git-hooks": "^2.11.1",
|
|
42
|
+
"tsup": "^8.3.6",
|
|
43
|
+
"typescript": "^5.7.3",
|
|
44
|
+
"eslint-plugin-readable-tailwind": "2.0.0-beta.0"
|
|
45
|
+
},
|
|
46
|
+
"commitlint": {
|
|
47
|
+
"extends": [
|
|
48
|
+
"@commitlint/config-conventional"
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
"simple-git-hooks": {
|
|
52
|
+
"pre-commit": "npx lint-staged",
|
|
53
|
+
"commit-msg": "npx commitlint --edit ${1}"
|
|
54
|
+
},
|
|
55
|
+
"lint-staged": {
|
|
56
|
+
"*": "eslint --fix"
|
|
57
|
+
},
|
|
58
|
+
"scripts": {
|
|
59
|
+
"build": "tsup --clean --dts",
|
|
60
|
+
"stub": "tsup",
|
|
61
|
+
"dev": "npx @eslint/config-inspector --config eslint.config.ts",
|
|
62
|
+
"build:inspector": "pnpm run build && npx @eslint/config-inspector build",
|
|
63
|
+
"watch": "tsup --watch",
|
|
64
|
+
"release": "bumpp && pnpm publish --access=public",
|
|
65
|
+
"lint": "eslint . --cache",
|
|
66
|
+
"lint:fix": "eslint . --fix --cache",
|
|
67
|
+
"typecheck": "tsc --noEmit"
|
|
68
|
+
}
|
|
69
|
+
}
|