eslint-plugin-react-dom 2.0.0-next.146 → 2.0.0-next.148

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