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