hkx-eslint-config 1.2.13 → 2.0.1
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 +62 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +1243 -2
- package/package.json +10 -16
- package/dist/eslint-config-yOVh13pB.js +0 -707
- package/dist/formatter-Brnsr5HA.d.ts +0 -15
- package/dist/formatter.js +0 -52
- package/dist/index-XI48-tVd.d.ts +0 -6
- package/dist/jsx-a11y-D4Hch9Ag.js +0 -90
- package/dist/node-BcSbpd7-.d.ts +0 -6
- package/dist/node-Drh_edOM.js +0 -50
- package/dist/node.js +0 -12
- package/dist/typescript/index-Cxdtvo1O.d.ts +0 -6
- package/dist/typescript/index.js +0 -38
- package/dist/typescript/node-BzqiARph.d.ts +0 -6
- package/dist/typescript/node.js +0 -28
- package/dist/typescript/vue-CDn-oW_8.d.ts +0 -6
- package/dist/typescript/vue.js +0 -42
- package/dist/typescript-DjqRl_Mf.js +0 -197
- package/dist/vue-XpHn6ZZs.d.ts +0 -6
- package/dist/vue.js +0 -27
package/README.md
CHANGED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# hkx-eslint-config
|
|
2
|
+
|
|
3
|
+
HKX 代码规范,基于 ESLint 9 Flat Config。
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add -D eslint hkx-eslint-config
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
要求 **ESLint ^9.32.0**(peerDependency)。
|
|
12
|
+
|
|
13
|
+
## 用法
|
|
14
|
+
|
|
15
|
+
在项目根目录新建 `eslint.config.js`(或 `eslint.config.mjs` / `eslint.config.ts`),按项目类型选用对应 config 并展开:
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
import { defineConfig } from 'eslint/config';
|
|
19
|
+
import hkx from 'hkx-eslint-config';
|
|
20
|
+
|
|
21
|
+
export default defineConfig([
|
|
22
|
+
...hkx.configs.ts, // 按需换成 js / node / react / vue / vueTs / reactTs / nodeTs
|
|
23
|
+
{
|
|
24
|
+
ignores: ['**/node_modules/**', '**/dist/**'],
|
|
25
|
+
},
|
|
26
|
+
]);
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### 可选配置
|
|
30
|
+
|
|
31
|
+
| 名称 | 说明 |
|
|
32
|
+
|----------|----------------|
|
|
33
|
+
| `js` | 纯 JavaScript |
|
|
34
|
+
| `ts` | TypeScript |
|
|
35
|
+
| `node` | Node.js (JS) |
|
|
36
|
+
| `nodeTs` | Node.js (TS) |
|
|
37
|
+
| `react` | React (JS) |
|
|
38
|
+
| `reactTs`| React (TS) |
|
|
39
|
+
| `vue` | Vue (JS) |
|
|
40
|
+
| `vueTs` | Vue (TS) |
|
|
41
|
+
|
|
42
|
+
多种场景可组合多段 config(如先 `...hkx.configs.ts` 再 `...hkx.configs.vueTs`),或按 `files` 在各自 config 里区分。
|
|
43
|
+
|
|
44
|
+
## 以插件形式使用
|
|
45
|
+
|
|
46
|
+
可挂载自带的 plugin,通过 `extends` 使用内置规则(plugin 提供 `js` / `ts` / `node` / `react` / `vue`):
|
|
47
|
+
|
|
48
|
+
```js
|
|
49
|
+
import { defineConfig } from 'eslint/config';
|
|
50
|
+
import hkx from 'hkx-eslint-config';
|
|
51
|
+
|
|
52
|
+
export default defineConfig([
|
|
53
|
+
{
|
|
54
|
+
plugins: {
|
|
55
|
+
hkx: hkx.plugin,
|
|
56
|
+
},
|
|
57
|
+
extends: ['hkx/ts'],
|
|
58
|
+
},
|
|
59
|
+
]);
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
推荐直接展开 `hkx.configs.xxx`,按需组合、可配合 `files` 与 `ignores`。
|