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