eslint-plugin-react-dom 2.0.0-next.146 → 2.0.0-next.147
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/dist/index.d.ts +73 -69
- package/dist/index.js +1944 -1992
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -1,2122 +1,2074 @@
|
|
|
1
|
-
import { getDocsUrl, getSettingsFromContext
|
|
2
|
-
import * as ER from
|
|
3
|
-
import { ESLintUtils } from
|
|
4
|
-
import { unit } from
|
|
5
|
-
import { AST_NODE_TYPES } from
|
|
6
|
-
import { compare } from
|
|
7
|
-
import { RegExp, Reporter } from
|
|
1
|
+
import { DEFAULT_ESLINT_REACT_SETTINGS, getDocsUrl, getSettingsFromContext } from "@eslint-react/shared";
|
|
2
|
+
import * as ER from "@eslint-react/core";
|
|
3
|
+
import { ESLintUtils } from "@typescript-eslint/utils";
|
|
4
|
+
import { unit } from "@eslint-react/eff";
|
|
5
|
+
import { AST_NODE_TYPES } from "@typescript-eslint/types";
|
|
6
|
+
import { compare } from "compare-versions";
|
|
7
|
+
import { RegExp, Reporter } from "@eslint-react/kit";
|
|
8
8
|
|
|
9
|
+
//#region rolldown:runtime
|
|
9
10
|
var __defProp = Object.defineProperty;
|
|
10
11
|
var __export = (target, all) => {
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
for (var name$2 in all) __defProp(target, name$2, {
|
|
13
|
+
get: all[name$2],
|
|
14
|
+
enumerable: true
|
|
15
|
+
});
|
|
13
16
|
};
|
|
14
17
|
|
|
15
|
-
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/configs/recommended.ts
|
|
16
20
|
var recommended_exports = {};
|
|
17
21
|
__export(recommended_exports, {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
22
|
+
name: () => name$1,
|
|
23
|
+
rules: () => rules,
|
|
24
|
+
settings: () => settings
|
|
21
25
|
});
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
};
|
|
41
|
-
var settings = {
|
|
42
|
-
"react-x": DEFAULT_ESLINT_REACT_SETTINGS
|
|
26
|
+
const name$1 = "react-dom/recommended";
|
|
27
|
+
const rules = {
|
|
28
|
+
"react-dom/no-dangerously-set-innerhtml": "warn",
|
|
29
|
+
"react-dom/no-dangerously-set-innerhtml-with-children": "error",
|
|
30
|
+
"react-dom/no-find-dom-node": "error",
|
|
31
|
+
"react-dom/no-flush-sync": "error",
|
|
32
|
+
"react-dom/no-hydrate": "error",
|
|
33
|
+
"react-dom/no-missing-button-type": "warn",
|
|
34
|
+
"react-dom/no-missing-iframe-sandbox": "warn",
|
|
35
|
+
"react-dom/no-namespace": "error",
|
|
36
|
+
"react-dom/no-render": "error",
|
|
37
|
+
"react-dom/no-render-return-value": "error",
|
|
38
|
+
"react-dom/no-script-url": "warn",
|
|
39
|
+
"react-dom/no-string-style-prop": "error",
|
|
40
|
+
"react-dom/no-unsafe-iframe-sandbox": "warn",
|
|
41
|
+
"react-dom/no-unsafe-target-blank": "warn",
|
|
42
|
+
"react-dom/no-use-form-state": "error",
|
|
43
|
+
"react-dom/no-void-elements-with-children": "error"
|
|
43
44
|
};
|
|
45
|
+
const settings = { "react-x": DEFAULT_ESLINT_REACT_SETTINGS };
|
|
46
|
+
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region package.json
|
|
49
|
+
var name = "eslint-plugin-react-dom";
|
|
50
|
+
var version = "2.0.0-next.147";
|
|
44
51
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
var version = "2.0.0-next.146";
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region src/utils/create-jsx-element-resolver.ts
|
|
48
54
|
function createJsxElementResolver(context) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const polymorphicPropValue = ER.getAttributeValue(
|
|
71
|
-
context,
|
|
72
|
-
polymorphicPropAttr,
|
|
73
|
-
polymorphicPropName
|
|
74
|
-
);
|
|
75
|
-
if (polymorphicPropValue.kind === "some" && typeof polymorphicPropValue.value === "string") {
|
|
76
|
-
return {
|
|
77
|
-
...result,
|
|
78
|
-
domElementType: polymorphicPropValue.value
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
return result;
|
|
83
|
-
}
|
|
84
|
-
};
|
|
55
|
+
const { components, polymorphicPropName } = getSettingsFromContext(context);
|
|
56
|
+
return { resolve(node) {
|
|
57
|
+
const name$2 = ER.getElementType(context, node);
|
|
58
|
+
const component = components.findLast((c) => c.name === name$2 || c.re.test(name$2));
|
|
59
|
+
const result = {
|
|
60
|
+
attributes: component?.attributes ?? [],
|
|
61
|
+
domElementType: component?.as ?? name$2,
|
|
62
|
+
jsxElementType: name$2
|
|
63
|
+
};
|
|
64
|
+
if (name$2 === name$2.toLowerCase() || component != null || polymorphicPropName == null) return result;
|
|
65
|
+
const initialScope = context.sourceCode.getScope(node);
|
|
66
|
+
const polymorphicPropAttr = ER.getAttribute(context, polymorphicPropName, node.openingElement.attributes, initialScope);
|
|
67
|
+
if (polymorphicPropAttr != null) {
|
|
68
|
+
const polymorphicPropValue = ER.getAttributeValue(context, polymorphicPropAttr, polymorphicPropName);
|
|
69
|
+
if (polymorphicPropValue.kind === "some" && typeof polymorphicPropValue.value === "string") return {
|
|
70
|
+
...result,
|
|
71
|
+
domElementType: polymorphicPropValue.value
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
return result;
|
|
75
|
+
} };
|
|
85
76
|
}
|
|
86
|
-
var createRule = ESLintUtils.RuleCreator(getDocsUrl("dom"));
|
|
87
77
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
78
|
+
//#endregion
|
|
79
|
+
//#region src/utils/create-rule.ts
|
|
80
|
+
const createRule = ESLintUtils.RuleCreator(getDocsUrl("dom"));
|
|
81
|
+
|
|
82
|
+
//#endregion
|
|
83
|
+
//#region src/utils/find-custom-component.ts
|
|
84
|
+
function findCustomComponentProp(name$2, props) {
|
|
85
|
+
return props.findLast((a) => a.as === name$2);
|
|
91
86
|
}
|
|
87
|
+
|
|
88
|
+
//#endregion
|
|
89
|
+
//#region src/utils/resolve-attribute.ts
|
|
92
90
|
function resolveAttribute(context, attributes, elementNode, attributeName) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
attributeValueString: attributeValue.value
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
return {
|
|
119
|
-
attribute,
|
|
120
|
-
attributeName: propNameOnJsx,
|
|
121
|
-
attributeValue: unit,
|
|
122
|
-
attributeValueString: customComponentProp?.defaultValue ?? unit
|
|
123
|
-
};
|
|
91
|
+
const customComponentProp = findCustomComponentProp(attributeName, attributes);
|
|
92
|
+
const propNameOnJsx = customComponentProp?.name ?? attributeName;
|
|
93
|
+
const attribute = ER.getAttribute(context, propNameOnJsx, elementNode.openingElement.attributes, context.sourceCode.getScope(elementNode));
|
|
94
|
+
if (attribute == null) return {
|
|
95
|
+
attribute: unit,
|
|
96
|
+
attributeName: propNameOnJsx,
|
|
97
|
+
attributeValue: unit,
|
|
98
|
+
attributeValueString: customComponentProp?.defaultValue
|
|
99
|
+
};
|
|
100
|
+
const attributeValue = ER.getAttributeValue(context, attribute, propNameOnJsx);
|
|
101
|
+
if (attributeValue.kind === "some" && typeof attributeValue.value === "string") return {
|
|
102
|
+
attribute,
|
|
103
|
+
attributeName: propNameOnJsx,
|
|
104
|
+
attributeValue,
|
|
105
|
+
attributeValueString: attributeValue.value
|
|
106
|
+
};
|
|
107
|
+
return {
|
|
108
|
+
attribute,
|
|
109
|
+
attributeName: propNameOnJsx,
|
|
110
|
+
attributeValue: unit,
|
|
111
|
+
attributeValueString: customComponentProp?.defaultValue ?? unit
|
|
112
|
+
};
|
|
124
113
|
}
|
|
125
114
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
115
|
+
//#endregion
|
|
116
|
+
//#region src/rules/no-dangerously-set-innerhtml.ts
|
|
117
|
+
const RULE_NAME$16 = "no-dangerously-set-innerhtml";
|
|
118
|
+
const RULE_FEATURES$15 = [];
|
|
129
119
|
var no_dangerously_set_innerhtml_default = createRule({
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
create,
|
|
143
|
-
defaultOptions: []
|
|
120
|
+
meta: {
|
|
121
|
+
type: "problem",
|
|
122
|
+
docs: {
|
|
123
|
+
description: "Disallow `dangerouslySetInnerHTML`.",
|
|
124
|
+
[Symbol.for("rule_features")]: RULE_FEATURES$15
|
|
125
|
+
},
|
|
126
|
+
messages: { noDangerouslySetInnerhtml: "Using 'dangerouslySetInnerHTML' may have security implications." },
|
|
127
|
+
schema: []
|
|
128
|
+
},
|
|
129
|
+
name: RULE_NAME$16,
|
|
130
|
+
create: create$16,
|
|
131
|
+
defaultOptions: []
|
|
144
132
|
});
|
|
145
|
-
|
|
146
|
-
function create(context) {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
if (attribute == null) return;
|
|
157
|
-
context.report({
|
|
158
|
-
messageId: "noDangerouslySetInnerhtml",
|
|
159
|
-
node: attribute
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
};
|
|
133
|
+
const dangerouslySetInnerHTML$1 = "dangerouslySetInnerHTML";
|
|
134
|
+
function create$16(context) {
|
|
135
|
+
if (!context.sourceCode.text.includes(dangerouslySetInnerHTML$1)) return {};
|
|
136
|
+
return { JSXElement(node) {
|
|
137
|
+
const attribute = ER.getAttribute(context, dangerouslySetInnerHTML$1, node.openingElement.attributes, context.sourceCode.getScope(node));
|
|
138
|
+
if (attribute == null) return;
|
|
139
|
+
context.report({
|
|
140
|
+
messageId: "noDangerouslySetInnerhtml",
|
|
141
|
+
node: attribute
|
|
142
|
+
});
|
|
143
|
+
} };
|
|
163
144
|
}
|
|
164
|
-
|
|
165
|
-
|
|
145
|
+
|
|
146
|
+
//#endregion
|
|
147
|
+
//#region src/rules/no-dangerously-set-innerhtml-with-children.ts
|
|
148
|
+
const RULE_NAME$15 = "no-dangerously-set-innerhtml-with-children";
|
|
149
|
+
const RULE_FEATURES$14 = [];
|
|
166
150
|
var no_dangerously_set_innerhtml_with_children_default = createRule({
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
create: create2,
|
|
180
|
-
defaultOptions: []
|
|
151
|
+
meta: {
|
|
152
|
+
type: "problem",
|
|
153
|
+
docs: {
|
|
154
|
+
description: "Disallow `dangerouslySetInnerHTML` and `children` at the same time.",
|
|
155
|
+
[Symbol.for("rule_features")]: RULE_FEATURES$14
|
|
156
|
+
},
|
|
157
|
+
messages: { noDangerouslySetInnerhtmlWithChildren: "A DOM component cannot use both 'children' and 'dangerouslySetInnerHTML'." },
|
|
158
|
+
schema: []
|
|
159
|
+
},
|
|
160
|
+
name: RULE_NAME$15,
|
|
161
|
+
create: create$15,
|
|
162
|
+
defaultOptions: []
|
|
181
163
|
});
|
|
182
|
-
|
|
183
|
-
function
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
};
|
|
164
|
+
const dangerouslySetInnerHTML = "dangerouslySetInnerHTML";
|
|
165
|
+
function create$15(context) {
|
|
166
|
+
if (!context.sourceCode.text.includes(dangerouslySetInnerHTML)) return {};
|
|
167
|
+
return { JSXElement(node) {
|
|
168
|
+
const attributes = node.openingElement.attributes;
|
|
169
|
+
const initialScope = context.sourceCode.getScope(node);
|
|
170
|
+
const hasChildren = node.children.some(isSignificantChildren) || ER.hasAttribute(context, "children", attributes, initialScope);
|
|
171
|
+
if (hasChildren && ER.hasAttribute(context, dangerouslySetInnerHTML, attributes, initialScope)) context.report({
|
|
172
|
+
messageId: "noDangerouslySetInnerhtmlWithChildren",
|
|
173
|
+
node
|
|
174
|
+
});
|
|
175
|
+
} };
|
|
198
176
|
}
|
|
177
|
+
/**
|
|
178
|
+
* Check if a Literal or JSXText node is whitespace
|
|
179
|
+
* @param node The AST node to check
|
|
180
|
+
* @returns boolean `true` if the node is whitespace
|
|
181
|
+
*/
|
|
199
182
|
function isWhiteSpace(node) {
|
|
200
|
-
|
|
183
|
+
return typeof node.value === "string" && node.raw.trim() === "";
|
|
201
184
|
}
|
|
185
|
+
/**
|
|
186
|
+
* Check if a Literal or JSXText node is padding spaces
|
|
187
|
+
* @param node The AST node to check
|
|
188
|
+
* @returns boolean
|
|
189
|
+
*/
|
|
202
190
|
function isPaddingSpaces(node) {
|
|
203
|
-
|
|
191
|
+
return ER.isJsxText(node) && isWhiteSpace(node) && node.raw.includes("\n");
|
|
204
192
|
}
|
|
205
193
|
function isSignificantChildren(node) {
|
|
206
|
-
|
|
194
|
+
return node.type !== AST_NODE_TYPES.JSXText || !isPaddingSpaces(node);
|
|
207
195
|
}
|
|
208
|
-
|
|
209
|
-
|
|
196
|
+
|
|
197
|
+
//#endregion
|
|
198
|
+
//#region src/rules/no-find-dom-node.ts
|
|
199
|
+
const RULE_NAME$14 = "no-find-dom-node";
|
|
200
|
+
const RULE_FEATURES$13 = [];
|
|
210
201
|
var no_find_dom_node_default = createRule({
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
create: create3,
|
|
224
|
-
defaultOptions: []
|
|
202
|
+
meta: {
|
|
203
|
+
type: "problem",
|
|
204
|
+
docs: {
|
|
205
|
+
description: "Disallow `findDOMNode`.",
|
|
206
|
+
[Symbol.for("rule_features")]: RULE_FEATURES$13
|
|
207
|
+
},
|
|
208
|
+
messages: { noFindDomNode: "[Deprecated] Use alternatives instead." },
|
|
209
|
+
schema: []
|
|
210
|
+
},
|
|
211
|
+
name: RULE_NAME$14,
|
|
212
|
+
create: create$14,
|
|
213
|
+
defaultOptions: []
|
|
225
214
|
});
|
|
226
|
-
|
|
227
|
-
function
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
215
|
+
const findDOMNode = "findDOMNode";
|
|
216
|
+
function create$14(context) {
|
|
217
|
+
if (!context.sourceCode.text.includes(findDOMNode)) return {};
|
|
218
|
+
return { CallExpression(node) {
|
|
219
|
+
const { callee } = node;
|
|
220
|
+
switch (callee.type) {
|
|
221
|
+
case AST_NODE_TYPES.Identifier:
|
|
222
|
+
if (callee.name === findDOMNode) context.report({
|
|
223
|
+
messageId: "noFindDomNode",
|
|
224
|
+
node
|
|
225
|
+
});
|
|
226
|
+
return;
|
|
227
|
+
case AST_NODE_TYPES.MemberExpression:
|
|
228
|
+
if (callee.property.type === AST_NODE_TYPES.Identifier && callee.property.name === findDOMNode) context.report({
|
|
229
|
+
messageId: "noFindDomNode",
|
|
230
|
+
node
|
|
231
|
+
});
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
} };
|
|
246
235
|
}
|
|
247
|
-
|
|
248
|
-
|
|
236
|
+
|
|
237
|
+
//#endregion
|
|
238
|
+
//#region src/rules/no-flush-sync.ts
|
|
239
|
+
const RULE_NAME$13 = "no-flush-sync";
|
|
240
|
+
const RULE_FEATURES$12 = [];
|
|
249
241
|
var no_flush_sync_default = createRule({
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
create: create4,
|
|
263
|
-
defaultOptions: []
|
|
242
|
+
meta: {
|
|
243
|
+
type: "problem",
|
|
244
|
+
docs: {
|
|
245
|
+
description: "Disallow `flushSync`.",
|
|
246
|
+
[Symbol.for("rule_features")]: RULE_FEATURES$12
|
|
247
|
+
},
|
|
248
|
+
messages: { noFlushSync: "Using 'flushSync' is uncommon and can hurt the performance of your app." },
|
|
249
|
+
schema: []
|
|
250
|
+
},
|
|
251
|
+
name: RULE_NAME$13,
|
|
252
|
+
create: create$13,
|
|
253
|
+
defaultOptions: []
|
|
264
254
|
});
|
|
265
|
-
|
|
266
|
-
function
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
255
|
+
const flushSync = "flushSync";
|
|
256
|
+
function create$13(context) {
|
|
257
|
+
if (!context.sourceCode.text.includes(flushSync)) return {};
|
|
258
|
+
return { CallExpression(node) {
|
|
259
|
+
const { callee } = node;
|
|
260
|
+
switch (callee.type) {
|
|
261
|
+
case AST_NODE_TYPES.Identifier:
|
|
262
|
+
if (callee.name === flushSync) context.report({
|
|
263
|
+
messageId: "noFlushSync",
|
|
264
|
+
node
|
|
265
|
+
});
|
|
266
|
+
return;
|
|
267
|
+
case AST_NODE_TYPES.MemberExpression:
|
|
268
|
+
if (callee.property.type === AST_NODE_TYPES.Identifier && callee.property.name === flushSync) context.report({
|
|
269
|
+
messageId: "noFlushSync",
|
|
270
|
+
node
|
|
271
|
+
});
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
} };
|
|
285
275
|
}
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
276
|
+
|
|
277
|
+
//#endregion
|
|
278
|
+
//#region src/rules/no-hydrate.ts
|
|
279
|
+
const RULE_NAME$12 = "no-hydrate";
|
|
280
|
+
const RULE_FEATURES$11 = ["MOD"];
|
|
290
281
|
var no_hydrate_default = createRule({
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
create: create5,
|
|
305
|
-
defaultOptions: []
|
|
282
|
+
meta: {
|
|
283
|
+
type: "problem",
|
|
284
|
+
docs: {
|
|
285
|
+
description: "Replaces usages of `ReactDom.hydrate()` with `hydrateRoot()`.",
|
|
286
|
+
[Symbol.for("rule_features")]: RULE_FEATURES$11
|
|
287
|
+
},
|
|
288
|
+
fixable: "code",
|
|
289
|
+
messages: { noHydrate: "[Deprecated] Use 'hydrateRoot()' instead." },
|
|
290
|
+
schema: []
|
|
291
|
+
},
|
|
292
|
+
name: RULE_NAME$12,
|
|
293
|
+
create: create$12,
|
|
294
|
+
defaultOptions: []
|
|
306
295
|
});
|
|
307
|
-
|
|
308
|
-
function
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
};
|
|
296
|
+
const hydrate = "hydrate";
|
|
297
|
+
function create$12(context) {
|
|
298
|
+
if (!context.sourceCode.text.includes(hydrate)) return {};
|
|
299
|
+
const settings$1 = getSettingsFromContext(context);
|
|
300
|
+
if (compare(settings$1.version, "18.0.0", "<")) return {};
|
|
301
|
+
const reactDomNames = /* @__PURE__ */ new Set();
|
|
302
|
+
const hydrateNames = /* @__PURE__ */ new Set();
|
|
303
|
+
return {
|
|
304
|
+
CallExpression(node) {
|
|
305
|
+
switch (true) {
|
|
306
|
+
case node.callee.type === AST_NODE_TYPES.Identifier && hydrateNames.has(node.callee.name):
|
|
307
|
+
context.report({
|
|
308
|
+
messageId: "noHydrate",
|
|
309
|
+
node,
|
|
310
|
+
fix: getFix$2(context, node)
|
|
311
|
+
});
|
|
312
|
+
return;
|
|
313
|
+
case node.callee.type === AST_NODE_TYPES.MemberExpression && node.callee.object.type === AST_NODE_TYPES.Identifier && node.callee.property.type === AST_NODE_TYPES.Identifier && node.callee.property.name === hydrate && reactDomNames.has(node.callee.object.name):
|
|
314
|
+
context.report({
|
|
315
|
+
messageId: "noHydrate",
|
|
316
|
+
node,
|
|
317
|
+
fix: getFix$2(context, node)
|
|
318
|
+
});
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
},
|
|
322
|
+
ImportDeclaration(node) {
|
|
323
|
+
const [baseSource] = node.source.value.split("/");
|
|
324
|
+
if (baseSource !== "react-dom") return;
|
|
325
|
+
for (const specifier of node.specifiers) switch (specifier.type) {
|
|
326
|
+
case AST_NODE_TYPES.ImportSpecifier:
|
|
327
|
+
if (specifier.imported.type !== AST_NODE_TYPES.Identifier) continue;
|
|
328
|
+
if (specifier.imported.name === hydrate) hydrateNames.add(specifier.local.name);
|
|
329
|
+
continue;
|
|
330
|
+
case AST_NODE_TYPES.ImportDefaultSpecifier:
|
|
331
|
+
case AST_NODE_TYPES.ImportNamespaceSpecifier:
|
|
332
|
+
reactDomNames.add(specifier.local.name);
|
|
333
|
+
continue;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
};
|
|
352
337
|
}
|
|
353
|
-
function getFix(context, node) {
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
fixer.replaceText(node, `hydrateRoot(${getText2(arg1)}, ${getText2(arg0)})`)
|
|
361
|
-
];
|
|
362
|
-
};
|
|
338
|
+
function getFix$2(context, node) {
|
|
339
|
+
const getText$1 = (n) => context.sourceCode.getText(n);
|
|
340
|
+
return (fixer) => {
|
|
341
|
+
const [arg0, arg1] = node.arguments;
|
|
342
|
+
if (arg0 == null || arg1 == null) return null;
|
|
343
|
+
return [fixer.insertTextBefore(context.sourceCode.ast, "import { hydrateRoot } from \"react-dom/client\";\n"), fixer.replaceText(node, `hydrateRoot(${getText$1(arg1)}, ${getText$1(arg0)})`)];
|
|
344
|
+
};
|
|
363
345
|
}
|
|
364
346
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
347
|
+
//#endregion
|
|
348
|
+
//#region src/rules/no-missing-button-type.ts
|
|
349
|
+
const RULE_NAME$11 = "no-missing-button-type";
|
|
350
|
+
const RULE_FEATURES$10 = ["FIX"];
|
|
351
|
+
const BUTTON_TYPES = [
|
|
352
|
+
"button",
|
|
353
|
+
"submit",
|
|
354
|
+
"reset"
|
|
369
355
|
];
|
|
370
|
-
var BUTTON_TYPES = ["button", "submit", "reset"];
|
|
371
356
|
var no_missing_button_type_default = createRule({
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
357
|
+
meta: {
|
|
358
|
+
type: "problem",
|
|
359
|
+
docs: {
|
|
360
|
+
description: "Enforces explicit `type` attribute for `button` elements.",
|
|
361
|
+
[Symbol.for("rule_features")]: RULE_FEATURES$10
|
|
362
|
+
},
|
|
363
|
+
hasSuggestions: true,
|
|
364
|
+
messages: {
|
|
365
|
+
addButtonType: "Add 'type' attribute with value '{{type}}'.",
|
|
366
|
+
noMissingButtonType: "Add missing 'type' attribute on 'button' component."
|
|
367
|
+
},
|
|
368
|
+
schema: []
|
|
369
|
+
},
|
|
370
|
+
name: RULE_NAME$11,
|
|
371
|
+
create: create$11,
|
|
372
|
+
defaultOptions: []
|
|
388
373
|
});
|
|
389
|
-
function
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
}
|
|
416
|
-
};
|
|
374
|
+
function create$11(context) {
|
|
375
|
+
const resolver = createJsxElementResolver(context);
|
|
376
|
+
return { JSXElement(node) {
|
|
377
|
+
const { attributes, domElementType } = resolver.resolve(node);
|
|
378
|
+
if (domElementType !== "button") return;
|
|
379
|
+
const typeAttribute = resolveAttribute(context, attributes, node, "type");
|
|
380
|
+
if (typeAttribute.attributeValueString != null) return;
|
|
381
|
+
if (typeAttribute.attribute == null) {
|
|
382
|
+
context.report({
|
|
383
|
+
messageId: "noMissingButtonType",
|
|
384
|
+
node: node.openingElement,
|
|
385
|
+
suggest: getSuggest((type) => (fixer) => {
|
|
386
|
+
return fixer.insertTextAfter(node.openingElement.name, ` ${typeAttribute.attributeName}="${type}"`);
|
|
387
|
+
})
|
|
388
|
+
});
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
context.report({
|
|
392
|
+
messageId: "noMissingButtonType",
|
|
393
|
+
node: typeAttribute.attributeValue?.node ?? typeAttribute.attribute,
|
|
394
|
+
suggest: getSuggest((type) => (fixer) => {
|
|
395
|
+
if (typeAttribute.attribute == null) return null;
|
|
396
|
+
return fixer.replaceText(typeAttribute.attribute, `${typeAttribute.attributeName}="${type}"`);
|
|
397
|
+
})
|
|
398
|
+
});
|
|
399
|
+
} };
|
|
417
400
|
}
|
|
418
|
-
function getSuggest(
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
401
|
+
function getSuggest(getFix$3) {
|
|
402
|
+
return BUTTON_TYPES.map((type) => ({
|
|
403
|
+
messageId: "addButtonType",
|
|
404
|
+
data: { type },
|
|
405
|
+
fix: getFix$3(type)
|
|
406
|
+
}));
|
|
424
407
|
}
|
|
425
408
|
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
];
|
|
409
|
+
//#endregion
|
|
410
|
+
//#region src/rules/no-missing-iframe-sandbox.ts
|
|
411
|
+
const RULE_NAME$10 = "no-missing-iframe-sandbox";
|
|
412
|
+
const RULE_FEATURES$9 = ["FIX"];
|
|
431
413
|
var no_missing_iframe_sandbox_default = createRule({
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
414
|
+
meta: {
|
|
415
|
+
type: "problem",
|
|
416
|
+
docs: {
|
|
417
|
+
description: "Enforces explicit `sandbox` attribute for `iframe` elements.",
|
|
418
|
+
[Symbol.for("rule_features")]: RULE_FEATURES$9
|
|
419
|
+
},
|
|
420
|
+
fixable: "code",
|
|
421
|
+
hasSuggestions: true,
|
|
422
|
+
messages: {
|
|
423
|
+
addIframeSandbox: "Add 'sandbox' attribute with value '{{value}}'.",
|
|
424
|
+
noMissingIframeSandbox: "Add missing 'sandbox' attribute on 'iframe' component."
|
|
425
|
+
},
|
|
426
|
+
schema: []
|
|
427
|
+
},
|
|
428
|
+
name: RULE_NAME$10,
|
|
429
|
+
create: create$10,
|
|
430
|
+
defaultOptions: []
|
|
449
431
|
});
|
|
450
|
-
function
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
}
|
|
485
|
-
};
|
|
432
|
+
function create$10(context) {
|
|
433
|
+
const resolver = createJsxElementResolver(context);
|
|
434
|
+
return { JSXElement(node) {
|
|
435
|
+
const { attributes, domElementType } = resolver.resolve(node);
|
|
436
|
+
if (domElementType !== "iframe") return;
|
|
437
|
+
const sandboxAttribute = resolveAttribute(context, attributes, node, "sandbox");
|
|
438
|
+
if (sandboxAttribute.attributeValueString != null) return;
|
|
439
|
+
if (sandboxAttribute.attribute == null) {
|
|
440
|
+
context.report({
|
|
441
|
+
messageId: "noMissingIframeSandbox",
|
|
442
|
+
node: node.openingElement,
|
|
443
|
+
suggest: [{
|
|
444
|
+
messageId: "addIframeSandbox",
|
|
445
|
+
data: { value: "" },
|
|
446
|
+
fix(fixer) {
|
|
447
|
+
return fixer.insertTextAfter(node.openingElement.name, ` ${sandboxAttribute.attributeName}=""`);
|
|
448
|
+
}
|
|
449
|
+
}]
|
|
450
|
+
});
|
|
451
|
+
return;
|
|
452
|
+
}
|
|
453
|
+
context.report({
|
|
454
|
+
messageId: "noMissingIframeSandbox",
|
|
455
|
+
node: sandboxAttribute.attributeValue?.node ?? sandboxAttribute.attribute,
|
|
456
|
+
suggest: [{
|
|
457
|
+
messageId: "addIframeSandbox",
|
|
458
|
+
data: { value: "" },
|
|
459
|
+
fix(fixer) {
|
|
460
|
+
if (sandboxAttribute.attribute == null) return null;
|
|
461
|
+
return fixer.replaceText(sandboxAttribute.attribute, `${sandboxAttribute.attributeName}=""`);
|
|
462
|
+
}
|
|
463
|
+
}]
|
|
464
|
+
});
|
|
465
|
+
} };
|
|
486
466
|
}
|
|
487
|
-
|
|
488
|
-
|
|
467
|
+
|
|
468
|
+
//#endregion
|
|
469
|
+
//#region src/rules/no-namespace.ts
|
|
470
|
+
const RULE_NAME$9 = "no-namespace";
|
|
471
|
+
const RULE_FEATURES$8 = [];
|
|
489
472
|
var no_namespace_default = createRule({
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
create: create8,
|
|
503
|
-
defaultOptions: []
|
|
473
|
+
meta: {
|
|
474
|
+
type: "problem",
|
|
475
|
+
docs: {
|
|
476
|
+
description: "Enforces the absence of a `namespace` in React elements.",
|
|
477
|
+
[Symbol.for("rule_features")]: RULE_FEATURES$8
|
|
478
|
+
},
|
|
479
|
+
messages: { noNamespace: "A React component '{{name}}' must not be in a namespace, as React does not support them." },
|
|
480
|
+
schema: []
|
|
481
|
+
},
|
|
482
|
+
name: RULE_NAME$9,
|
|
483
|
+
create: create$9,
|
|
484
|
+
defaultOptions: []
|
|
504
485
|
});
|
|
505
|
-
function
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
data: {
|
|
516
|
-
name: name3
|
|
517
|
-
}
|
|
518
|
-
});
|
|
519
|
-
}
|
|
520
|
-
};
|
|
486
|
+
function create$9(context) {
|
|
487
|
+
return { JSXElement(node) {
|
|
488
|
+
const name$2 = ER.getElementType(context, node);
|
|
489
|
+
if (typeof name$2 !== "string" || !name$2.includes(":")) return;
|
|
490
|
+
context.report({
|
|
491
|
+
messageId: "noNamespace",
|
|
492
|
+
node: node.openingElement.name,
|
|
493
|
+
data: { name: name$2 }
|
|
494
|
+
});
|
|
495
|
+
} };
|
|
521
496
|
}
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
497
|
+
|
|
498
|
+
//#endregion
|
|
499
|
+
//#region src/rules/no-render.ts
|
|
500
|
+
const RULE_NAME$8 = "no-render";
|
|
501
|
+
const RULE_FEATURES$7 = ["MOD"];
|
|
526
502
|
var no_render_default = createRule({
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
create: create9,
|
|
541
|
-
defaultOptions: []
|
|
503
|
+
meta: {
|
|
504
|
+
type: "problem",
|
|
505
|
+
docs: {
|
|
506
|
+
description: "Replaces usages of `ReactDom.render()` with `createRoot(node).render()`.",
|
|
507
|
+
[Symbol.for("rule_features")]: RULE_FEATURES$7
|
|
508
|
+
},
|
|
509
|
+
fixable: "code",
|
|
510
|
+
messages: { noRender: "[Deprecated] Use 'createRoot(node).render()' instead." },
|
|
511
|
+
schema: []
|
|
512
|
+
},
|
|
513
|
+
name: RULE_NAME$8,
|
|
514
|
+
create: create$8,
|
|
515
|
+
defaultOptions: []
|
|
542
516
|
});
|
|
543
|
-
function
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
};
|
|
517
|
+
function create$8(context) {
|
|
518
|
+
if (!context.sourceCode.text.includes("render")) return {};
|
|
519
|
+
const settings$1 = getSettingsFromContext(context);
|
|
520
|
+
if (compare(settings$1.version, "18.0.0", "<")) return {};
|
|
521
|
+
const reactDomNames = new Set(["ReactDOM", "ReactDom"]);
|
|
522
|
+
const renderNames = /* @__PURE__ */ new Set();
|
|
523
|
+
return {
|
|
524
|
+
CallExpression(node) {
|
|
525
|
+
switch (true) {
|
|
526
|
+
case node.callee.type === AST_NODE_TYPES.Identifier && renderNames.has(node.callee.name):
|
|
527
|
+
context.report({
|
|
528
|
+
messageId: "noRender",
|
|
529
|
+
node,
|
|
530
|
+
fix: getFix$1(context, node)
|
|
531
|
+
});
|
|
532
|
+
return;
|
|
533
|
+
case node.callee.type === AST_NODE_TYPES.MemberExpression && node.callee.object.type === AST_NODE_TYPES.Identifier && node.callee.property.type === AST_NODE_TYPES.Identifier && node.callee.property.name === "render" && reactDomNames.has(node.callee.object.name):
|
|
534
|
+
context.report({
|
|
535
|
+
messageId: "noRender",
|
|
536
|
+
node,
|
|
537
|
+
fix: getFix$1(context, node)
|
|
538
|
+
});
|
|
539
|
+
return;
|
|
540
|
+
}
|
|
541
|
+
},
|
|
542
|
+
ImportDeclaration(node) {
|
|
543
|
+
const [baseSource] = node.source.value.split("/");
|
|
544
|
+
if (baseSource !== "react-dom") return;
|
|
545
|
+
for (const specifier of node.specifiers) switch (specifier.type) {
|
|
546
|
+
case AST_NODE_TYPES.ImportSpecifier:
|
|
547
|
+
if (specifier.imported.type !== AST_NODE_TYPES.Identifier) continue;
|
|
548
|
+
if (specifier.imported.name === "render") renderNames.add(specifier.local.name);
|
|
549
|
+
continue;
|
|
550
|
+
case AST_NODE_TYPES.ImportDefaultSpecifier:
|
|
551
|
+
case AST_NODE_TYPES.ImportNamespaceSpecifier:
|
|
552
|
+
reactDomNames.add(specifier.local.name);
|
|
553
|
+
continue;
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
};
|
|
587
557
|
}
|
|
588
|
-
function
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
fixer.replaceText(node, `createRoot(${getText2(arg1)}).render(${getText2(arg0)})`)
|
|
596
|
-
];
|
|
597
|
-
};
|
|
558
|
+
function getFix$1(context, node) {
|
|
559
|
+
const getText$1 = (n) => context.sourceCode.getText(n);
|
|
560
|
+
return (fixer) => {
|
|
561
|
+
const [arg0, arg1] = node.arguments;
|
|
562
|
+
if (arg0 == null || arg1 == null) return null;
|
|
563
|
+
return [fixer.insertTextBefore(context.sourceCode.ast, "import { createRoot } from \"react-dom/client\";\n"), fixer.replaceText(node, `createRoot(${getText$1(arg1)}).render(${getText$1(arg0)})`)];
|
|
564
|
+
};
|
|
598
565
|
}
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
566
|
+
|
|
567
|
+
//#endregion
|
|
568
|
+
//#region src/rules/no-render-return-value.ts
|
|
569
|
+
const RULE_NAME$7 = "no-render-return-value";
|
|
570
|
+
const RULE_FEATURES$6 = [];
|
|
571
|
+
const banParentTypes = [
|
|
572
|
+
AST_NODE_TYPES.VariableDeclarator,
|
|
573
|
+
AST_NODE_TYPES.Property,
|
|
574
|
+
AST_NODE_TYPES.ReturnStatement,
|
|
575
|
+
AST_NODE_TYPES.ArrowFunctionExpression,
|
|
576
|
+
AST_NODE_TYPES.AssignmentExpression
|
|
607
577
|
];
|
|
608
578
|
var no_render_return_value_default = createRule({
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
create: create10,
|
|
622
|
-
defaultOptions: []
|
|
579
|
+
meta: {
|
|
580
|
+
type: "problem",
|
|
581
|
+
docs: {
|
|
582
|
+
description: "Disallow the return value of `ReactDOM.render`.",
|
|
583
|
+
[Symbol.for("rule_features")]: RULE_FEATURES$6
|
|
584
|
+
},
|
|
585
|
+
messages: { noRenderReturnValue: "Do not depend on the return value from 'ReactDOM.render'." },
|
|
586
|
+
schema: []
|
|
587
|
+
},
|
|
588
|
+
name: RULE_NAME$7,
|
|
589
|
+
create: create$7,
|
|
590
|
+
defaultOptions: []
|
|
623
591
|
});
|
|
624
|
-
function
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
}
|
|
660
|
-
}
|
|
661
|
-
}
|
|
662
|
-
};
|
|
592
|
+
function create$7(context) {
|
|
593
|
+
const reactDomNames = new Set(["ReactDOM", "ReactDom"]);
|
|
594
|
+
const renderNames = /* @__PURE__ */ new Set();
|
|
595
|
+
return {
|
|
596
|
+
CallExpression(node) {
|
|
597
|
+
switch (true) {
|
|
598
|
+
case node.callee.type === AST_NODE_TYPES.Identifier && renderNames.has(node.callee.name) && banParentTypes.includes(node.parent.type):
|
|
599
|
+
context.report({
|
|
600
|
+
messageId: "noRenderReturnValue",
|
|
601
|
+
node
|
|
602
|
+
});
|
|
603
|
+
return;
|
|
604
|
+
case node.callee.type === AST_NODE_TYPES.MemberExpression && node.callee.object.type === AST_NODE_TYPES.Identifier && node.callee.property.type === AST_NODE_TYPES.Identifier && node.callee.property.name === "render" && reactDomNames.has(node.callee.object.name) && banParentTypes.includes(node.parent.type):
|
|
605
|
+
context.report({
|
|
606
|
+
messageId: "noRenderReturnValue",
|
|
607
|
+
node
|
|
608
|
+
});
|
|
609
|
+
return;
|
|
610
|
+
}
|
|
611
|
+
},
|
|
612
|
+
ImportDeclaration(node) {
|
|
613
|
+
const [baseSource] = node.source.value.split("/");
|
|
614
|
+
if (baseSource !== "react-dom") return;
|
|
615
|
+
for (const specifier of node.specifiers) switch (specifier.type) {
|
|
616
|
+
case AST_NODE_TYPES.ImportSpecifier:
|
|
617
|
+
if (specifier.imported.type !== AST_NODE_TYPES.Identifier) continue;
|
|
618
|
+
if (specifier.imported.name === "render") renderNames.add(specifier.local.name);
|
|
619
|
+
continue;
|
|
620
|
+
case AST_NODE_TYPES.ImportDefaultSpecifier:
|
|
621
|
+
case AST_NODE_TYPES.ImportNamespaceSpecifier:
|
|
622
|
+
reactDomNames.add(specifier.local.name);
|
|
623
|
+
continue;
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
};
|
|
663
627
|
}
|
|
664
|
-
|
|
665
|
-
|
|
628
|
+
|
|
629
|
+
//#endregion
|
|
630
|
+
//#region src/rules/no-script-url.ts
|
|
631
|
+
const RULE_NAME$6 = "no-script-url";
|
|
632
|
+
const RULE_FEATURES$5 = [];
|
|
633
|
+
/**
|
|
634
|
+
* This rule is adapted from eslint-plugin-solid's jsx-no-script-url rule under the MIT license.
|
|
635
|
+
* Thank you for your work!
|
|
636
|
+
*/
|
|
666
637
|
var no_script_url_default = createRule({
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
create: create11,
|
|
680
|
-
defaultOptions: []
|
|
638
|
+
meta: {
|
|
639
|
+
type: "problem",
|
|
640
|
+
docs: {
|
|
641
|
+
description: "Disallow `javascript:` URLs as attribute values.",
|
|
642
|
+
[Symbol.for("rule_features")]: RULE_FEATURES$5
|
|
643
|
+
},
|
|
644
|
+
messages: { noScriptUrl: "Using a `javascript:` URL is a security risk and should be avoided." },
|
|
645
|
+
schema: []
|
|
646
|
+
},
|
|
647
|
+
name: RULE_NAME$6,
|
|
648
|
+
create: create$6,
|
|
649
|
+
defaultOptions: []
|
|
681
650
|
});
|
|
682
|
-
function
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
messageId: "noScriptUrl",
|
|
693
|
-
node: node.value
|
|
694
|
-
});
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
};
|
|
651
|
+
function create$6(context) {
|
|
652
|
+
return { JSXAttribute(node) {
|
|
653
|
+
if (node.name.type !== AST_NODE_TYPES.JSXIdentifier || node.value == null) return;
|
|
654
|
+
const attributeValue = ER.getAttributeValue(context, node, ER.getAttributeName(context, node));
|
|
655
|
+
if (attributeValue.kind === "none" || typeof attributeValue.value !== "string") return;
|
|
656
|
+
if (RegExp.JAVASCRIPT_PROTOCOL.test(attributeValue.value)) context.report({
|
|
657
|
+
messageId: "noScriptUrl",
|
|
658
|
+
node: node.value
|
|
659
|
+
});
|
|
660
|
+
} };
|
|
698
661
|
}
|
|
699
|
-
|
|
700
|
-
|
|
662
|
+
|
|
663
|
+
//#endregion
|
|
664
|
+
//#region src/rules/no-string-style-prop.ts
|
|
665
|
+
const RULE_NAME$5 = "no-string-style-prop";
|
|
666
|
+
const RULE_FEATURES$4 = [];
|
|
701
667
|
var no_string_style_prop_default = createRule({
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
create: create12,
|
|
715
|
-
defaultOptions: []
|
|
668
|
+
meta: {
|
|
669
|
+
type: "problem",
|
|
670
|
+
docs: {
|
|
671
|
+
description: "Disallows the use of string style prop.",
|
|
672
|
+
[Symbol.for("rule_features")]: RULE_FEATURES$4
|
|
673
|
+
},
|
|
674
|
+
messages: { noStringStyleProp: "Do not use string style prop. Use an object instead." },
|
|
675
|
+
schema: []
|
|
676
|
+
},
|
|
677
|
+
name: RULE_NAME$5,
|
|
678
|
+
create: create$5,
|
|
679
|
+
defaultOptions: []
|
|
716
680
|
});
|
|
717
|
-
function
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
}
|
|
728
|
-
};
|
|
681
|
+
function create$5(context) {
|
|
682
|
+
return { JSXAttribute(node) {
|
|
683
|
+
if (node.name.name !== "style") return;
|
|
684
|
+
const styleText = getAttributeValueText(context, node.value);
|
|
685
|
+
if (styleText == null) return;
|
|
686
|
+
context.report({
|
|
687
|
+
messageId: "noStringStyleProp",
|
|
688
|
+
node
|
|
689
|
+
});
|
|
690
|
+
} };
|
|
729
691
|
}
|
|
730
692
|
function getAttributeValueText(context, node) {
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
return context.sourceCode.getText(node.expression);
|
|
739
|
-
default:
|
|
740
|
-
return null;
|
|
741
|
-
}
|
|
693
|
+
if (node == null) return null;
|
|
694
|
+
switch (true) {
|
|
695
|
+
case node.type === AST_NODE_TYPES.Literal && typeof node.value === "string": return context.sourceCode.getText(node);
|
|
696
|
+
case node.type === AST_NODE_TYPES.JSXExpressionContainer && node.expression.type === AST_NODE_TYPES.Literal && typeof node.expression.value === "string": return context.sourceCode.getText(node.expression);
|
|
697
|
+
case node.type === AST_NODE_TYPES.JSXExpressionContainer && node.expression.type === AST_NODE_TYPES.TemplateLiteral: return context.sourceCode.getText(node.expression);
|
|
698
|
+
default: return null;
|
|
699
|
+
}
|
|
742
700
|
}
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
701
|
+
|
|
702
|
+
//#endregion
|
|
703
|
+
//#region src/rules/no-unknown-property.ts
|
|
704
|
+
const RULE_NAME$4 = "no-unknown-property";
|
|
705
|
+
const DEFAULTS = {
|
|
706
|
+
ignore: [],
|
|
707
|
+
requireDataLowercase: false
|
|
747
708
|
};
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
709
|
+
const DOM_ATTRIBUTE_NAMES = {
|
|
710
|
+
"accept-charset": "acceptCharset",
|
|
711
|
+
class: "className",
|
|
712
|
+
crossorigin: "crossOrigin",
|
|
713
|
+
for: "htmlFor",
|
|
714
|
+
"http-equiv": "httpEquiv",
|
|
715
|
+
nomodule: "noModule"
|
|
755
716
|
};
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
717
|
+
const ATTRIBUTE_TAGS_MAP = {
|
|
718
|
+
as: ["link"],
|
|
719
|
+
abbr: ["th", "td"],
|
|
720
|
+
align: [
|
|
721
|
+
"applet",
|
|
722
|
+
"caption",
|
|
723
|
+
"col",
|
|
724
|
+
"colgroup",
|
|
725
|
+
"hr",
|
|
726
|
+
"iframe",
|
|
727
|
+
"img",
|
|
728
|
+
"table",
|
|
729
|
+
"tbody",
|
|
730
|
+
"td",
|
|
731
|
+
"tfoot",
|
|
732
|
+
"th",
|
|
733
|
+
"thead",
|
|
734
|
+
"tr"
|
|
735
|
+
],
|
|
736
|
+
allowFullScreen: ["iframe", "video"],
|
|
737
|
+
autoPictureInPicture: ["video"],
|
|
738
|
+
charset: ["meta"],
|
|
739
|
+
checked: ["input"],
|
|
740
|
+
controls: ["audio", "video"],
|
|
741
|
+
controlsList: ["audio", "video"],
|
|
742
|
+
crossOrigin: [
|
|
743
|
+
"script",
|
|
744
|
+
"img",
|
|
745
|
+
"video",
|
|
746
|
+
"audio",
|
|
747
|
+
"link",
|
|
748
|
+
"image"
|
|
749
|
+
],
|
|
750
|
+
disablePictureInPicture: ["video"],
|
|
751
|
+
disableRemotePlayback: ["audio", "video"],
|
|
752
|
+
displaystyle: ["math"],
|
|
753
|
+
download: ["a", "area"],
|
|
754
|
+
fill: [
|
|
755
|
+
"altGlyph",
|
|
756
|
+
"circle",
|
|
757
|
+
"ellipse",
|
|
758
|
+
"g",
|
|
759
|
+
"line",
|
|
760
|
+
"marker",
|
|
761
|
+
"mask",
|
|
762
|
+
"path",
|
|
763
|
+
"polygon",
|
|
764
|
+
"polyline",
|
|
765
|
+
"rect",
|
|
766
|
+
"svg",
|
|
767
|
+
"symbol",
|
|
768
|
+
"text",
|
|
769
|
+
"textPath",
|
|
770
|
+
"tref",
|
|
771
|
+
"tspan",
|
|
772
|
+
"use",
|
|
773
|
+
"animate",
|
|
774
|
+
"animateColor",
|
|
775
|
+
"animateMotion",
|
|
776
|
+
"animateTransform",
|
|
777
|
+
"set"
|
|
778
|
+
],
|
|
779
|
+
focusable: ["svg"],
|
|
780
|
+
imageSizes: ["link"],
|
|
781
|
+
imageSrcSet: ["link"],
|
|
782
|
+
loop: ["audio", "video"],
|
|
783
|
+
mozAllowFullScreen: ["iframe", "video"],
|
|
784
|
+
muted: ["audio", "video"],
|
|
785
|
+
noModule: ["script"],
|
|
786
|
+
onAbort: ["audio", "video"],
|
|
787
|
+
onCanPlay: ["audio", "video"],
|
|
788
|
+
onCanPlayThrough: ["audio", "video"],
|
|
789
|
+
onCancel: ["dialog"],
|
|
790
|
+
onClose: ["dialog"],
|
|
791
|
+
onDurationChange: ["audio", "video"],
|
|
792
|
+
onEmptied: ["audio", "video"],
|
|
793
|
+
onEncrypted: ["audio", "video"],
|
|
794
|
+
onEnded: ["audio", "video"],
|
|
795
|
+
onError: [
|
|
796
|
+
"audio",
|
|
797
|
+
"video",
|
|
798
|
+
"img",
|
|
799
|
+
"link",
|
|
800
|
+
"source",
|
|
801
|
+
"script",
|
|
802
|
+
"picture",
|
|
803
|
+
"iframe"
|
|
804
|
+
],
|
|
805
|
+
onLoad: [
|
|
806
|
+
"script",
|
|
807
|
+
"img",
|
|
808
|
+
"link",
|
|
809
|
+
"picture",
|
|
810
|
+
"iframe",
|
|
811
|
+
"object",
|
|
812
|
+
"source"
|
|
813
|
+
],
|
|
814
|
+
onLoadStart: ["audio", "video"],
|
|
815
|
+
onLoadedData: ["audio", "video"],
|
|
816
|
+
onLoadedMetadata: ["audio", "video"],
|
|
817
|
+
onPause: ["audio", "video"],
|
|
818
|
+
onPlay: ["audio", "video"],
|
|
819
|
+
onPlaying: ["audio", "video"],
|
|
820
|
+
onProgress: ["audio", "video"],
|
|
821
|
+
onRateChange: ["audio", "video"],
|
|
822
|
+
onResize: ["audio", "video"],
|
|
823
|
+
onSeeked: ["audio", "video"],
|
|
824
|
+
onSeeking: ["audio", "video"],
|
|
825
|
+
onStalled: ["audio", "video"],
|
|
826
|
+
onSuspend: ["audio", "video"],
|
|
827
|
+
onTimeUpdate: ["audio", "video"],
|
|
828
|
+
onVolumeChange: ["audio", "video"],
|
|
829
|
+
onWaiting: ["audio", "video"],
|
|
830
|
+
playsInline: ["video"],
|
|
831
|
+
poster: ["video"],
|
|
832
|
+
preload: ["audio", "video"],
|
|
833
|
+
property: ["meta"],
|
|
834
|
+
returnValue: ["dialog"],
|
|
835
|
+
scrolling: ["iframe"],
|
|
836
|
+
valign: [
|
|
837
|
+
"tr",
|
|
838
|
+
"td",
|
|
839
|
+
"th",
|
|
840
|
+
"thead",
|
|
841
|
+
"tbody",
|
|
842
|
+
"tfoot",
|
|
843
|
+
"colgroup",
|
|
844
|
+
"col"
|
|
845
|
+
],
|
|
846
|
+
viewBox: [
|
|
847
|
+
"marker",
|
|
848
|
+
"pattern",
|
|
849
|
+
"svg",
|
|
850
|
+
"symbol",
|
|
851
|
+
"view"
|
|
852
|
+
],
|
|
853
|
+
webkitAllowFullScreen: ["iframe", "video"],
|
|
854
|
+
webkitDirectory: ["input"]
|
|
863
855
|
};
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
856
|
+
const SVGDOM_ATTRIBUTE_NAMES = {
|
|
857
|
+
"accent-height": "accentHeight",
|
|
858
|
+
"alignment-baseline": "alignmentBaseline",
|
|
859
|
+
"arabic-form": "arabicForm",
|
|
860
|
+
"baseline-shift": "baselineShift",
|
|
861
|
+
"cap-height": "capHeight",
|
|
862
|
+
"clip-path": "clipPath",
|
|
863
|
+
"clip-rule": "clipRule",
|
|
864
|
+
"color-interpolation": "colorInterpolation",
|
|
865
|
+
"color-interpolation-filters": "colorInterpolationFilters",
|
|
866
|
+
"color-profile": "colorProfile",
|
|
867
|
+
"color-rendering": "colorRendering",
|
|
868
|
+
"dominant-baseline": "dominantBaseline",
|
|
869
|
+
"enable-background": "enableBackground",
|
|
870
|
+
"fill-opacity": "fillOpacity",
|
|
871
|
+
"fill-rule": "fillRule",
|
|
872
|
+
"flood-color": "floodColor",
|
|
873
|
+
"flood-opacity": "floodOpacity",
|
|
874
|
+
"font-family": "fontFamily",
|
|
875
|
+
"font-size": "fontSize",
|
|
876
|
+
"font-size-adjust": "fontSizeAdjust",
|
|
877
|
+
"font-stretch": "fontStretch",
|
|
878
|
+
"font-style": "fontStyle",
|
|
879
|
+
"font-variant": "fontVariant",
|
|
880
|
+
"font-weight": "fontWeight",
|
|
881
|
+
"glyph-name": "glyphName",
|
|
882
|
+
"glyph-orientation-horizontal": "glyphOrientationHorizontal",
|
|
883
|
+
"glyph-orientation-vertical": "glyphOrientationVertical",
|
|
884
|
+
"horiz-adv-x": "horizAdvX",
|
|
885
|
+
"horiz-origin-x": "horizOriginX",
|
|
886
|
+
"image-rendering": "imageRendering",
|
|
887
|
+
"letter-spacing": "letterSpacing",
|
|
888
|
+
"lighting-color": "lightingColor",
|
|
889
|
+
"marker-end": "markerEnd",
|
|
890
|
+
"marker-mid": "markerMid",
|
|
891
|
+
"marker-start": "markerStart",
|
|
892
|
+
"overline-position": "overlinePosition",
|
|
893
|
+
"overline-thickness": "overlineThickness",
|
|
894
|
+
"paint-order": "paintOrder",
|
|
895
|
+
"panose-1": "panose1",
|
|
896
|
+
"pointer-events": "pointerEvents",
|
|
897
|
+
"rendering-intent": "renderingIntent",
|
|
898
|
+
"shape-rendering": "shapeRendering",
|
|
899
|
+
"stop-color": "stopColor",
|
|
900
|
+
"stop-opacity": "stopOpacity",
|
|
901
|
+
"strikethrough-position": "strikethroughPosition",
|
|
902
|
+
"strikethrough-thickness": "strikethroughThickness",
|
|
903
|
+
"stroke-dasharray": "strokeDasharray",
|
|
904
|
+
"stroke-dashoffset": "strokeDashoffset",
|
|
905
|
+
"stroke-linecap": "strokeLinecap",
|
|
906
|
+
"stroke-linejoin": "strokeLinejoin",
|
|
907
|
+
"stroke-miterlimit": "strokeMiterlimit",
|
|
908
|
+
"stroke-opacity": "strokeOpacity",
|
|
909
|
+
"stroke-width": "strokeWidth",
|
|
910
|
+
"text-anchor": "textAnchor",
|
|
911
|
+
"text-decoration": "textDecoration",
|
|
912
|
+
"text-rendering": "textRendering",
|
|
913
|
+
"underline-position": "underlinePosition",
|
|
914
|
+
"underline-thickness": "underlineThickness",
|
|
915
|
+
"unicode-bidi": "unicodeBidi",
|
|
916
|
+
"unicode-range": "unicodeRange",
|
|
917
|
+
"units-per-em": "unitsPerEm",
|
|
918
|
+
"v-alphabetic": "vAlphabetic",
|
|
919
|
+
"v-hanging": "vHanging",
|
|
920
|
+
"v-ideographic": "vIdeographic",
|
|
921
|
+
"v-mathematical": "vMathematical",
|
|
922
|
+
"vector-effect": "vectorEffect",
|
|
923
|
+
"vert-adv-y": "vertAdvY",
|
|
924
|
+
"vert-origin-x": "vertOriginX",
|
|
925
|
+
"vert-origin-y": "vertOriginY",
|
|
926
|
+
"word-spacing": "wordSpacing",
|
|
927
|
+
"writing-mode": "writingMode",
|
|
928
|
+
"x-height": "xHeight",
|
|
929
|
+
"xlink:actuate": "xlinkActuate",
|
|
930
|
+
"xlink:arcrole": "xlinkArcrole",
|
|
931
|
+
"xlink:href": "xlinkHref",
|
|
932
|
+
"xlink:role": "xlinkRole",
|
|
933
|
+
"xlink:show": "xlinkShow",
|
|
934
|
+
"xlink:title": "xlinkTitle",
|
|
935
|
+
"xlink:type": "xlinkType",
|
|
936
|
+
"xml:base": "xmlBase",
|
|
937
|
+
"xml:lang": "xmlLang",
|
|
938
|
+
"xml:space": "xmlSpace"
|
|
947
939
|
};
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
// OpenGraph meta tag attributes
|
|
1140
|
-
"property",
|
|
1141
|
-
// React specific attributes
|
|
1142
|
-
"ref",
|
|
1143
|
-
"key",
|
|
1144
|
-
"children",
|
|
1145
|
-
// Non-standard
|
|
1146
|
-
"results",
|
|
1147
|
-
"security",
|
|
1148
|
-
// Video specific
|
|
1149
|
-
"controls"
|
|
940
|
+
const DOM_PROPERTY_NAMES_ONE_WORD = [
|
|
941
|
+
"dir",
|
|
942
|
+
"draggable",
|
|
943
|
+
"hidden",
|
|
944
|
+
"id",
|
|
945
|
+
"lang",
|
|
946
|
+
"nonce",
|
|
947
|
+
"part",
|
|
948
|
+
"slot",
|
|
949
|
+
"style",
|
|
950
|
+
"title",
|
|
951
|
+
"translate",
|
|
952
|
+
"inert",
|
|
953
|
+
"accept",
|
|
954
|
+
"action",
|
|
955
|
+
"allow",
|
|
956
|
+
"alt",
|
|
957
|
+
"as",
|
|
958
|
+
"async",
|
|
959
|
+
"buffered",
|
|
960
|
+
"capture",
|
|
961
|
+
"challenge",
|
|
962
|
+
"cite",
|
|
963
|
+
"code",
|
|
964
|
+
"cols",
|
|
965
|
+
"content",
|
|
966
|
+
"coords",
|
|
967
|
+
"csp",
|
|
968
|
+
"data",
|
|
969
|
+
"decoding",
|
|
970
|
+
"default",
|
|
971
|
+
"defer",
|
|
972
|
+
"disabled",
|
|
973
|
+
"form",
|
|
974
|
+
"headers",
|
|
975
|
+
"height",
|
|
976
|
+
"high",
|
|
977
|
+
"href",
|
|
978
|
+
"icon",
|
|
979
|
+
"importance",
|
|
980
|
+
"integrity",
|
|
981
|
+
"kind",
|
|
982
|
+
"label",
|
|
983
|
+
"language",
|
|
984
|
+
"loading",
|
|
985
|
+
"list",
|
|
986
|
+
"loop",
|
|
987
|
+
"low",
|
|
988
|
+
"manifest",
|
|
989
|
+
"max",
|
|
990
|
+
"media",
|
|
991
|
+
"method",
|
|
992
|
+
"min",
|
|
993
|
+
"multiple",
|
|
994
|
+
"muted",
|
|
995
|
+
"name",
|
|
996
|
+
"open",
|
|
997
|
+
"optimum",
|
|
998
|
+
"pattern",
|
|
999
|
+
"ping",
|
|
1000
|
+
"placeholder",
|
|
1001
|
+
"poster",
|
|
1002
|
+
"preload",
|
|
1003
|
+
"profile",
|
|
1004
|
+
"rel",
|
|
1005
|
+
"required",
|
|
1006
|
+
"reversed",
|
|
1007
|
+
"role",
|
|
1008
|
+
"rows",
|
|
1009
|
+
"sandbox",
|
|
1010
|
+
"scope",
|
|
1011
|
+
"seamless",
|
|
1012
|
+
"selected",
|
|
1013
|
+
"shape",
|
|
1014
|
+
"size",
|
|
1015
|
+
"sizes",
|
|
1016
|
+
"span",
|
|
1017
|
+
"src",
|
|
1018
|
+
"start",
|
|
1019
|
+
"step",
|
|
1020
|
+
"summary",
|
|
1021
|
+
"target",
|
|
1022
|
+
"type",
|
|
1023
|
+
"value",
|
|
1024
|
+
"width",
|
|
1025
|
+
"wmode",
|
|
1026
|
+
"wrap",
|
|
1027
|
+
"accumulate",
|
|
1028
|
+
"additive",
|
|
1029
|
+
"alphabetic",
|
|
1030
|
+
"amplitude",
|
|
1031
|
+
"ascent",
|
|
1032
|
+
"azimuth",
|
|
1033
|
+
"bbox",
|
|
1034
|
+
"begin",
|
|
1035
|
+
"bias",
|
|
1036
|
+
"by",
|
|
1037
|
+
"clip",
|
|
1038
|
+
"color",
|
|
1039
|
+
"cursor",
|
|
1040
|
+
"cx",
|
|
1041
|
+
"cy",
|
|
1042
|
+
"d",
|
|
1043
|
+
"decelerate",
|
|
1044
|
+
"descent",
|
|
1045
|
+
"direction",
|
|
1046
|
+
"display",
|
|
1047
|
+
"divisor",
|
|
1048
|
+
"dur",
|
|
1049
|
+
"dx",
|
|
1050
|
+
"dy",
|
|
1051
|
+
"elevation",
|
|
1052
|
+
"end",
|
|
1053
|
+
"exponent",
|
|
1054
|
+
"fill",
|
|
1055
|
+
"filter",
|
|
1056
|
+
"format",
|
|
1057
|
+
"from",
|
|
1058
|
+
"fr",
|
|
1059
|
+
"fx",
|
|
1060
|
+
"fy",
|
|
1061
|
+
"g1",
|
|
1062
|
+
"g2",
|
|
1063
|
+
"hanging",
|
|
1064
|
+
"height",
|
|
1065
|
+
"hreflang",
|
|
1066
|
+
"ideographic",
|
|
1067
|
+
"in",
|
|
1068
|
+
"in2",
|
|
1069
|
+
"intercept",
|
|
1070
|
+
"k",
|
|
1071
|
+
"k1",
|
|
1072
|
+
"k2",
|
|
1073
|
+
"k3",
|
|
1074
|
+
"k4",
|
|
1075
|
+
"kerning",
|
|
1076
|
+
"local",
|
|
1077
|
+
"mask",
|
|
1078
|
+
"mode",
|
|
1079
|
+
"offset",
|
|
1080
|
+
"opacity",
|
|
1081
|
+
"operator",
|
|
1082
|
+
"order",
|
|
1083
|
+
"orient",
|
|
1084
|
+
"orientation",
|
|
1085
|
+
"origin",
|
|
1086
|
+
"overflow",
|
|
1087
|
+
"path",
|
|
1088
|
+
"ping",
|
|
1089
|
+
"points",
|
|
1090
|
+
"r",
|
|
1091
|
+
"radius",
|
|
1092
|
+
"rel",
|
|
1093
|
+
"restart",
|
|
1094
|
+
"result",
|
|
1095
|
+
"rotate",
|
|
1096
|
+
"rx",
|
|
1097
|
+
"ry",
|
|
1098
|
+
"scale",
|
|
1099
|
+
"seed",
|
|
1100
|
+
"slope",
|
|
1101
|
+
"spacing",
|
|
1102
|
+
"speed",
|
|
1103
|
+
"stemh",
|
|
1104
|
+
"stemv",
|
|
1105
|
+
"string",
|
|
1106
|
+
"stroke",
|
|
1107
|
+
"to",
|
|
1108
|
+
"transform",
|
|
1109
|
+
"u1",
|
|
1110
|
+
"u2",
|
|
1111
|
+
"unicode",
|
|
1112
|
+
"values",
|
|
1113
|
+
"version",
|
|
1114
|
+
"visibility",
|
|
1115
|
+
"widths",
|
|
1116
|
+
"x",
|
|
1117
|
+
"x1",
|
|
1118
|
+
"x2",
|
|
1119
|
+
"xmlns",
|
|
1120
|
+
"y",
|
|
1121
|
+
"y1",
|
|
1122
|
+
"y2",
|
|
1123
|
+
"z",
|
|
1124
|
+
"property",
|
|
1125
|
+
"ref",
|
|
1126
|
+
"key",
|
|
1127
|
+
"children",
|
|
1128
|
+
"results",
|
|
1129
|
+
"security",
|
|
1130
|
+
"controls"
|
|
1150
1131
|
];
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
"onDragStartCapture",
|
|
1512
|
-
"onDropCapture",
|
|
1513
|
-
"onMouseDown",
|
|
1514
|
-
"onMouseDownCapture",
|
|
1515
|
-
"onMouseMoveCapture",
|
|
1516
|
-
"onMouseOutCapture",
|
|
1517
|
-
"onMouseOverCapture",
|
|
1518
|
-
"onMouseUpCapture",
|
|
1519
|
-
// Video specific
|
|
1520
|
-
"autoPictureInPicture",
|
|
1521
|
-
"controlsList",
|
|
1522
|
-
"disablePictureInPicture",
|
|
1523
|
-
"disableRemotePlayback"
|
|
1132
|
+
const DOM_PROPERTY_NAMES_TWO_WORDS = [
|
|
1133
|
+
"accessKey",
|
|
1134
|
+
"autoCapitalize",
|
|
1135
|
+
"autoFocus",
|
|
1136
|
+
"contentEditable",
|
|
1137
|
+
"enterKeyHint",
|
|
1138
|
+
"exportParts",
|
|
1139
|
+
"inputMode",
|
|
1140
|
+
"itemID",
|
|
1141
|
+
"itemRef",
|
|
1142
|
+
"itemProp",
|
|
1143
|
+
"itemScope",
|
|
1144
|
+
"itemType",
|
|
1145
|
+
"spellCheck",
|
|
1146
|
+
"tabIndex",
|
|
1147
|
+
"acceptCharset",
|
|
1148
|
+
"autoComplete",
|
|
1149
|
+
"autoPlay",
|
|
1150
|
+
"border",
|
|
1151
|
+
"cellPadding",
|
|
1152
|
+
"cellSpacing",
|
|
1153
|
+
"classID",
|
|
1154
|
+
"codeBase",
|
|
1155
|
+
"colSpan",
|
|
1156
|
+
"contextMenu",
|
|
1157
|
+
"dateTime",
|
|
1158
|
+
"encType",
|
|
1159
|
+
"formAction",
|
|
1160
|
+
"formEncType",
|
|
1161
|
+
"formMethod",
|
|
1162
|
+
"formNoValidate",
|
|
1163
|
+
"formTarget",
|
|
1164
|
+
"frameBorder",
|
|
1165
|
+
"hrefLang",
|
|
1166
|
+
"httpEquiv",
|
|
1167
|
+
"imageSizes",
|
|
1168
|
+
"imageSrcSet",
|
|
1169
|
+
"isMap",
|
|
1170
|
+
"keyParams",
|
|
1171
|
+
"keyType",
|
|
1172
|
+
"marginHeight",
|
|
1173
|
+
"marginWidth",
|
|
1174
|
+
"maxLength",
|
|
1175
|
+
"mediaGroup",
|
|
1176
|
+
"minLength",
|
|
1177
|
+
"noValidate",
|
|
1178
|
+
"onAnimationEnd",
|
|
1179
|
+
"onAnimationIteration",
|
|
1180
|
+
"onAnimationStart",
|
|
1181
|
+
"onBlur",
|
|
1182
|
+
"onChange",
|
|
1183
|
+
"onClick",
|
|
1184
|
+
"onContextMenu",
|
|
1185
|
+
"onCopy",
|
|
1186
|
+
"onCompositionEnd",
|
|
1187
|
+
"onCompositionStart",
|
|
1188
|
+
"onCompositionUpdate",
|
|
1189
|
+
"onCut",
|
|
1190
|
+
"onDoubleClick",
|
|
1191
|
+
"onDrag",
|
|
1192
|
+
"onDragEnd",
|
|
1193
|
+
"onDragEnter",
|
|
1194
|
+
"onDragExit",
|
|
1195
|
+
"onDragLeave",
|
|
1196
|
+
"onError",
|
|
1197
|
+
"onFocus",
|
|
1198
|
+
"onInput",
|
|
1199
|
+
"onKeyDown",
|
|
1200
|
+
"onKeyPress",
|
|
1201
|
+
"onKeyUp",
|
|
1202
|
+
"onLoad",
|
|
1203
|
+
"onWheel",
|
|
1204
|
+
"onDragOver",
|
|
1205
|
+
"onDragStart",
|
|
1206
|
+
"onDrop",
|
|
1207
|
+
"onMouseDown",
|
|
1208
|
+
"onMouseEnter",
|
|
1209
|
+
"onMouseLeave",
|
|
1210
|
+
"onMouseMove",
|
|
1211
|
+
"onMouseOut",
|
|
1212
|
+
"onMouseOver",
|
|
1213
|
+
"onMouseUp",
|
|
1214
|
+
"onPaste",
|
|
1215
|
+
"onScroll",
|
|
1216
|
+
"onSelect",
|
|
1217
|
+
"onSubmit",
|
|
1218
|
+
"onToggle",
|
|
1219
|
+
"onTransitionEnd",
|
|
1220
|
+
"radioGroup",
|
|
1221
|
+
"readOnly",
|
|
1222
|
+
"referrerPolicy",
|
|
1223
|
+
"rowSpan",
|
|
1224
|
+
"srcDoc",
|
|
1225
|
+
"srcLang",
|
|
1226
|
+
"srcSet",
|
|
1227
|
+
"useMap",
|
|
1228
|
+
"fetchPriority",
|
|
1229
|
+
"crossOrigin",
|
|
1230
|
+
"accentHeight",
|
|
1231
|
+
"alignmentBaseline",
|
|
1232
|
+
"arabicForm",
|
|
1233
|
+
"attributeName",
|
|
1234
|
+
"attributeType",
|
|
1235
|
+
"baseFrequency",
|
|
1236
|
+
"baselineShift",
|
|
1237
|
+
"baseProfile",
|
|
1238
|
+
"calcMode",
|
|
1239
|
+
"capHeight",
|
|
1240
|
+
"clipPathUnits",
|
|
1241
|
+
"clipPath",
|
|
1242
|
+
"clipRule",
|
|
1243
|
+
"colorInterpolation",
|
|
1244
|
+
"colorInterpolationFilters",
|
|
1245
|
+
"colorProfile",
|
|
1246
|
+
"colorRendering",
|
|
1247
|
+
"contentScriptType",
|
|
1248
|
+
"contentStyleType",
|
|
1249
|
+
"diffuseConstant",
|
|
1250
|
+
"dominantBaseline",
|
|
1251
|
+
"edgeMode",
|
|
1252
|
+
"enableBackground",
|
|
1253
|
+
"fillOpacity",
|
|
1254
|
+
"fillRule",
|
|
1255
|
+
"filterRes",
|
|
1256
|
+
"filterUnits",
|
|
1257
|
+
"floodColor",
|
|
1258
|
+
"floodOpacity",
|
|
1259
|
+
"fontFamily",
|
|
1260
|
+
"fontSize",
|
|
1261
|
+
"fontSizeAdjust",
|
|
1262
|
+
"fontStretch",
|
|
1263
|
+
"fontStyle",
|
|
1264
|
+
"fontVariant",
|
|
1265
|
+
"fontWeight",
|
|
1266
|
+
"glyphName",
|
|
1267
|
+
"glyphOrientationHorizontal",
|
|
1268
|
+
"glyphOrientationVertical",
|
|
1269
|
+
"glyphRef",
|
|
1270
|
+
"gradientTransform",
|
|
1271
|
+
"gradientUnits",
|
|
1272
|
+
"horizAdvX",
|
|
1273
|
+
"horizOriginX",
|
|
1274
|
+
"imageRendering",
|
|
1275
|
+
"kernelMatrix",
|
|
1276
|
+
"kernelUnitLength",
|
|
1277
|
+
"keyPoints",
|
|
1278
|
+
"keySplines",
|
|
1279
|
+
"keyTimes",
|
|
1280
|
+
"lengthAdjust",
|
|
1281
|
+
"letterSpacing",
|
|
1282
|
+
"lightingColor",
|
|
1283
|
+
"limitingConeAngle",
|
|
1284
|
+
"markerEnd",
|
|
1285
|
+
"markerMid",
|
|
1286
|
+
"markerStart",
|
|
1287
|
+
"markerHeight",
|
|
1288
|
+
"markerUnits",
|
|
1289
|
+
"markerWidth",
|
|
1290
|
+
"maskContentUnits",
|
|
1291
|
+
"maskUnits",
|
|
1292
|
+
"mathematical",
|
|
1293
|
+
"numOctaves",
|
|
1294
|
+
"overlinePosition",
|
|
1295
|
+
"overlineThickness",
|
|
1296
|
+
"panose1",
|
|
1297
|
+
"paintOrder",
|
|
1298
|
+
"pathLength",
|
|
1299
|
+
"patternContentUnits",
|
|
1300
|
+
"patternTransform",
|
|
1301
|
+
"patternUnits",
|
|
1302
|
+
"pointerEvents",
|
|
1303
|
+
"pointsAtX",
|
|
1304
|
+
"pointsAtY",
|
|
1305
|
+
"pointsAtZ",
|
|
1306
|
+
"preserveAlpha",
|
|
1307
|
+
"preserveAspectRatio",
|
|
1308
|
+
"primitiveUnits",
|
|
1309
|
+
"referrerPolicy",
|
|
1310
|
+
"refX",
|
|
1311
|
+
"refY",
|
|
1312
|
+
"rendering-intent",
|
|
1313
|
+
"repeatCount",
|
|
1314
|
+
"repeatDur",
|
|
1315
|
+
"requiredExtensions",
|
|
1316
|
+
"requiredFeatures",
|
|
1317
|
+
"shapeRendering",
|
|
1318
|
+
"specularConstant",
|
|
1319
|
+
"specularExponent",
|
|
1320
|
+
"spreadMethod",
|
|
1321
|
+
"startOffset",
|
|
1322
|
+
"stdDeviation",
|
|
1323
|
+
"stitchTiles",
|
|
1324
|
+
"stopColor",
|
|
1325
|
+
"stopOpacity",
|
|
1326
|
+
"strikethroughPosition",
|
|
1327
|
+
"strikethroughThickness",
|
|
1328
|
+
"strokeDasharray",
|
|
1329
|
+
"strokeDashoffset",
|
|
1330
|
+
"strokeLinecap",
|
|
1331
|
+
"strokeLinejoin",
|
|
1332
|
+
"strokeMiterlimit",
|
|
1333
|
+
"strokeOpacity",
|
|
1334
|
+
"strokeWidth",
|
|
1335
|
+
"surfaceScale",
|
|
1336
|
+
"systemLanguage",
|
|
1337
|
+
"tableValues",
|
|
1338
|
+
"targetX",
|
|
1339
|
+
"targetY",
|
|
1340
|
+
"textAnchor",
|
|
1341
|
+
"textDecoration",
|
|
1342
|
+
"textRendering",
|
|
1343
|
+
"textLength",
|
|
1344
|
+
"transformOrigin",
|
|
1345
|
+
"underlinePosition",
|
|
1346
|
+
"underlineThickness",
|
|
1347
|
+
"unicodeBidi",
|
|
1348
|
+
"unicodeRange",
|
|
1349
|
+
"unitsPerEm",
|
|
1350
|
+
"vAlphabetic",
|
|
1351
|
+
"vHanging",
|
|
1352
|
+
"vIdeographic",
|
|
1353
|
+
"vMathematical",
|
|
1354
|
+
"vectorEffect",
|
|
1355
|
+
"vertAdvY",
|
|
1356
|
+
"vertOriginX",
|
|
1357
|
+
"vertOriginY",
|
|
1358
|
+
"viewBox",
|
|
1359
|
+
"viewTarget",
|
|
1360
|
+
"wordSpacing",
|
|
1361
|
+
"writingMode",
|
|
1362
|
+
"xHeight",
|
|
1363
|
+
"xChannelSelector",
|
|
1364
|
+
"xlinkActuate",
|
|
1365
|
+
"xlinkArcrole",
|
|
1366
|
+
"xlinkHref",
|
|
1367
|
+
"xlinkRole",
|
|
1368
|
+
"xlinkShow",
|
|
1369
|
+
"xlinkTitle",
|
|
1370
|
+
"xlinkType",
|
|
1371
|
+
"xmlBase",
|
|
1372
|
+
"xmlLang",
|
|
1373
|
+
"xmlnsXlink",
|
|
1374
|
+
"xmlSpace",
|
|
1375
|
+
"yChannelSelector",
|
|
1376
|
+
"zoomAndPan",
|
|
1377
|
+
"autoCorrect",
|
|
1378
|
+
"autoSave",
|
|
1379
|
+
"className",
|
|
1380
|
+
"dangerouslySetInnerHTML",
|
|
1381
|
+
"defaultValue",
|
|
1382
|
+
"defaultChecked",
|
|
1383
|
+
"htmlFor",
|
|
1384
|
+
"onBeforeInput",
|
|
1385
|
+
"onChange",
|
|
1386
|
+
"onInvalid",
|
|
1387
|
+
"onReset",
|
|
1388
|
+
"onTouchCancel",
|
|
1389
|
+
"onTouchEnd",
|
|
1390
|
+
"onTouchMove",
|
|
1391
|
+
"onTouchStart",
|
|
1392
|
+
"suppressContentEditableWarning",
|
|
1393
|
+
"suppressHydrationWarning",
|
|
1394
|
+
"onAbort",
|
|
1395
|
+
"onCanPlay",
|
|
1396
|
+
"onCanPlayThrough",
|
|
1397
|
+
"onDurationChange",
|
|
1398
|
+
"onEmptied",
|
|
1399
|
+
"onEncrypted",
|
|
1400
|
+
"onEnded",
|
|
1401
|
+
"onLoadedData",
|
|
1402
|
+
"onLoadedMetadata",
|
|
1403
|
+
"onLoadStart",
|
|
1404
|
+
"onPause",
|
|
1405
|
+
"onPlay",
|
|
1406
|
+
"onPlaying",
|
|
1407
|
+
"onProgress",
|
|
1408
|
+
"onRateChange",
|
|
1409
|
+
"onResize",
|
|
1410
|
+
"onSeeked",
|
|
1411
|
+
"onSeeking",
|
|
1412
|
+
"onStalled",
|
|
1413
|
+
"onSuspend",
|
|
1414
|
+
"onTimeUpdate",
|
|
1415
|
+
"onVolumeChange",
|
|
1416
|
+
"onWaiting",
|
|
1417
|
+
"onCopyCapture",
|
|
1418
|
+
"onCutCapture",
|
|
1419
|
+
"onPasteCapture",
|
|
1420
|
+
"onCompositionEndCapture",
|
|
1421
|
+
"onCompositionStartCapture",
|
|
1422
|
+
"onCompositionUpdateCapture",
|
|
1423
|
+
"onFocusCapture",
|
|
1424
|
+
"onBlurCapture",
|
|
1425
|
+
"onChangeCapture",
|
|
1426
|
+
"onBeforeInputCapture",
|
|
1427
|
+
"onInputCapture",
|
|
1428
|
+
"onResetCapture",
|
|
1429
|
+
"onSubmitCapture",
|
|
1430
|
+
"onInvalidCapture",
|
|
1431
|
+
"onLoadCapture",
|
|
1432
|
+
"onErrorCapture",
|
|
1433
|
+
"onKeyDownCapture",
|
|
1434
|
+
"onKeyPressCapture",
|
|
1435
|
+
"onKeyUpCapture",
|
|
1436
|
+
"onAbortCapture",
|
|
1437
|
+
"onCanPlayCapture",
|
|
1438
|
+
"onCanPlayThroughCapture",
|
|
1439
|
+
"onDurationChangeCapture",
|
|
1440
|
+
"onEmptiedCapture",
|
|
1441
|
+
"onEncryptedCapture",
|
|
1442
|
+
"onEndedCapture",
|
|
1443
|
+
"onLoadedDataCapture",
|
|
1444
|
+
"onLoadedMetadataCapture",
|
|
1445
|
+
"onLoadStartCapture",
|
|
1446
|
+
"onPauseCapture",
|
|
1447
|
+
"onPlayCapture",
|
|
1448
|
+
"onPlayingCapture",
|
|
1449
|
+
"onProgressCapture",
|
|
1450
|
+
"onRateChangeCapture",
|
|
1451
|
+
"onSeekedCapture",
|
|
1452
|
+
"onSeekingCapture",
|
|
1453
|
+
"onStalledCapture",
|
|
1454
|
+
"onSuspendCapture",
|
|
1455
|
+
"onTimeUpdateCapture",
|
|
1456
|
+
"onVolumeChangeCapture",
|
|
1457
|
+
"onWaitingCapture",
|
|
1458
|
+
"onSelectCapture",
|
|
1459
|
+
"onTouchCancelCapture",
|
|
1460
|
+
"onTouchEndCapture",
|
|
1461
|
+
"onTouchMoveCapture",
|
|
1462
|
+
"onTouchStartCapture",
|
|
1463
|
+
"onScrollCapture",
|
|
1464
|
+
"onWheelCapture",
|
|
1465
|
+
"onAnimationEndCapture",
|
|
1466
|
+
"onAnimationIteration",
|
|
1467
|
+
"onAnimationStartCapture",
|
|
1468
|
+
"onTransitionEndCapture",
|
|
1469
|
+
"onAuxClick",
|
|
1470
|
+
"onAuxClickCapture",
|
|
1471
|
+
"onClickCapture",
|
|
1472
|
+
"onContextMenuCapture",
|
|
1473
|
+
"onDoubleClickCapture",
|
|
1474
|
+
"onDragCapture",
|
|
1475
|
+
"onDragEndCapture",
|
|
1476
|
+
"onDragEnterCapture",
|
|
1477
|
+
"onDragExitCapture",
|
|
1478
|
+
"onDragLeaveCapture",
|
|
1479
|
+
"onDragOverCapture",
|
|
1480
|
+
"onDragStartCapture",
|
|
1481
|
+
"onDropCapture",
|
|
1482
|
+
"onMouseDown",
|
|
1483
|
+
"onMouseDownCapture",
|
|
1484
|
+
"onMouseMoveCapture",
|
|
1485
|
+
"onMouseOutCapture",
|
|
1486
|
+
"onMouseOverCapture",
|
|
1487
|
+
"onMouseUpCapture",
|
|
1488
|
+
"autoPictureInPicture",
|
|
1489
|
+
"controlsList",
|
|
1490
|
+
"disablePictureInPicture",
|
|
1491
|
+
"disableRemotePlayback"
|
|
1524
1492
|
];
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1493
|
+
const DOM_PROPERTIES_IGNORE_CASE = [
|
|
1494
|
+
"charset",
|
|
1495
|
+
"allowFullScreen",
|
|
1496
|
+
"webkitAllowFullScreen",
|
|
1497
|
+
"mozAllowFullScreen",
|
|
1498
|
+
"webkitDirectory"
|
|
1531
1499
|
];
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
"aria-rowindex",
|
|
1587
|
-
"aria-rowindextext",
|
|
1588
|
-
"aria-rowspan",
|
|
1589
|
-
"aria-setsize"
|
|
1500
|
+
const ARIA_PROPERTIES = [
|
|
1501
|
+
"aria-atomic",
|
|
1502
|
+
"aria-braillelabel",
|
|
1503
|
+
"aria-brailleroledescription",
|
|
1504
|
+
"aria-busy",
|
|
1505
|
+
"aria-controls",
|
|
1506
|
+
"aria-current",
|
|
1507
|
+
"aria-describedby",
|
|
1508
|
+
"aria-description",
|
|
1509
|
+
"aria-details",
|
|
1510
|
+
"aria-disabled",
|
|
1511
|
+
"aria-dropeffect",
|
|
1512
|
+
"aria-errormessage",
|
|
1513
|
+
"aria-flowto",
|
|
1514
|
+
"aria-grabbed",
|
|
1515
|
+
"aria-haspopup",
|
|
1516
|
+
"aria-hidden",
|
|
1517
|
+
"aria-invalid",
|
|
1518
|
+
"aria-keyshortcuts",
|
|
1519
|
+
"aria-label",
|
|
1520
|
+
"aria-labelledby",
|
|
1521
|
+
"aria-live",
|
|
1522
|
+
"aria-owns",
|
|
1523
|
+
"aria-relevant",
|
|
1524
|
+
"aria-roledescription",
|
|
1525
|
+
"aria-autocomplete",
|
|
1526
|
+
"aria-checked",
|
|
1527
|
+
"aria-expanded",
|
|
1528
|
+
"aria-level",
|
|
1529
|
+
"aria-modal",
|
|
1530
|
+
"aria-multiline",
|
|
1531
|
+
"aria-multiselectable",
|
|
1532
|
+
"aria-orientation",
|
|
1533
|
+
"aria-placeholder",
|
|
1534
|
+
"aria-pressed",
|
|
1535
|
+
"aria-readonly",
|
|
1536
|
+
"aria-required",
|
|
1537
|
+
"aria-selected",
|
|
1538
|
+
"aria-sort",
|
|
1539
|
+
"aria-valuemax",
|
|
1540
|
+
"aria-valuemin",
|
|
1541
|
+
"aria-valuenow",
|
|
1542
|
+
"aria-valuetext",
|
|
1543
|
+
"aria-activedescendant",
|
|
1544
|
+
"aria-colcount",
|
|
1545
|
+
"aria-colindex",
|
|
1546
|
+
"aria-colindextext",
|
|
1547
|
+
"aria-colspan",
|
|
1548
|
+
"aria-posinset",
|
|
1549
|
+
"aria-rowcount",
|
|
1550
|
+
"aria-rowindex",
|
|
1551
|
+
"aria-rowindextext",
|
|
1552
|
+
"aria-rowspan",
|
|
1553
|
+
"aria-setsize"
|
|
1590
1554
|
];
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1555
|
+
const REACT_ON_PROPS = [
|
|
1556
|
+
"onGotPointerCapture",
|
|
1557
|
+
"onGotPointerCaptureCapture",
|
|
1558
|
+
"onLostPointerCapture",
|
|
1559
|
+
"onLostPointerCapture",
|
|
1560
|
+
"onLostPointerCaptureCapture",
|
|
1561
|
+
"onPointerCancel",
|
|
1562
|
+
"onPointerCancelCapture",
|
|
1563
|
+
"onPointerDown",
|
|
1564
|
+
"onPointerDownCapture",
|
|
1565
|
+
"onPointerEnter",
|
|
1566
|
+
"onPointerEnterCapture",
|
|
1567
|
+
"onPointerLeave",
|
|
1568
|
+
"onPointerLeaveCapture",
|
|
1569
|
+
"onPointerMove",
|
|
1570
|
+
"onPointerMoveCapture",
|
|
1571
|
+
"onPointerOut",
|
|
1572
|
+
"onPointerOutCapture",
|
|
1573
|
+
"onPointerOver",
|
|
1574
|
+
"onPointerOverCapture",
|
|
1575
|
+
"onPointerUp",
|
|
1576
|
+
"onPointerUpCapture"
|
|
1613
1577
|
];
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1578
|
+
const POPOVER_API_PROPS = [
|
|
1579
|
+
"popover",
|
|
1580
|
+
"popoverTarget",
|
|
1581
|
+
"popoverTargetAction",
|
|
1582
|
+
"onToggle",
|
|
1583
|
+
"onBeforeToggle"
|
|
1620
1584
|
];
|
|
1621
1585
|
function getDOMPropertyNames(context) {
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
testReactVersion(context, ">=", "19.0.0-rc.0") ? ALL_DOM_PROPERTY_NAMES.push(...POPOVER_API_PROPS) : ALL_DOM_PROPERTY_NAMES.push(...POPOVER_API_PROPS.map((prop) => prop.toLowerCase()));
|
|
1631
|
-
return ALL_DOM_PROPERTY_NAMES;
|
|
1586
|
+
const ALL_DOM_PROPERTY_NAMES = DOM_PROPERTY_NAMES_TWO_WORDS.concat(DOM_PROPERTY_NAMES_ONE_WORD);
|
|
1587
|
+
if (testReactVersion(context, "<=", "16.1.0")) {
|
|
1588
|
+
ALL_DOM_PROPERTY_NAMES.push("allowTransparency");
|
|
1589
|
+
return ALL_DOM_PROPERTY_NAMES;
|
|
1590
|
+
}
|
|
1591
|
+
if (testReactVersion(context, ">=", "16.4.0")) ALL_DOM_PROPERTY_NAMES.push(...REACT_ON_PROPS);
|
|
1592
|
+
testReactVersion(context, ">=", "19.0.0-rc.0") ? ALL_DOM_PROPERTY_NAMES.push(...POPOVER_API_PROPS) : ALL_DOM_PROPERTY_NAMES.push(...POPOVER_API_PROPS.map((prop) => prop.toLowerCase()));
|
|
1593
|
+
return ALL_DOM_PROPERTY_NAMES;
|
|
1632
1594
|
}
|
|
1595
|
+
/**
|
|
1596
|
+
* Checks if a node's parent is a JSX tag that is written with lowercase letters,
|
|
1597
|
+
* and is not a custom web component. Custom web components have a hyphen in tag name,
|
|
1598
|
+
* or have an `is="some-elem"` attribute.
|
|
1599
|
+
*
|
|
1600
|
+
* Note: does not check if a tag's parent against a list of standard HTML/DOM tags. For example,
|
|
1601
|
+
* a `<fake>`'s child would return `true` because "fake" is written only with lowercase letters
|
|
1602
|
+
* without a hyphen and does not have a `is="some-elem"` attribute.
|
|
1603
|
+
* @param childNode - JSX element being tested.
|
|
1604
|
+
* @returns Whether or not the node name match the JSX tag convention.
|
|
1605
|
+
*/
|
|
1633
1606
|
function isValidHTMLTagInJSX(childNode) {
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
(attrNode) => attrNode.type === "JSXAttribute" && attrNode.name.type === "JSXIdentifier" && attrNode.name.name === "is"
|
|
1638
|
-
// To learn more about custom web components and `is` attribute,
|
|
1639
|
-
// see https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements-customized-builtin-example
|
|
1640
|
-
);
|
|
1641
|
-
}
|
|
1642
|
-
return false;
|
|
1607
|
+
const tagConvention = /^[a-z][^-]*$/;
|
|
1608
|
+
if (tagConvention.test(childNode.parent.name.name)) return !childNode.parent.attributes.some((attrNode) => attrNode.type === "JSXAttribute" && attrNode.name.type === "JSXIdentifier" && attrNode.name.name === "is");
|
|
1609
|
+
return false;
|
|
1643
1610
|
}
|
|
1644
|
-
|
|
1645
|
-
|
|
1611
|
+
/**
|
|
1612
|
+
* Checks if the attribute name is included in the attributes that are excluded
|
|
1613
|
+
* from the camel casing.
|
|
1614
|
+
*
|
|
1615
|
+
* // returns 'charSet'
|
|
1616
|
+
* @example normalizeAttributeCase('charset')
|
|
1617
|
+
*
|
|
1618
|
+
* Note - these exclusions are not made by React core team, but `eslint-plugin-react` community.
|
|
1619
|
+
* @param name - Attribute name to be normalized
|
|
1620
|
+
* @returns Result
|
|
1621
|
+
*/
|
|
1622
|
+
function normalizeAttributeCase(name$2) {
|
|
1623
|
+
return DOM_PROPERTIES_IGNORE_CASE.find((element) => element.toLowerCase() === name$2.toLowerCase()) || name$2;
|
|
1646
1624
|
}
|
|
1647
|
-
|
|
1648
|
-
|
|
1625
|
+
/**
|
|
1626
|
+
* Checks if an attribute name is a valid `data-*` attribute:
|
|
1627
|
+
* if the name starts with "data-" and has alphanumeric words (browsers require lowercase, but React and TS lowercase them),
|
|
1628
|
+
* not start with any casing of "xml", and separated by hyphens (-) (which is also called "kebab case" or "dash case"),
|
|
1629
|
+
* then the attribute is a valid data attribute.
|
|
1630
|
+
* @param name - Attribute name to be tested
|
|
1631
|
+
* @returns Result
|
|
1632
|
+
*/
|
|
1633
|
+
function isValidDataAttribute(name$2) {
|
|
1634
|
+
return !/^data-xml/i.test(name$2) && /^data-[^:]*$/.test(name$2);
|
|
1649
1635
|
}
|
|
1650
|
-
|
|
1651
|
-
|
|
1636
|
+
/**
|
|
1637
|
+
* Checks if an attribute name has at least one uppercase characters
|
|
1638
|
+
* @param name
|
|
1639
|
+
* @returns Result
|
|
1640
|
+
*/
|
|
1641
|
+
function hasUpperCaseCharacter(name$2) {
|
|
1642
|
+
return name$2.toLowerCase() !== name$2;
|
|
1652
1643
|
}
|
|
1653
|
-
|
|
1654
|
-
|
|
1644
|
+
/**
|
|
1645
|
+
* Checks if an attribute name is a standard aria attribute by compering it to a list
|
|
1646
|
+
* of standard aria property names
|
|
1647
|
+
* @param {string} name - Attribute name to be tested
|
|
1648
|
+
* @returns {boolean} Result
|
|
1649
|
+
*/
|
|
1650
|
+
function isValidAriaAttribute(name$2) {
|
|
1651
|
+
return ARIA_PROPERTIES.some((element) => element === name$2);
|
|
1655
1652
|
}
|
|
1653
|
+
/**
|
|
1654
|
+
* Extracts the tag name for the JSXAttribute
|
|
1655
|
+
* @param node - JSXAttribute being tested.
|
|
1656
|
+
* @returns tag name
|
|
1657
|
+
*/
|
|
1656
1658
|
function getTagName(node) {
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
}
|
|
1660
|
-
return null;
|
|
1659
|
+
if (node?.parent?.name) return node.parent.name.name;
|
|
1660
|
+
return null;
|
|
1661
1661
|
}
|
|
1662
|
+
/**
|
|
1663
|
+
* Test wether the tag name for the JSXAttribute is
|
|
1664
|
+
* something like <Foo.bar />
|
|
1665
|
+
* @param node - JSXAttribute being tested.
|
|
1666
|
+
* @returns result
|
|
1667
|
+
*/
|
|
1662
1668
|
function tagNameHasDot(node) {
|
|
1663
|
-
|
|
1669
|
+
return !!(node.parent?.name && node.parent.name.type === "JSXMemberExpression");
|
|
1664
1670
|
}
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1671
|
+
/**
|
|
1672
|
+
* Get the standard name of the attribute.
|
|
1673
|
+
* @param name - Name of the attribute.
|
|
1674
|
+
* @param context - eslint context
|
|
1675
|
+
* @returns The standard name of the attribute, or undefined if no standard name was found.
|
|
1676
|
+
*/
|
|
1677
|
+
function getStandardName(name$2, context) {
|
|
1678
|
+
if (has(DOM_ATTRIBUTE_NAMES, name$2)) return DOM_ATTRIBUTE_NAMES[name$2];
|
|
1679
|
+
if (has(SVGDOM_ATTRIBUTE_NAMES, name$2)) return SVGDOM_ATTRIBUTE_NAMES[name$2];
|
|
1680
|
+
const names = getDOMPropertyNames(context);
|
|
1681
|
+
return names.find((element) => element.toLowerCase() === name$2.toLowerCase());
|
|
1674
1682
|
}
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1683
|
+
const messages = {
|
|
1684
|
+
dataLowercaseRequired: "React does not recognize data-* props with uppercase characters on a DOM element. Found '{{name}}', use '{{lowerCaseName}}' instead",
|
|
1685
|
+
invalidPropOnTag: "Invalid property '{{name}}' found on tag '{{tagName}}', but it is only allowed on: {{allowedTags}}",
|
|
1686
|
+
unknownProp: "Unknown property '{{name}}' found",
|
|
1687
|
+
unknownPropWithStandardName: "Unknown property '{{name}}' found, use '{{standardName}}' instead"
|
|
1680
1688
|
};
|
|
1681
1689
|
var no_unknown_property_default = createRule({
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
},
|
|
1706
|
-
name: RULE_NAME13,
|
|
1707
|
-
create: create13,
|
|
1708
|
-
defaultOptions: []
|
|
1690
|
+
meta: {
|
|
1691
|
+
type: "problem",
|
|
1692
|
+
docs: { description: "Disallow unknown `DOM` property." },
|
|
1693
|
+
fixable: "code",
|
|
1694
|
+
messages,
|
|
1695
|
+
schema: [{
|
|
1696
|
+
type: "object",
|
|
1697
|
+
additionalProperties: false,
|
|
1698
|
+
properties: {
|
|
1699
|
+
ignore: {
|
|
1700
|
+
type: "array",
|
|
1701
|
+
items: { type: "string" }
|
|
1702
|
+
},
|
|
1703
|
+
requireDataLowercase: {
|
|
1704
|
+
type: "boolean",
|
|
1705
|
+
default: false
|
|
1706
|
+
}
|
|
1707
|
+
}
|
|
1708
|
+
}]
|
|
1709
|
+
},
|
|
1710
|
+
name: RULE_NAME$4,
|
|
1711
|
+
create: create$4,
|
|
1712
|
+
defaultOptions: []
|
|
1709
1713
|
});
|
|
1710
|
-
function
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
return fixer.replaceText(node.name, standardName);
|
|
1777
|
-
}
|
|
1778
|
-
});
|
|
1779
|
-
return;
|
|
1780
|
-
}
|
|
1781
|
-
report.send({
|
|
1782
|
-
node,
|
|
1783
|
-
messageId: "unknownProp",
|
|
1784
|
-
data: {
|
|
1785
|
-
name: actualName
|
|
1786
|
-
}
|
|
1787
|
-
});
|
|
1788
|
-
}
|
|
1789
|
-
};
|
|
1714
|
+
function create$4(context) {
|
|
1715
|
+
const report = Reporter.make(context);
|
|
1716
|
+
function getIgnoreConfig() {
|
|
1717
|
+
return context.options[0]?.ignore || DEFAULTS.ignore;
|
|
1718
|
+
}
|
|
1719
|
+
function getRequireDataLowercase() {
|
|
1720
|
+
return context.options[0] && typeof context.options[0].requireDataLowercase !== "undefined" ? !!context.options[0].requireDataLowercase : DEFAULTS.requireDataLowercase;
|
|
1721
|
+
}
|
|
1722
|
+
return { JSXAttribute(node) {
|
|
1723
|
+
const ignoreNames = getIgnoreConfig();
|
|
1724
|
+
const actualName = getText(context, node.name);
|
|
1725
|
+
if (ignoreNames.indexOf(actualName) >= 0) return;
|
|
1726
|
+
const name$2 = normalizeAttributeCase(actualName);
|
|
1727
|
+
if (tagNameHasDot(node)) return;
|
|
1728
|
+
if (isValidDataAttribute(name$2)) {
|
|
1729
|
+
if (getRequireDataLowercase() && hasUpperCaseCharacter(name$2)) report.send({
|
|
1730
|
+
node,
|
|
1731
|
+
messageId: "dataLowercaseRequired",
|
|
1732
|
+
data: {
|
|
1733
|
+
name: actualName,
|
|
1734
|
+
lowerCaseName: actualName.toLowerCase()
|
|
1735
|
+
}
|
|
1736
|
+
});
|
|
1737
|
+
return;
|
|
1738
|
+
}
|
|
1739
|
+
if (isValidAriaAttribute(name$2)) return;
|
|
1740
|
+
const tagName = getTagName(node);
|
|
1741
|
+
if (tagName === "fbt" || tagName === "fbs") return;
|
|
1742
|
+
if (!isValidHTMLTagInJSX(node)) return;
|
|
1743
|
+
const allowedTags = has(ATTRIBUTE_TAGS_MAP, name$2) ? ATTRIBUTE_TAGS_MAP[name$2] : null;
|
|
1744
|
+
if (tagName && allowedTags) {
|
|
1745
|
+
if (allowedTags.indexOf(tagName) === -1) report.send({
|
|
1746
|
+
node,
|
|
1747
|
+
messageId: "invalidPropOnTag",
|
|
1748
|
+
data: {
|
|
1749
|
+
name: actualName,
|
|
1750
|
+
allowedTags: allowedTags.join(", "),
|
|
1751
|
+
tagName
|
|
1752
|
+
}
|
|
1753
|
+
});
|
|
1754
|
+
return;
|
|
1755
|
+
}
|
|
1756
|
+
const standardName = getStandardName(name$2, context);
|
|
1757
|
+
const hasStandardNameButIsNotUsed = standardName && standardName !== name$2;
|
|
1758
|
+
const usesStandardName = standardName && standardName === name$2;
|
|
1759
|
+
if (usesStandardName) return;
|
|
1760
|
+
if (hasStandardNameButIsNotUsed) {
|
|
1761
|
+
report.send({
|
|
1762
|
+
node,
|
|
1763
|
+
messageId: "unknownPropWithStandardName",
|
|
1764
|
+
data: {
|
|
1765
|
+
name: actualName,
|
|
1766
|
+
standardName
|
|
1767
|
+
},
|
|
1768
|
+
fix(fixer) {
|
|
1769
|
+
return fixer.replaceText(node.name, standardName);
|
|
1770
|
+
}
|
|
1771
|
+
});
|
|
1772
|
+
return;
|
|
1773
|
+
}
|
|
1774
|
+
report.send({
|
|
1775
|
+
node,
|
|
1776
|
+
messageId: "unknownProp",
|
|
1777
|
+
data: { name: actualName }
|
|
1778
|
+
});
|
|
1779
|
+
} };
|
|
1790
1780
|
}
|
|
1791
1781
|
function has(obj, key) {
|
|
1792
|
-
|
|
1782
|
+
return Object.hasOwn(obj, key);
|
|
1793
1783
|
}
|
|
1794
1784
|
function getText(context, node) {
|
|
1795
|
-
|
|
1785
|
+
return context.sourceCode.getText(node);
|
|
1796
1786
|
}
|
|
1797
|
-
function testReactVersion(context, comparator,
|
|
1798
|
-
|
|
1799
|
-
|
|
1787
|
+
function testReactVersion(context, comparator, version$1) {
|
|
1788
|
+
const { version: localVersion } = getSettingsFromContext(context);
|
|
1789
|
+
return compare(localVersion, version$1, comparator);
|
|
1800
1790
|
}
|
|
1801
1791
|
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
];
|
|
1792
|
+
//#endregion
|
|
1793
|
+
//#region src/rules/no-unsafe-iframe-sandbox.ts
|
|
1794
|
+
const RULE_NAME$3 = "no-unsafe-iframe-sandbox";
|
|
1795
|
+
const RULE_FEATURES$3 = [];
|
|
1796
|
+
const unsafeSandboxValues = [["allow-scripts", "allow-same-origin"]];
|
|
1808
1797
|
function isSafeSandbox(value) {
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1798
|
+
if (typeof value !== "string") return false;
|
|
1799
|
+
return !unsafeSandboxValues.some((values) => {
|
|
1800
|
+
return values.every((v) => value.includes(v));
|
|
1801
|
+
});
|
|
1813
1802
|
}
|
|
1814
1803
|
var no_unsafe_iframe_sandbox_default = createRule({
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
create: create14,
|
|
1828
|
-
defaultOptions: []
|
|
1804
|
+
meta: {
|
|
1805
|
+
type: "problem",
|
|
1806
|
+
docs: {
|
|
1807
|
+
description: "Enforces `sandbox` attribute for `iframe` elements is not set to unsafe combinations.",
|
|
1808
|
+
[Symbol.for("rule_features")]: RULE_FEATURES$3
|
|
1809
|
+
},
|
|
1810
|
+
messages: { noUnsafeIframeSandbox: "Unsafe 'sandbox' attribute value on 'iframe' component." },
|
|
1811
|
+
schema: []
|
|
1812
|
+
},
|
|
1813
|
+
name: RULE_NAME$3,
|
|
1814
|
+
create: create$3,
|
|
1815
|
+
defaultOptions: []
|
|
1829
1816
|
});
|
|
1830
|
-
function
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
});
|
|
1842
|
-
}
|
|
1843
|
-
}
|
|
1844
|
-
};
|
|
1817
|
+
function create$3(context) {
|
|
1818
|
+
const resolver = createJsxElementResolver(context);
|
|
1819
|
+
return { JSXElement(node) {
|
|
1820
|
+
const { attributes, domElementType } = resolver.resolve(node);
|
|
1821
|
+
if (domElementType !== "iframe") return;
|
|
1822
|
+
const sandboxAttribute = resolveAttribute(context, attributes, node, "sandbox");
|
|
1823
|
+
if (!isSafeSandbox(sandboxAttribute.attributeValueString)) context.report({
|
|
1824
|
+
messageId: "noUnsafeIframeSandbox",
|
|
1825
|
+
node: sandboxAttribute.attributeValue?.node ?? sandboxAttribute.attribute ?? node
|
|
1826
|
+
});
|
|
1827
|
+
} };
|
|
1845
1828
|
}
|
|
1846
1829
|
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
];
|
|
1830
|
+
//#endregion
|
|
1831
|
+
//#region src/rules/no-unsafe-target-blank.ts
|
|
1832
|
+
const RULE_NAME$2 = "no-unsafe-target-blank";
|
|
1833
|
+
const RULE_FEATURES$2 = ["FIX"];
|
|
1852
1834
|
function isExternalLinkLike(value) {
|
|
1853
|
-
|
|
1854
|
-
|
|
1835
|
+
if (value == null) return false;
|
|
1836
|
+
return value.startsWith("https://") || /^(?:\w+:|\/\/)/u.test(value);
|
|
1855
1837
|
}
|
|
1856
1838
|
function isSafeRel(value) {
|
|
1857
|
-
|
|
1858
|
-
|
|
1839
|
+
if (value == null) return false;
|
|
1840
|
+
return value === "noreferrer" || /\bnoreferrer\b/u.test(value);
|
|
1859
1841
|
}
|
|
1860
1842
|
var no_unsafe_target_blank_default = createRule({
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1843
|
+
meta: {
|
|
1844
|
+
type: "problem",
|
|
1845
|
+
docs: {
|
|
1846
|
+
description: "Disallow `target=\"_blank\"` without `rel=\"noreferrer noopener\"`.",
|
|
1847
|
+
[Symbol.for("rule_features")]: RULE_FEATURES$2
|
|
1848
|
+
},
|
|
1849
|
+
fixable: "code",
|
|
1850
|
+
hasSuggestions: true,
|
|
1851
|
+
messages: {
|
|
1852
|
+
addRelNoreferrerNoopener: `Add 'rel="noreferrer noopener"' to the link to prevent security risks.`,
|
|
1853
|
+
noUnsafeTargetBlank: `Using 'target="_blank"' on an external link without 'rel="noreferrer noopener"' is a security risk.`
|
|
1854
|
+
},
|
|
1855
|
+
schema: []
|
|
1856
|
+
},
|
|
1857
|
+
name: RULE_NAME$2,
|
|
1858
|
+
create: create$2,
|
|
1859
|
+
defaultOptions: []
|
|
1878
1860
|
});
|
|
1879
|
-
function
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
node: relAttribute.attributeValue?.node ?? relAttribute.attribute,
|
|
1916
|
-
suggest: [{
|
|
1917
|
-
messageId: "addRelNoreferrerNoopener",
|
|
1918
|
-
fix(fixer) {
|
|
1919
|
-
if (relAttribute.attribute == null) return null;
|
|
1920
|
-
return fixer.replaceText(relAttribute.attribute, `${relAttribute.attributeName}="noreferrer noopener"`);
|
|
1921
|
-
}
|
|
1922
|
-
}]
|
|
1923
|
-
});
|
|
1924
|
-
}
|
|
1925
|
-
};
|
|
1861
|
+
function create$2(context) {
|
|
1862
|
+
const resolver = createJsxElementResolver(context);
|
|
1863
|
+
return { JSXElement(node) {
|
|
1864
|
+
const { attributes, domElementType } = resolver.resolve(node);
|
|
1865
|
+
if (domElementType !== "a") return;
|
|
1866
|
+
const targetAttribute = resolveAttribute(context, attributes, node, "target");
|
|
1867
|
+
if (targetAttribute.attributeValueString !== "_blank") return;
|
|
1868
|
+
const hrefAttribute = resolveAttribute(context, attributes, node, "href");
|
|
1869
|
+
if (!isExternalLinkLike(hrefAttribute.attributeValueString)) return;
|
|
1870
|
+
const relAttribute = resolveAttribute(context, attributes, node, "rel");
|
|
1871
|
+
if (isSafeRel(relAttribute.attributeValueString)) return;
|
|
1872
|
+
if (relAttribute.attribute == null) {
|
|
1873
|
+
context.report({
|
|
1874
|
+
messageId: "noUnsafeTargetBlank",
|
|
1875
|
+
node: node.openingElement,
|
|
1876
|
+
suggest: [{
|
|
1877
|
+
messageId: "addRelNoreferrerNoopener",
|
|
1878
|
+
fix(fixer) {
|
|
1879
|
+
return fixer.insertTextAfter(node.openingElement.name, ` ${relAttribute.attributeName}="noreferrer noopener"`);
|
|
1880
|
+
}
|
|
1881
|
+
}]
|
|
1882
|
+
});
|
|
1883
|
+
return;
|
|
1884
|
+
}
|
|
1885
|
+
context.report({
|
|
1886
|
+
messageId: "noUnsafeTargetBlank",
|
|
1887
|
+
node: relAttribute.attributeValue?.node ?? relAttribute.attribute,
|
|
1888
|
+
suggest: [{
|
|
1889
|
+
messageId: "addRelNoreferrerNoopener",
|
|
1890
|
+
fix(fixer) {
|
|
1891
|
+
if (relAttribute.attribute == null) return null;
|
|
1892
|
+
return fixer.replaceText(relAttribute.attribute, `${relAttribute.attributeName}="noreferrer noopener"`);
|
|
1893
|
+
}
|
|
1894
|
+
}]
|
|
1895
|
+
});
|
|
1896
|
+
} };
|
|
1926
1897
|
}
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1898
|
+
|
|
1899
|
+
//#endregion
|
|
1900
|
+
//#region src/rules/no-use-form-state.ts
|
|
1901
|
+
const RULE_NAME$1 = "no-use-form-state";
|
|
1902
|
+
const RULE_FEATURES$1 = ["MOD"];
|
|
1931
1903
|
var no_use_form_state_default = createRule({
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
create: create16,
|
|
1946
|
-
defaultOptions: []
|
|
1904
|
+
meta: {
|
|
1905
|
+
type: "problem",
|
|
1906
|
+
docs: {
|
|
1907
|
+
description: "Replaces usages of `useFormState` with `useActionState`.",
|
|
1908
|
+
[Symbol.for("rule_features")]: RULE_FEATURES$1
|
|
1909
|
+
},
|
|
1910
|
+
fixable: "code",
|
|
1911
|
+
messages: { noUseFormState: "[Deprecated] Use 'useActionState' from 'react' package instead." },
|
|
1912
|
+
schema: []
|
|
1913
|
+
},
|
|
1914
|
+
name: RULE_NAME$1,
|
|
1915
|
+
create: create$1,
|
|
1916
|
+
defaultOptions: []
|
|
1947
1917
|
});
|
|
1948
|
-
function
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
}
|
|
1989
|
-
}
|
|
1990
|
-
}
|
|
1991
|
-
};
|
|
1918
|
+
function create$1(context) {
|
|
1919
|
+
if (!context.sourceCode.text.includes("useFormState")) return {};
|
|
1920
|
+
const settings$1 = getSettingsFromContext(context);
|
|
1921
|
+
if (compare(settings$1.version, "19.0.0", "<")) return {};
|
|
1922
|
+
const reactDomNames = /* @__PURE__ */ new Set();
|
|
1923
|
+
const useFormStateNames = /* @__PURE__ */ new Set();
|
|
1924
|
+
return {
|
|
1925
|
+
CallExpression(node) {
|
|
1926
|
+
switch (true) {
|
|
1927
|
+
case node.callee.type === AST_NODE_TYPES.Identifier && useFormStateNames.has(node.callee.name):
|
|
1928
|
+
context.report({
|
|
1929
|
+
messageId: "noUseFormState",
|
|
1930
|
+
node,
|
|
1931
|
+
fix: getFix(context, node)
|
|
1932
|
+
});
|
|
1933
|
+
return;
|
|
1934
|
+
case node.callee.type === AST_NODE_TYPES.MemberExpression && node.callee.object.type === AST_NODE_TYPES.Identifier && node.callee.property.type === AST_NODE_TYPES.Identifier && node.callee.property.name === "useFormState" && reactDomNames.has(node.callee.object.name):
|
|
1935
|
+
context.report({
|
|
1936
|
+
messageId: "noUseFormState",
|
|
1937
|
+
node,
|
|
1938
|
+
fix: getFix(context, node)
|
|
1939
|
+
});
|
|
1940
|
+
return;
|
|
1941
|
+
}
|
|
1942
|
+
},
|
|
1943
|
+
ImportDeclaration(node) {
|
|
1944
|
+
const [baseSource] = node.source.value.split("/");
|
|
1945
|
+
if (baseSource !== "react-dom") return;
|
|
1946
|
+
for (const specifier of node.specifiers) switch (specifier.type) {
|
|
1947
|
+
case AST_NODE_TYPES.ImportSpecifier:
|
|
1948
|
+
if (specifier.imported.type !== AST_NODE_TYPES.Identifier) continue;
|
|
1949
|
+
if (specifier.imported.name === "useFormState") useFormStateNames.add(specifier.local.name);
|
|
1950
|
+
continue;
|
|
1951
|
+
case AST_NODE_TYPES.ImportDefaultSpecifier:
|
|
1952
|
+
case AST_NODE_TYPES.ImportNamespaceSpecifier:
|
|
1953
|
+
reactDomNames.add(specifier.local.name);
|
|
1954
|
+
continue;
|
|
1955
|
+
}
|
|
1956
|
+
}
|
|
1957
|
+
};
|
|
1992
1958
|
}
|
|
1993
|
-
function
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
`),
|
|
1999
|
-
fixer.replaceText(node.callee, "useActionState")
|
|
2000
|
-
];
|
|
2001
|
-
};
|
|
1959
|
+
function getFix(context, node) {
|
|
1960
|
+
const { importSource } = getSettingsFromContext(context);
|
|
1961
|
+
return (fixer) => {
|
|
1962
|
+
return [fixer.insertTextBefore(context.sourceCode.ast, `import { useActionState } from "${importSource}";\n`), fixer.replaceText(node.callee, "useActionState")];
|
|
1963
|
+
};
|
|
2002
1964
|
}
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
1965
|
+
|
|
1966
|
+
//#endregion
|
|
1967
|
+
//#region src/rules/no-void-elements-with-children.ts
|
|
1968
|
+
const RULE_NAME = "no-void-elements-with-children";
|
|
1969
|
+
const RULE_FEATURES = [];
|
|
1970
|
+
const voidElements = new Set([
|
|
1971
|
+
"area",
|
|
1972
|
+
"base",
|
|
1973
|
+
"br",
|
|
1974
|
+
"col",
|
|
1975
|
+
"embed",
|
|
1976
|
+
"hr",
|
|
1977
|
+
"img",
|
|
1978
|
+
"input",
|
|
1979
|
+
"keygen",
|
|
1980
|
+
"link",
|
|
1981
|
+
"menuitem",
|
|
1982
|
+
"meta",
|
|
1983
|
+
"param",
|
|
1984
|
+
"source",
|
|
1985
|
+
"track",
|
|
1986
|
+
"wbr"
|
|
2022
1987
|
]);
|
|
2023
1988
|
var no_void_elements_with_children_default = createRule({
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
create: create17,
|
|
2037
|
-
defaultOptions: []
|
|
1989
|
+
meta: {
|
|
1990
|
+
type: "problem",
|
|
1991
|
+
docs: {
|
|
1992
|
+
description: "Disallow `children` in void DOM elements.",
|
|
1993
|
+
[Symbol.for("rule_features")]: RULE_FEATURES
|
|
1994
|
+
},
|
|
1995
|
+
messages: { noVoidElementsWithChildren: "'{{element}}' is a void element tag and must not have children." },
|
|
1996
|
+
schema: []
|
|
1997
|
+
},
|
|
1998
|
+
name: RULE_NAME,
|
|
1999
|
+
create,
|
|
2000
|
+
defaultOptions: []
|
|
2038
2001
|
});
|
|
2039
|
-
function
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
const hasAttribute3 = (name3) => ER.hasAttribute(context, name3, attributes, initialScope);
|
|
2059
|
-
if (hasAttribute3("children") || hasAttribute3("dangerouslySetInnerHTML")) {
|
|
2060
|
-
context.report({
|
|
2061
|
-
messageId: "noVoidElementsWithChildren",
|
|
2062
|
-
node,
|
|
2063
|
-
data: {
|
|
2064
|
-
element: elementName
|
|
2065
|
-
}
|
|
2066
|
-
});
|
|
2067
|
-
}
|
|
2068
|
-
}
|
|
2069
|
-
};
|
|
2002
|
+
function create(context) {
|
|
2003
|
+
const resolver = createJsxElementResolver(context);
|
|
2004
|
+
return { JSXElement(node) {
|
|
2005
|
+
const { domElementType: elementName } = resolver.resolve(node);
|
|
2006
|
+
if (elementName.length === 0 || !voidElements.has(elementName)) return;
|
|
2007
|
+
if (node.children.length > 0) context.report({
|
|
2008
|
+
messageId: "noVoidElementsWithChildren",
|
|
2009
|
+
node,
|
|
2010
|
+
data: { element: elementName }
|
|
2011
|
+
});
|
|
2012
|
+
const { attributes } = node.openingElement;
|
|
2013
|
+
const initialScope = context.sourceCode.getScope(node);
|
|
2014
|
+
const hasAttribute = (name$2) => ER.hasAttribute(context, name$2, attributes, initialScope);
|
|
2015
|
+
if (hasAttribute("children") || hasAttribute("dangerouslySetInnerHTML")) context.report({
|
|
2016
|
+
messageId: "noVoidElementsWithChildren",
|
|
2017
|
+
node,
|
|
2018
|
+
data: { element: elementName }
|
|
2019
|
+
});
|
|
2020
|
+
} };
|
|
2070
2021
|
}
|
|
2071
2022
|
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2023
|
+
//#endregion
|
|
2024
|
+
//#region src/plugin.ts
|
|
2025
|
+
const plugin = {
|
|
2026
|
+
meta: {
|
|
2027
|
+
name,
|
|
2028
|
+
version
|
|
2029
|
+
},
|
|
2030
|
+
rules: {
|
|
2031
|
+
"no-dangerously-set-innerhtml": no_dangerously_set_innerhtml_default,
|
|
2032
|
+
"no-dangerously-set-innerhtml-with-children": no_dangerously_set_innerhtml_with_children_default,
|
|
2033
|
+
"no-find-dom-node": no_find_dom_node_default,
|
|
2034
|
+
"no-flush-sync": no_flush_sync_default,
|
|
2035
|
+
"no-hydrate": no_hydrate_default,
|
|
2036
|
+
"no-missing-button-type": no_missing_button_type_default,
|
|
2037
|
+
"no-missing-iframe-sandbox": no_missing_iframe_sandbox_default,
|
|
2038
|
+
"no-namespace": no_namespace_default,
|
|
2039
|
+
"no-render": no_render_default,
|
|
2040
|
+
"no-render-return-value": no_render_return_value_default,
|
|
2041
|
+
"no-script-url": no_script_url_default,
|
|
2042
|
+
"no-string-style-prop": no_string_style_prop_default,
|
|
2043
|
+
"no-unknown-property": no_unknown_property_default,
|
|
2044
|
+
"no-unsafe-iframe-sandbox": no_unsafe_iframe_sandbox_default,
|
|
2045
|
+
"no-unsafe-target-blank": no_unsafe_target_blank_default,
|
|
2046
|
+
"no-use-form-state": no_use_form_state_default,
|
|
2047
|
+
"no-void-elements-with-children": no_void_elements_with_children_default
|
|
2048
|
+
}
|
|
2097
2049
|
};
|
|
2098
2050
|
|
|
2099
|
-
|
|
2051
|
+
//#endregion
|
|
2052
|
+
//#region src/index.ts
|
|
2100
2053
|
function makeConfig(config) {
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
}
|
|
2106
|
-
};
|
|
2054
|
+
return {
|
|
2055
|
+
...config,
|
|
2056
|
+
plugins: { "react-dom": plugin }
|
|
2057
|
+
};
|
|
2107
2058
|
}
|
|
2108
|
-
function makeLegacyConfig({ rules:
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2059
|
+
function makeLegacyConfig({ rules: rules$1 }) {
|
|
2060
|
+
return {
|
|
2061
|
+
plugins: ["react-dom"],
|
|
2062
|
+
rules: rules$1
|
|
2063
|
+
};
|
|
2113
2064
|
}
|
|
2114
|
-
var
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2065
|
+
var src_default = {
|
|
2066
|
+
...plugin,
|
|
2067
|
+
configs: {
|
|
2068
|
+
["recommended"]: makeConfig(recommended_exports),
|
|
2069
|
+
["recommended-legacy"]: makeLegacyConfig(recommended_exports)
|
|
2070
|
+
}
|
|
2120
2071
|
};
|
|
2121
2072
|
|
|
2122
|
-
|
|
2073
|
+
//#endregion
|
|
2074
|
+
export { src_default as default };
|