forked from jsdom/jsdom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.json
53 lines (51 loc) · 2.07 KB
/
.eslintrc.json
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
{
"root": true,
"extends": "@domenic",
"env": {
"node": true
},
"plugins": [
"jsdom-internal"
],
"rules": {
// Overrides for jsdom
"array-element-newline": "off",
"no-implied-eval": "off",
"no-invalid-this": "off",
"require-unicode-regexp": "off",
"prefer-template": "off",
"prefer-object-has-own": "off", // remove this once Node v16 is the minimum
"logical-assignment-operators": "off", // remove this once Node v16 is the minimum
"new-cap": ["error", { "capIsNewExceptions": ["ByteString", "USVString", "DOMString"] }],
// Custom rules
"jsdom-internal/hook-super-invocation": ["error",
{ "ancestor": "NodeImpl", "hook": "_attach" },
{ "ancestor": "NodeImpl", "hook": "_detach" },
{ "ancestor": "NodeImpl", "hook": "_descendantAdded" },
{ "ancestor": "NodeImpl", "hook": "_descendantRemoved" },
{ "ancestor": "NodeImpl", "hook": "_childTextContentChangeSteps" },
{ "ancestor": "ElementImpl", "hook": "_attrModified" }
]
},
// Rules limited to specific locations
"overrides": [
{
"files": ["lib/**"],
"rules": {
"no-restricted-properties": ["error",
{ "property": "getAttribute", "message": "Use 'getAttributeNS' with null as the namespace to access attributes within jsdom" },
{ "property": "setAttribute", "message": "Use 'setAttributeNS' with null as the namespace to access attributes within jsdom" },
{ "property": "hasAttribute", "message": "Use 'hasAttributeNS' with null as the namespace to access attributes within jsdom" },
{ "property": "removeAttribute", "message": "Use 'removeAttributeNS' with null as the namespace to access attributes within jsdom" },
{ "property": "toggleAttribute", "message": "Use 'setAttributeNS' and 'removeAttributeNS' with null as the namespace to access attributes within jsdom" }
]
}
},
{
"files": ["test/api/**"],
"rules": {
"no-loop-func": "off" // interacts poorly with Mocha's before() and tests generated using loops
}
}
]
}