eslint-plugin-react-dom 1.52.9 → 1.52.10-beta.1

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