eslint-plugin-react-dom 2.0.0-beta.2 → 2.0.0-beta.200

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