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