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