-
Notifications
You must be signed in to change notification settings - Fork 0
/
html.ts
56 lines (51 loc) · 1.09 KB
/
html.ts
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
48
49
50
51
52
53
54
55
56
import { GLOB_HTML } from '../globs'
import { PARSER_HTML } from '../parsers'
import { PLUGIN_HTML } from '../plugins'
import { RULE_HTML_A11Y, RULE_HTML_BASE, RULE_HTML_STYLE } from '../rules'
import { defineConfigs, isTrue } from '../utils'
export type HtmlConfigOptions = {
a11y?: boolean,
style?: boolean
}
export function html(options: HtmlConfigOptions = {}) {
const {
a11y = true,
style = true
} = options
const isA11YEnabled = isTrue(a11y)
const isStyleEnabled = isTrue(style)
const files = [GLOB_HTML]
return defineConfigs([
{
name: 'base',
files,
languageOptions: {
parser: PARSER_HTML
},
plugins: {
[PLUGIN_HTML.meta.name]: PLUGIN_HTML
},
rules: {
...RULE_HTML_BASE
}
},
isA11YEnabled
? {
name: 'a11y',
files,
rules: {
...RULE_HTML_A11Y
}
}
: {},
isStyleEnabled
? {
name: 'style',
files,
rules: {
...RULE_HTML_STYLE
}
}
: {}
], 'html')
}