eslint-plugin-react-dom 2.0.0-next.6 → 2.0.0-next.61

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