index.js
1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/**
* `@drama/config/eslint` 公共面 —— 导出 `presetNode` / `presetVue` 两套 flat config 预设。
*
* - `presetNode`:纯逻辑 / 后端包用。通用 JS 规则 + scaffold 四条架构红线规则(深导入 /
* 子域深导入 / 连接只在 composition root / 禁 app 互调)。
* - `presetVue`:Vue 包用。在 `presetNode` 基础上拼接 `eslint-plugin-vue` 与浏览器全局。
*
* 两者都是**数据**(flat config 数组),消费方 `export default presetNode`(或 `presetVue`)
* 即获得与全仓一致的 lint 行为,再按需补本包特例。
*
* 消费示例:
* // packages/foo/eslint.config.js
* import { presetNode } from '@drama/config/eslint'
* export default presetNode
*
* // apps/web/eslint.config.js
* import { presetVue } from '@drama/config/eslint'
* export default presetVue
*/
import {
JS_RECOMMENDED,
COMMON_IGNORES_BLOCK,
buildArchRulesBlock,
buildCommonjsArchRulesBlock,
ENFORCED_RULE_NAMES,
} from './rules.js'
import { buildVueBlocks } from './vue.js'
export { ENFORCED_RULE_NAMES }
/**
* 纯逻辑 / 后端包 flat config 预设。
* @type {import('eslint').Linter.Config[]}
*/
export const presetNode = [
COMMON_IGNORES_BLOCK,
JS_RECOMMENDED,
buildArchRulesBlock(),
buildCommonjsArchRulesBlock(),
]
/**
* Vue 包 flat config 预设:node 预设之上拼接 Vue 片段。
* @type {import('eslint').Linter.Config[]}
*/
export const presetVue = [...presetNode, ...buildVueBlocks()]