eslint-plugin-react-dom 1.26.3-next.2 → 1.26.3-next.20
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/README.md +0 -3
- package/dist/index.d.mts +36 -3
- package/dist/index.d.ts +36 -3
- package/dist/index.js +114 -59
- package/dist/index.mjs +114 -59
- package/package.json +14 -14
package/README.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -1,11 +1,45 @@
|
|
|
1
1
|
import * as _typescript_eslint_utils_ts_eslint from '@typescript-eslint/utils/ts-eslint';
|
|
2
|
+
import { RulePreset } from '@eslint-react/shared';
|
|
2
3
|
|
|
3
4
|
declare const _default: {
|
|
4
|
-
|
|
5
|
+
configs: {
|
|
6
|
+
recommended: {
|
|
7
|
+
plugins: {
|
|
8
|
+
"react-dom": {
|
|
9
|
+
readonly meta: {
|
|
10
|
+
readonly name: string;
|
|
11
|
+
readonly version: string;
|
|
12
|
+
};
|
|
13
|
+
readonly rules: {
|
|
14
|
+
readonly "no-dangerously-set-innerhtml": _typescript_eslint_utils_ts_eslint.RuleModule<"noDangerouslySetInnerhtml", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
15
|
+
readonly "no-dangerously-set-innerhtml-with-children": _typescript_eslint_utils_ts_eslint.RuleModule<"noDangerouslySetInnerhtmlWithChildren", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
16
|
+
readonly "no-find-dom-node": _typescript_eslint_utils_ts_eslint.RuleModule<"noFindDomNode", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
17
|
+
readonly "no-missing-button-type": _typescript_eslint_utils_ts_eslint.RuleModule<"noMissingButtonType", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
18
|
+
readonly "no-missing-iframe-sandbox": _typescript_eslint_utils_ts_eslint.RuleModule<"noMissingIframeSandbox", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
19
|
+
readonly "no-namespace": _typescript_eslint_utils_ts_eslint.RuleModule<"noNamespace", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
20
|
+
readonly "no-render-return-value": _typescript_eslint_utils_ts_eslint.RuleModule<"noRenderReturnValue", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
21
|
+
readonly "no-script-url": _typescript_eslint_utils_ts_eslint.RuleModule<"noScriptUrl", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
22
|
+
readonly "no-unknown-property": _typescript_eslint_utils_ts_eslint.RuleModule<string, [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
23
|
+
readonly "no-unsafe-iframe-sandbox": _typescript_eslint_utils_ts_eslint.RuleModule<"noUnsafeIframeSandbox", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
24
|
+
readonly "no-unsafe-target-blank": _typescript_eslint_utils_ts_eslint.RuleModule<"noUnsafeTargetBlank", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
25
|
+
readonly "no-void-elements-with-children": _typescript_eslint_utils_ts_eslint.RuleModule<"noVoidElementsWithChildren", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
26
|
+
readonly "no-children-in-void-dom-elements": _typescript_eslint_utils_ts_eslint.RuleModule<"noVoidElementsWithChildren", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
name: string;
|
|
31
|
+
rules: RulePreset;
|
|
32
|
+
};
|
|
33
|
+
"recommended-legacy": {
|
|
34
|
+
plugins: string[];
|
|
35
|
+
rules: RulePreset;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
meta: {
|
|
5
39
|
readonly name: string;
|
|
6
40
|
readonly version: string;
|
|
7
41
|
};
|
|
8
|
-
|
|
42
|
+
rules: {
|
|
9
43
|
readonly "no-dangerously-set-innerhtml": _typescript_eslint_utils_ts_eslint.RuleModule<"noDangerouslySetInnerhtml", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
10
44
|
readonly "no-dangerously-set-innerhtml-with-children": _typescript_eslint_utils_ts_eslint.RuleModule<"noDangerouslySetInnerhtmlWithChildren", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
11
45
|
readonly "no-find-dom-node": _typescript_eslint_utils_ts_eslint.RuleModule<"noFindDomNode", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
@@ -18,7 +52,6 @@ declare const _default: {
|
|
|
18
52
|
readonly "no-unsafe-iframe-sandbox": _typescript_eslint_utils_ts_eslint.RuleModule<"noUnsafeIframeSandbox", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
19
53
|
readonly "no-unsafe-target-blank": _typescript_eslint_utils_ts_eslint.RuleModule<"noUnsafeTargetBlank", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
20
54
|
readonly "no-void-elements-with-children": _typescript_eslint_utils_ts_eslint.RuleModule<"noVoidElementsWithChildren", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
21
|
-
/** @deprecated Use `no-void-elements-with-children` instead */
|
|
22
55
|
readonly "no-children-in-void-dom-elements": _typescript_eslint_utils_ts_eslint.RuleModule<"noVoidElementsWithChildren", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
23
56
|
};
|
|
24
57
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,45 @@
|
|
|
1
1
|
import * as _typescript_eslint_utils_ts_eslint from '@typescript-eslint/utils/ts-eslint';
|
|
2
|
+
import { RulePreset } from '@eslint-react/shared';
|
|
2
3
|
|
|
3
4
|
declare const _default: {
|
|
4
|
-
|
|
5
|
+
configs: {
|
|
6
|
+
recommended: {
|
|
7
|
+
plugins: {
|
|
8
|
+
"react-dom": {
|
|
9
|
+
readonly meta: {
|
|
10
|
+
readonly name: string;
|
|
11
|
+
readonly version: string;
|
|
12
|
+
};
|
|
13
|
+
readonly rules: {
|
|
14
|
+
readonly "no-dangerously-set-innerhtml": _typescript_eslint_utils_ts_eslint.RuleModule<"noDangerouslySetInnerhtml", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
15
|
+
readonly "no-dangerously-set-innerhtml-with-children": _typescript_eslint_utils_ts_eslint.RuleModule<"noDangerouslySetInnerhtmlWithChildren", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
16
|
+
readonly "no-find-dom-node": _typescript_eslint_utils_ts_eslint.RuleModule<"noFindDomNode", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
17
|
+
readonly "no-missing-button-type": _typescript_eslint_utils_ts_eslint.RuleModule<"noMissingButtonType", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
18
|
+
readonly "no-missing-iframe-sandbox": _typescript_eslint_utils_ts_eslint.RuleModule<"noMissingIframeSandbox", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
19
|
+
readonly "no-namespace": _typescript_eslint_utils_ts_eslint.RuleModule<"noNamespace", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
20
|
+
readonly "no-render-return-value": _typescript_eslint_utils_ts_eslint.RuleModule<"noRenderReturnValue", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
21
|
+
readonly "no-script-url": _typescript_eslint_utils_ts_eslint.RuleModule<"noScriptUrl", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
22
|
+
readonly "no-unknown-property": _typescript_eslint_utils_ts_eslint.RuleModule<string, [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
23
|
+
readonly "no-unsafe-iframe-sandbox": _typescript_eslint_utils_ts_eslint.RuleModule<"noUnsafeIframeSandbox", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
24
|
+
readonly "no-unsafe-target-blank": _typescript_eslint_utils_ts_eslint.RuleModule<"noUnsafeTargetBlank", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
25
|
+
readonly "no-void-elements-with-children": _typescript_eslint_utils_ts_eslint.RuleModule<"noVoidElementsWithChildren", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
26
|
+
readonly "no-children-in-void-dom-elements": _typescript_eslint_utils_ts_eslint.RuleModule<"noVoidElementsWithChildren", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
name: string;
|
|
31
|
+
rules: RulePreset;
|
|
32
|
+
};
|
|
33
|
+
"recommended-legacy": {
|
|
34
|
+
plugins: string[];
|
|
35
|
+
rules: RulePreset;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
meta: {
|
|
5
39
|
readonly name: string;
|
|
6
40
|
readonly version: string;
|
|
7
41
|
};
|
|
8
|
-
|
|
42
|
+
rules: {
|
|
9
43
|
readonly "no-dangerously-set-innerhtml": _typescript_eslint_utils_ts_eslint.RuleModule<"noDangerouslySetInnerhtml", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
10
44
|
readonly "no-dangerously-set-innerhtml-with-children": _typescript_eslint_utils_ts_eslint.RuleModule<"noDangerouslySetInnerhtmlWithChildren", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
11
45
|
readonly "no-find-dom-node": _typescript_eslint_utils_ts_eslint.RuleModule<"noFindDomNode", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
@@ -18,7 +52,6 @@ declare const _default: {
|
|
|
18
52
|
readonly "no-unsafe-iframe-sandbox": _typescript_eslint_utils_ts_eslint.RuleModule<"noUnsafeIframeSandbox", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
19
53
|
readonly "no-unsafe-target-blank": _typescript_eslint_utils_ts_eslint.RuleModule<"noUnsafeTargetBlank", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
20
54
|
readonly "no-void-elements-with-children": _typescript_eslint_utils_ts_eslint.RuleModule<"noVoidElementsWithChildren", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
21
|
-
/** @deprecated Use `no-void-elements-with-children` instead */
|
|
22
55
|
readonly "no-children-in-void-dom-elements": _typescript_eslint_utils_ts_eslint.RuleModule<"noVoidElementsWithChildren", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
23
56
|
};
|
|
24
57
|
};
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var JSX = require('@eslint-react/jsx');
|
|
4
3
|
var shared = require('@eslint-react/shared');
|
|
4
|
+
var JSX = require('@eslint-react/jsx');
|
|
5
5
|
var types = require('@typescript-eslint/types');
|
|
6
6
|
var AST = require('@eslint-react/ast');
|
|
7
7
|
var compareVersions = require('compare-versions');
|
|
@@ -28,36 +28,68 @@ function _interopNamespace(e) {
|
|
|
28
28
|
var JSX__namespace = /*#__PURE__*/_interopNamespace(JSX);
|
|
29
29
|
var AST__namespace = /*#__PURE__*/_interopNamespace(AST);
|
|
30
30
|
|
|
31
|
+
var __defProp = Object.defineProperty;
|
|
32
|
+
var __export = (target, all) => {
|
|
33
|
+
for (var name3 in all)
|
|
34
|
+
__defProp(target, name3, { get: all[name3], enumerable: true });
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// src/configs/recommended.ts
|
|
38
|
+
var recommended_exports = {};
|
|
39
|
+
__export(recommended_exports, {
|
|
40
|
+
name: () => name,
|
|
41
|
+
rules: () => rules,
|
|
42
|
+
settings: () => settings
|
|
43
|
+
});
|
|
44
|
+
var name = "react-dom/recommended";
|
|
45
|
+
var rules = {
|
|
46
|
+
"react-dom/no-dangerously-set-innerhtml": "warn",
|
|
47
|
+
"react-dom/no-dangerously-set-innerhtml-with-children": "error",
|
|
48
|
+
"react-dom/no-find-dom-node": "error",
|
|
49
|
+
"react-dom/no-missing-button-type": "warn",
|
|
50
|
+
"react-dom/no-missing-iframe-sandbox": "warn",
|
|
51
|
+
"react-dom/no-namespace": "error",
|
|
52
|
+
"react-dom/no-render-return-value": "error",
|
|
53
|
+
"react-dom/no-script-url": "warn",
|
|
54
|
+
"react-dom/no-unknown-property": "warn",
|
|
55
|
+
"react-dom/no-unsafe-iframe-sandbox": "warn",
|
|
56
|
+
"react-dom/no-unsafe-target-blank": "warn",
|
|
57
|
+
"react-dom/no-void-elements-with-children": "warn"
|
|
58
|
+
};
|
|
59
|
+
var settings = {
|
|
60
|
+
"react-x": shared.DEFAULT_ESLINT_REACT_SETTINGS
|
|
61
|
+
};
|
|
62
|
+
|
|
31
63
|
// package.json
|
|
32
|
-
var
|
|
33
|
-
var version = "1.26.3-next.
|
|
64
|
+
var name2 = "eslint-plugin-react-dom";
|
|
65
|
+
var version = "1.26.3-next.20";
|
|
34
66
|
var createRule = shared.createRuleForPlugin("dom");
|
|
35
67
|
|
|
36
68
|
// src/utils/find-custom-component.ts
|
|
37
|
-
function findCustomComponent(
|
|
38
|
-
return components.findLast((c) => c.name ===
|
|
69
|
+
function findCustomComponent(name3, components) {
|
|
70
|
+
return components.findLast((c) => c.name === name3 || c.re.test(name3));
|
|
39
71
|
}
|
|
40
|
-
function findCustomComponentProp(
|
|
41
|
-
return props.findLast((a) => a.as ===
|
|
72
|
+
function findCustomComponentProp(name3, props) {
|
|
73
|
+
return props.findLast((a) => a.as === name3);
|
|
42
74
|
}
|
|
43
75
|
function getElementNameOnJsxAndDom(node, context, polymorphicPropName, additionalComponents = []) {
|
|
44
|
-
const
|
|
45
|
-
if (
|
|
46
|
-
const component = additionalComponents.findLast((c) => c.name ===
|
|
47
|
-
if (component != null) return [
|
|
48
|
-
if (polymorphicPropName == null) return [
|
|
76
|
+
const name3 = JSX__namespace.getElementName(node);
|
|
77
|
+
if (name3 === name3.toLowerCase()) return [name3, name3];
|
|
78
|
+
const component = additionalComponents.findLast((c) => c.name === name3 || c.re.test(name3));
|
|
79
|
+
if (component != null) return [name3, component.as];
|
|
80
|
+
if (polymorphicPropName == null) return [name3, name3];
|
|
49
81
|
const initialScope = context.sourceCode.getScope(node);
|
|
50
82
|
const attributeNode = JSX__namespace.getAttribute(
|
|
51
83
|
polymorphicPropName,
|
|
52
84
|
node.openingElement.attributes,
|
|
53
85
|
initialScope
|
|
54
86
|
);
|
|
55
|
-
if (attributeNode == null) return [
|
|
87
|
+
if (attributeNode == null) return [name3, name3];
|
|
56
88
|
const polymorphicPropValue = JSX__namespace.getAttributeValue(attributeNode, polymorphicPropName, initialScope);
|
|
57
89
|
if (polymorphicPropValue.kind === "some" && typeof polymorphicPropValue.value === "string") {
|
|
58
|
-
return [
|
|
90
|
+
return [name3, polymorphicPropValue.value];
|
|
59
91
|
}
|
|
60
|
-
return [
|
|
92
|
+
return [name3, name3];
|
|
61
93
|
}
|
|
62
94
|
|
|
63
95
|
// src/rules/no-dangerously-set-innerhtml.ts
|
|
@@ -193,9 +225,9 @@ var no_missing_button_type_default = createRule({
|
|
|
193
225
|
},
|
|
194
226
|
name: RULE_NAME4,
|
|
195
227
|
create(context) {
|
|
196
|
-
const
|
|
197
|
-
const polymorphicPropName =
|
|
198
|
-
const additionalComponents =
|
|
228
|
+
const settings2 = shared.getSettingsFromContext(context);
|
|
229
|
+
const polymorphicPropName = settings2.polymorphicPropName;
|
|
230
|
+
const additionalComponents = settings2.additionalComponents.filter((c) => c.as === "button");
|
|
199
231
|
return {
|
|
200
232
|
JSXElement(node) {
|
|
201
233
|
const [elementNameOnJsx, elementNameOnDom] = getElementNameOnJsxAndDom(
|
|
@@ -275,9 +307,9 @@ var no_missing_iframe_sandbox_default = createRule({
|
|
|
275
307
|
},
|
|
276
308
|
name: RULE_NAME5,
|
|
277
309
|
create(context) {
|
|
278
|
-
const
|
|
279
|
-
const polymorphicPropName =
|
|
280
|
-
const additionalComponents =
|
|
310
|
+
const settings2 = shared.getSettingsFromContext(context);
|
|
311
|
+
const polymorphicPropName = settings2.polymorphicPropName;
|
|
312
|
+
const additionalComponents = settings2.additionalComponents.filter((c) => c.as === "iframe");
|
|
281
313
|
return {
|
|
282
314
|
JSXElement(node) {
|
|
283
315
|
const [elementNameOnJsx, elementNameOnDom] = getElementNameOnJsxAndDom(
|
|
@@ -337,15 +369,15 @@ var no_namespace_default = createRule({
|
|
|
337
369
|
create(context) {
|
|
338
370
|
return {
|
|
339
371
|
JSXElement(node) {
|
|
340
|
-
const
|
|
341
|
-
if (typeof
|
|
372
|
+
const name3 = JSX__namespace.getElementName(node);
|
|
373
|
+
if (typeof name3 !== "string" || !name3.includes(":")) {
|
|
342
374
|
return;
|
|
343
375
|
}
|
|
344
376
|
context.report({
|
|
345
377
|
messageId: "noNamespace",
|
|
346
378
|
node: node.openingElement.name,
|
|
347
379
|
data: {
|
|
348
|
-
name:
|
|
380
|
+
name: name3
|
|
349
381
|
}
|
|
350
382
|
});
|
|
351
383
|
}
|
|
@@ -1345,17 +1377,17 @@ function isValidHTMLTagInJSX(childNode) {
|
|
|
1345
1377
|
}
|
|
1346
1378
|
return false;
|
|
1347
1379
|
}
|
|
1348
|
-
function normalizeAttributeCase(
|
|
1349
|
-
return DOM_PROPERTIES_IGNORE_CASE.find((element) => element.toLowerCase() ===
|
|
1380
|
+
function normalizeAttributeCase(name3) {
|
|
1381
|
+
return DOM_PROPERTIES_IGNORE_CASE.find((element) => element.toLowerCase() === name3.toLowerCase()) || name3;
|
|
1350
1382
|
}
|
|
1351
|
-
function isValidDataAttribute(
|
|
1352
|
-
return !/^data-xml/i.test(
|
|
1383
|
+
function isValidDataAttribute(name3) {
|
|
1384
|
+
return !/^data-xml/i.test(name3) && /^data-[^:]*$/.test(name3);
|
|
1353
1385
|
}
|
|
1354
|
-
function hasUpperCaseCharacter(
|
|
1355
|
-
return
|
|
1386
|
+
function hasUpperCaseCharacter(name3) {
|
|
1387
|
+
return name3.toLowerCase() !== name3;
|
|
1356
1388
|
}
|
|
1357
|
-
function isValidAriaAttribute(
|
|
1358
|
-
return ARIA_PROPERTIES.some((element) => element ===
|
|
1389
|
+
function isValidAriaAttribute(name3) {
|
|
1390
|
+
return ARIA_PROPERTIES.some((element) => element === name3);
|
|
1359
1391
|
}
|
|
1360
1392
|
function getTagName(node) {
|
|
1361
1393
|
if (node?.parent?.name) {
|
|
@@ -1366,15 +1398,15 @@ function getTagName(node) {
|
|
|
1366
1398
|
function tagNameHasDot(node) {
|
|
1367
1399
|
return !!(node.parent?.name && node.parent.name.type === "JSXMemberExpression");
|
|
1368
1400
|
}
|
|
1369
|
-
function getStandardName(
|
|
1370
|
-
if (has(DOM_ATTRIBUTE_NAMES,
|
|
1371
|
-
return DOM_ATTRIBUTE_NAMES[
|
|
1401
|
+
function getStandardName(name3, context) {
|
|
1402
|
+
if (has(DOM_ATTRIBUTE_NAMES, name3)) {
|
|
1403
|
+
return DOM_ATTRIBUTE_NAMES[name3];
|
|
1372
1404
|
}
|
|
1373
|
-
if (has(SVGDOM_ATTRIBUTE_NAMES,
|
|
1374
|
-
return SVGDOM_ATTRIBUTE_NAMES[
|
|
1405
|
+
if (has(SVGDOM_ATTRIBUTE_NAMES, name3)) {
|
|
1406
|
+
return SVGDOM_ATTRIBUTE_NAMES[name3];
|
|
1375
1407
|
}
|
|
1376
1408
|
const names = getDOMPropertyNames(context);
|
|
1377
|
-
return names.find((element) => element.toLowerCase() ===
|
|
1409
|
+
return names.find((element) => element.toLowerCase() === name3.toLowerCase());
|
|
1378
1410
|
}
|
|
1379
1411
|
var messages = {
|
|
1380
1412
|
dataLowercaseRequired: "React does not recognize data-* props with uppercase characters on a DOM element. Found '{{name}}', use '{{lowerCaseName}}' instead",
|
|
@@ -1421,12 +1453,12 @@ var no_unknown_property_default = createRule({
|
|
|
1421
1453
|
if (ignoreNames.indexOf(actualName) >= 0) {
|
|
1422
1454
|
return;
|
|
1423
1455
|
}
|
|
1424
|
-
const
|
|
1456
|
+
const name3 = normalizeAttributeCase(actualName);
|
|
1425
1457
|
if (tagNameHasDot(node)) {
|
|
1426
1458
|
return;
|
|
1427
1459
|
}
|
|
1428
|
-
if (isValidDataAttribute(
|
|
1429
|
-
if (getRequireDataLowercase() && hasUpperCaseCharacter(
|
|
1460
|
+
if (isValidDataAttribute(name3)) {
|
|
1461
|
+
if (getRequireDataLowercase() && hasUpperCaseCharacter(name3)) {
|
|
1430
1462
|
report(context, messages.dataLowercaseRequired, "dataLowercaseRequired", {
|
|
1431
1463
|
node,
|
|
1432
1464
|
data: {
|
|
@@ -1437,11 +1469,11 @@ var no_unknown_property_default = createRule({
|
|
|
1437
1469
|
}
|
|
1438
1470
|
return;
|
|
1439
1471
|
}
|
|
1440
|
-
if (isValidAriaAttribute(
|
|
1472
|
+
if (isValidAriaAttribute(name3)) return;
|
|
1441
1473
|
const tagName = getTagName(node);
|
|
1442
1474
|
if (tagName === "fbt" || tagName === "fbs") return;
|
|
1443
1475
|
if (!isValidHTMLTagInJSX(node)) return;
|
|
1444
|
-
const allowedTags = has(ATTRIBUTE_TAGS_MAP,
|
|
1476
|
+
const allowedTags = has(ATTRIBUTE_TAGS_MAP, name3) ? ATTRIBUTE_TAGS_MAP[name3] : null;
|
|
1445
1477
|
if (tagName && allowedTags) {
|
|
1446
1478
|
if (allowedTags.indexOf(tagName) === -1) {
|
|
1447
1479
|
report(context, messages.invalidPropOnTag, "invalidPropOnTag", {
|
|
@@ -1455,9 +1487,9 @@ var no_unknown_property_default = createRule({
|
|
|
1455
1487
|
}
|
|
1456
1488
|
return;
|
|
1457
1489
|
}
|
|
1458
|
-
const standardName = getStandardName(
|
|
1459
|
-
const hasStandardNameButIsNotUsed = standardName && standardName !==
|
|
1460
|
-
const usesStandardName = standardName && standardName ===
|
|
1490
|
+
const standardName = getStandardName(name3, context);
|
|
1491
|
+
const hasStandardNameButIsNotUsed = standardName && standardName !== name3;
|
|
1492
|
+
const usesStandardName = standardName && standardName === name3;
|
|
1461
1493
|
if (usesStandardName) {
|
|
1462
1494
|
return;
|
|
1463
1495
|
}
|
|
@@ -1528,9 +1560,9 @@ var no_unsafe_iframe_sandbox_default = createRule({
|
|
|
1528
1560
|
},
|
|
1529
1561
|
name: RULE_NAME10,
|
|
1530
1562
|
create(context) {
|
|
1531
|
-
const
|
|
1532
|
-
const polymorphicPropName =
|
|
1533
|
-
const additionalComponents =
|
|
1563
|
+
const settings2 = shared.getSettingsFromContext(context);
|
|
1564
|
+
const polymorphicPropName = settings2.polymorphicPropName;
|
|
1565
|
+
const additionalComponents = settings2.additionalComponents.filter((c) => c.as === "iframe");
|
|
1534
1566
|
return {
|
|
1535
1567
|
JSXElement(node) {
|
|
1536
1568
|
const [elementNameOnJsx, elementNameOnDom] = getElementNameOnJsxAndDom(
|
|
@@ -1598,9 +1630,9 @@ var no_unsafe_target_blank_default = createRule({
|
|
|
1598
1630
|
},
|
|
1599
1631
|
name: RULE_NAME11,
|
|
1600
1632
|
create(context) {
|
|
1601
|
-
const
|
|
1602
|
-
const polymorphicPropName =
|
|
1603
|
-
const additionalComponents =
|
|
1633
|
+
const settings2 = shared.getSettingsFromContext(context);
|
|
1634
|
+
const polymorphicPropName = settings2.polymorphicPropName;
|
|
1635
|
+
const additionalComponents = settings2.additionalComponents.filter((c) => c.as === "a");
|
|
1604
1636
|
return {
|
|
1605
1637
|
JSXElement(node) {
|
|
1606
1638
|
const [elementNameOnJsx, elementNameOnDom] = getElementNameOnJsxAndDom(
|
|
@@ -1612,9 +1644,9 @@ var no_unsafe_target_blank_default = createRule({
|
|
|
1612
1644
|
if (elementNameOnDom !== "a") return;
|
|
1613
1645
|
const elementScope = context.sourceCode.getScope(node);
|
|
1614
1646
|
const customComponent = findCustomComponent(elementNameOnJsx, additionalComponents);
|
|
1615
|
-
const getAttributeStringValue = (
|
|
1616
|
-
const customComponentProp = findCustomComponentProp(
|
|
1617
|
-
const propNameOnJsx = customComponentProp?.name ??
|
|
1647
|
+
const getAttributeStringValue = (name3) => {
|
|
1648
|
+
const customComponentProp = findCustomComponentProp(name3, customComponent?.attributes ?? []);
|
|
1649
|
+
const propNameOnJsx = customComponentProp?.name ?? name3;
|
|
1618
1650
|
const attributeNode = JSX__namespace.getAttribute(
|
|
1619
1651
|
propNameOnJsx,
|
|
1620
1652
|
node.openingElement.attributes,
|
|
@@ -1699,7 +1731,7 @@ var no_void_elements_with_children_default = createRule({
|
|
|
1699
1731
|
}
|
|
1700
1732
|
const { attributes } = node.openingElement;
|
|
1701
1733
|
const initialScope = context.sourceCode.getScope(node);
|
|
1702
|
-
const hasAttribute3 = (
|
|
1734
|
+
const hasAttribute3 = (name3) => JSX__namespace.hasAttribute(name3, attributes, initialScope);
|
|
1703
1735
|
if (hasAttribute3("children") || hasAttribute3("dangerouslySetInnerHTML")) {
|
|
1704
1736
|
context.report({
|
|
1705
1737
|
messageId: "noVoidElementsWithChildren",
|
|
@@ -1715,10 +1747,10 @@ var no_void_elements_with_children_default = createRule({
|
|
|
1715
1747
|
defaultOptions: []
|
|
1716
1748
|
});
|
|
1717
1749
|
|
|
1718
|
-
// src/
|
|
1719
|
-
var
|
|
1750
|
+
// src/plugin.ts
|
|
1751
|
+
var plugin = {
|
|
1720
1752
|
meta: {
|
|
1721
|
-
name,
|
|
1753
|
+
name: name2,
|
|
1722
1754
|
version
|
|
1723
1755
|
},
|
|
1724
1756
|
rules: {
|
|
@@ -1740,4 +1772,27 @@ var index_default = {
|
|
|
1740
1772
|
}
|
|
1741
1773
|
};
|
|
1742
1774
|
|
|
1775
|
+
// src/index.ts
|
|
1776
|
+
function makeConfig(config) {
|
|
1777
|
+
return {
|
|
1778
|
+
...config,
|
|
1779
|
+
plugins: {
|
|
1780
|
+
"react-dom": plugin
|
|
1781
|
+
}
|
|
1782
|
+
};
|
|
1783
|
+
}
|
|
1784
|
+
function makeLegacyConfig({ rules: rules2 }) {
|
|
1785
|
+
return {
|
|
1786
|
+
plugins: ["react-dom"],
|
|
1787
|
+
rules: rules2
|
|
1788
|
+
};
|
|
1789
|
+
}
|
|
1790
|
+
var index_default = {
|
|
1791
|
+
...plugin,
|
|
1792
|
+
configs: {
|
|
1793
|
+
["recommended"]: makeConfig(recommended_exports),
|
|
1794
|
+
["recommended-legacy"]: makeLegacyConfig(recommended_exports)
|
|
1795
|
+
}
|
|
1796
|
+
};
|
|
1797
|
+
|
|
1743
1798
|
module.exports = index_default;
|
package/dist/index.mjs
CHANGED
|
@@ -1,40 +1,72 @@
|
|
|
1
|
+
import { createRuleForPlugin, getSettingsFromContext, RE_JAVASCRIPT_PROTOCOL, DEFAULT_ESLINT_REACT_SETTINGS } from '@eslint-react/shared';
|
|
1
2
|
import * as JSX from '@eslint-react/jsx';
|
|
2
|
-
import { createRuleForPlugin, getSettingsFromContext, RE_JAVASCRIPT_PROTOCOL } from '@eslint-react/shared';
|
|
3
3
|
import { AST_NODE_TYPES } from '@typescript-eslint/types';
|
|
4
4
|
import * as AST from '@eslint-react/ast';
|
|
5
5
|
import { compare } from 'compare-versions';
|
|
6
6
|
import { _ } from '@eslint-react/eff';
|
|
7
7
|
|
|
8
|
+
var __defProp = Object.defineProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name3 in all)
|
|
11
|
+
__defProp(target, name3, { get: all[name3], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
// src/configs/recommended.ts
|
|
15
|
+
var recommended_exports = {};
|
|
16
|
+
__export(recommended_exports, {
|
|
17
|
+
name: () => name,
|
|
18
|
+
rules: () => rules,
|
|
19
|
+
settings: () => settings
|
|
20
|
+
});
|
|
21
|
+
var name = "react-dom/recommended";
|
|
22
|
+
var rules = {
|
|
23
|
+
"react-dom/no-dangerously-set-innerhtml": "warn",
|
|
24
|
+
"react-dom/no-dangerously-set-innerhtml-with-children": "error",
|
|
25
|
+
"react-dom/no-find-dom-node": "error",
|
|
26
|
+
"react-dom/no-missing-button-type": "warn",
|
|
27
|
+
"react-dom/no-missing-iframe-sandbox": "warn",
|
|
28
|
+
"react-dom/no-namespace": "error",
|
|
29
|
+
"react-dom/no-render-return-value": "error",
|
|
30
|
+
"react-dom/no-script-url": "warn",
|
|
31
|
+
"react-dom/no-unknown-property": "warn",
|
|
32
|
+
"react-dom/no-unsafe-iframe-sandbox": "warn",
|
|
33
|
+
"react-dom/no-unsafe-target-blank": "warn",
|
|
34
|
+
"react-dom/no-void-elements-with-children": "warn"
|
|
35
|
+
};
|
|
36
|
+
var settings = {
|
|
37
|
+
"react-x": DEFAULT_ESLINT_REACT_SETTINGS
|
|
38
|
+
};
|
|
39
|
+
|
|
8
40
|
// package.json
|
|
9
|
-
var
|
|
10
|
-
var version = "1.26.3-next.
|
|
41
|
+
var name2 = "eslint-plugin-react-dom";
|
|
42
|
+
var version = "1.26.3-next.20";
|
|
11
43
|
var createRule = createRuleForPlugin("dom");
|
|
12
44
|
|
|
13
45
|
// src/utils/find-custom-component.ts
|
|
14
|
-
function findCustomComponent(
|
|
15
|
-
return components.findLast((c) => c.name ===
|
|
46
|
+
function findCustomComponent(name3, components) {
|
|
47
|
+
return components.findLast((c) => c.name === name3 || c.re.test(name3));
|
|
16
48
|
}
|
|
17
|
-
function findCustomComponentProp(
|
|
18
|
-
return props.findLast((a) => a.as ===
|
|
49
|
+
function findCustomComponentProp(name3, props) {
|
|
50
|
+
return props.findLast((a) => a.as === name3);
|
|
19
51
|
}
|
|
20
52
|
function getElementNameOnJsxAndDom(node, context, polymorphicPropName, additionalComponents = []) {
|
|
21
|
-
const
|
|
22
|
-
if (
|
|
23
|
-
const component = additionalComponents.findLast((c) => c.name ===
|
|
24
|
-
if (component != null) return [
|
|
25
|
-
if (polymorphicPropName == null) return [
|
|
53
|
+
const name3 = JSX.getElementName(node);
|
|
54
|
+
if (name3 === name3.toLowerCase()) return [name3, name3];
|
|
55
|
+
const component = additionalComponents.findLast((c) => c.name === name3 || c.re.test(name3));
|
|
56
|
+
if (component != null) return [name3, component.as];
|
|
57
|
+
if (polymorphicPropName == null) return [name3, name3];
|
|
26
58
|
const initialScope = context.sourceCode.getScope(node);
|
|
27
59
|
const attributeNode = JSX.getAttribute(
|
|
28
60
|
polymorphicPropName,
|
|
29
61
|
node.openingElement.attributes,
|
|
30
62
|
initialScope
|
|
31
63
|
);
|
|
32
|
-
if (attributeNode == null) return [
|
|
64
|
+
if (attributeNode == null) return [name3, name3];
|
|
33
65
|
const polymorphicPropValue = JSX.getAttributeValue(attributeNode, polymorphicPropName, initialScope);
|
|
34
66
|
if (polymorphicPropValue.kind === "some" && typeof polymorphicPropValue.value === "string") {
|
|
35
|
-
return [
|
|
67
|
+
return [name3, polymorphicPropValue.value];
|
|
36
68
|
}
|
|
37
|
-
return [
|
|
69
|
+
return [name3, name3];
|
|
38
70
|
}
|
|
39
71
|
|
|
40
72
|
// src/rules/no-dangerously-set-innerhtml.ts
|
|
@@ -170,9 +202,9 @@ var no_missing_button_type_default = createRule({
|
|
|
170
202
|
},
|
|
171
203
|
name: RULE_NAME4,
|
|
172
204
|
create(context) {
|
|
173
|
-
const
|
|
174
|
-
const polymorphicPropName =
|
|
175
|
-
const additionalComponents =
|
|
205
|
+
const settings2 = getSettingsFromContext(context);
|
|
206
|
+
const polymorphicPropName = settings2.polymorphicPropName;
|
|
207
|
+
const additionalComponents = settings2.additionalComponents.filter((c) => c.as === "button");
|
|
176
208
|
return {
|
|
177
209
|
JSXElement(node) {
|
|
178
210
|
const [elementNameOnJsx, elementNameOnDom] = getElementNameOnJsxAndDom(
|
|
@@ -252,9 +284,9 @@ var no_missing_iframe_sandbox_default = createRule({
|
|
|
252
284
|
},
|
|
253
285
|
name: RULE_NAME5,
|
|
254
286
|
create(context) {
|
|
255
|
-
const
|
|
256
|
-
const polymorphicPropName =
|
|
257
|
-
const additionalComponents =
|
|
287
|
+
const settings2 = getSettingsFromContext(context);
|
|
288
|
+
const polymorphicPropName = settings2.polymorphicPropName;
|
|
289
|
+
const additionalComponents = settings2.additionalComponents.filter((c) => c.as === "iframe");
|
|
258
290
|
return {
|
|
259
291
|
JSXElement(node) {
|
|
260
292
|
const [elementNameOnJsx, elementNameOnDom] = getElementNameOnJsxAndDom(
|
|
@@ -314,15 +346,15 @@ var no_namespace_default = createRule({
|
|
|
314
346
|
create(context) {
|
|
315
347
|
return {
|
|
316
348
|
JSXElement(node) {
|
|
317
|
-
const
|
|
318
|
-
if (typeof
|
|
349
|
+
const name3 = JSX.getElementName(node);
|
|
350
|
+
if (typeof name3 !== "string" || !name3.includes(":")) {
|
|
319
351
|
return;
|
|
320
352
|
}
|
|
321
353
|
context.report({
|
|
322
354
|
messageId: "noNamespace",
|
|
323
355
|
node: node.openingElement.name,
|
|
324
356
|
data: {
|
|
325
|
-
name:
|
|
357
|
+
name: name3
|
|
326
358
|
}
|
|
327
359
|
});
|
|
328
360
|
}
|
|
@@ -1322,17 +1354,17 @@ function isValidHTMLTagInJSX(childNode) {
|
|
|
1322
1354
|
}
|
|
1323
1355
|
return false;
|
|
1324
1356
|
}
|
|
1325
|
-
function normalizeAttributeCase(
|
|
1326
|
-
return DOM_PROPERTIES_IGNORE_CASE.find((element) => element.toLowerCase() ===
|
|
1357
|
+
function normalizeAttributeCase(name3) {
|
|
1358
|
+
return DOM_PROPERTIES_IGNORE_CASE.find((element) => element.toLowerCase() === name3.toLowerCase()) || name3;
|
|
1327
1359
|
}
|
|
1328
|
-
function isValidDataAttribute(
|
|
1329
|
-
return !/^data-xml/i.test(
|
|
1360
|
+
function isValidDataAttribute(name3) {
|
|
1361
|
+
return !/^data-xml/i.test(name3) && /^data-[^:]*$/.test(name3);
|
|
1330
1362
|
}
|
|
1331
|
-
function hasUpperCaseCharacter(
|
|
1332
|
-
return
|
|
1363
|
+
function hasUpperCaseCharacter(name3) {
|
|
1364
|
+
return name3.toLowerCase() !== name3;
|
|
1333
1365
|
}
|
|
1334
|
-
function isValidAriaAttribute(
|
|
1335
|
-
return ARIA_PROPERTIES.some((element) => element ===
|
|
1366
|
+
function isValidAriaAttribute(name3) {
|
|
1367
|
+
return ARIA_PROPERTIES.some((element) => element === name3);
|
|
1336
1368
|
}
|
|
1337
1369
|
function getTagName(node) {
|
|
1338
1370
|
if (node?.parent?.name) {
|
|
@@ -1343,15 +1375,15 @@ function getTagName(node) {
|
|
|
1343
1375
|
function tagNameHasDot(node) {
|
|
1344
1376
|
return !!(node.parent?.name && node.parent.name.type === "JSXMemberExpression");
|
|
1345
1377
|
}
|
|
1346
|
-
function getStandardName(
|
|
1347
|
-
if (has(DOM_ATTRIBUTE_NAMES,
|
|
1348
|
-
return DOM_ATTRIBUTE_NAMES[
|
|
1378
|
+
function getStandardName(name3, context) {
|
|
1379
|
+
if (has(DOM_ATTRIBUTE_NAMES, name3)) {
|
|
1380
|
+
return DOM_ATTRIBUTE_NAMES[name3];
|
|
1349
1381
|
}
|
|
1350
|
-
if (has(SVGDOM_ATTRIBUTE_NAMES,
|
|
1351
|
-
return SVGDOM_ATTRIBUTE_NAMES[
|
|
1382
|
+
if (has(SVGDOM_ATTRIBUTE_NAMES, name3)) {
|
|
1383
|
+
return SVGDOM_ATTRIBUTE_NAMES[name3];
|
|
1352
1384
|
}
|
|
1353
1385
|
const names = getDOMPropertyNames(context);
|
|
1354
|
-
return names.find((element) => element.toLowerCase() ===
|
|
1386
|
+
return names.find((element) => element.toLowerCase() === name3.toLowerCase());
|
|
1355
1387
|
}
|
|
1356
1388
|
var messages = {
|
|
1357
1389
|
dataLowercaseRequired: "React does not recognize data-* props with uppercase characters on a DOM element. Found '{{name}}', use '{{lowerCaseName}}' instead",
|
|
@@ -1398,12 +1430,12 @@ var no_unknown_property_default = createRule({
|
|
|
1398
1430
|
if (ignoreNames.indexOf(actualName) >= 0) {
|
|
1399
1431
|
return;
|
|
1400
1432
|
}
|
|
1401
|
-
const
|
|
1433
|
+
const name3 = normalizeAttributeCase(actualName);
|
|
1402
1434
|
if (tagNameHasDot(node)) {
|
|
1403
1435
|
return;
|
|
1404
1436
|
}
|
|
1405
|
-
if (isValidDataAttribute(
|
|
1406
|
-
if (getRequireDataLowercase() && hasUpperCaseCharacter(
|
|
1437
|
+
if (isValidDataAttribute(name3)) {
|
|
1438
|
+
if (getRequireDataLowercase() && hasUpperCaseCharacter(name3)) {
|
|
1407
1439
|
report(context, messages.dataLowercaseRequired, "dataLowercaseRequired", {
|
|
1408
1440
|
node,
|
|
1409
1441
|
data: {
|
|
@@ -1414,11 +1446,11 @@ var no_unknown_property_default = createRule({
|
|
|
1414
1446
|
}
|
|
1415
1447
|
return;
|
|
1416
1448
|
}
|
|
1417
|
-
if (isValidAriaAttribute(
|
|
1449
|
+
if (isValidAriaAttribute(name3)) return;
|
|
1418
1450
|
const tagName = getTagName(node);
|
|
1419
1451
|
if (tagName === "fbt" || tagName === "fbs") return;
|
|
1420
1452
|
if (!isValidHTMLTagInJSX(node)) return;
|
|
1421
|
-
const allowedTags = has(ATTRIBUTE_TAGS_MAP,
|
|
1453
|
+
const allowedTags = has(ATTRIBUTE_TAGS_MAP, name3) ? ATTRIBUTE_TAGS_MAP[name3] : null;
|
|
1422
1454
|
if (tagName && allowedTags) {
|
|
1423
1455
|
if (allowedTags.indexOf(tagName) === -1) {
|
|
1424
1456
|
report(context, messages.invalidPropOnTag, "invalidPropOnTag", {
|
|
@@ -1432,9 +1464,9 @@ var no_unknown_property_default = createRule({
|
|
|
1432
1464
|
}
|
|
1433
1465
|
return;
|
|
1434
1466
|
}
|
|
1435
|
-
const standardName = getStandardName(
|
|
1436
|
-
const hasStandardNameButIsNotUsed = standardName && standardName !==
|
|
1437
|
-
const usesStandardName = standardName && standardName ===
|
|
1467
|
+
const standardName = getStandardName(name3, context);
|
|
1468
|
+
const hasStandardNameButIsNotUsed = standardName && standardName !== name3;
|
|
1469
|
+
const usesStandardName = standardName && standardName === name3;
|
|
1438
1470
|
if (usesStandardName) {
|
|
1439
1471
|
return;
|
|
1440
1472
|
}
|
|
@@ -1505,9 +1537,9 @@ var no_unsafe_iframe_sandbox_default = createRule({
|
|
|
1505
1537
|
},
|
|
1506
1538
|
name: RULE_NAME10,
|
|
1507
1539
|
create(context) {
|
|
1508
|
-
const
|
|
1509
|
-
const polymorphicPropName =
|
|
1510
|
-
const additionalComponents =
|
|
1540
|
+
const settings2 = getSettingsFromContext(context);
|
|
1541
|
+
const polymorphicPropName = settings2.polymorphicPropName;
|
|
1542
|
+
const additionalComponents = settings2.additionalComponents.filter((c) => c.as === "iframe");
|
|
1511
1543
|
return {
|
|
1512
1544
|
JSXElement(node) {
|
|
1513
1545
|
const [elementNameOnJsx, elementNameOnDom] = getElementNameOnJsxAndDom(
|
|
@@ -1575,9 +1607,9 @@ var no_unsafe_target_blank_default = createRule({
|
|
|
1575
1607
|
},
|
|
1576
1608
|
name: RULE_NAME11,
|
|
1577
1609
|
create(context) {
|
|
1578
|
-
const
|
|
1579
|
-
const polymorphicPropName =
|
|
1580
|
-
const additionalComponents =
|
|
1610
|
+
const settings2 = getSettingsFromContext(context);
|
|
1611
|
+
const polymorphicPropName = settings2.polymorphicPropName;
|
|
1612
|
+
const additionalComponents = settings2.additionalComponents.filter((c) => c.as === "a");
|
|
1581
1613
|
return {
|
|
1582
1614
|
JSXElement(node) {
|
|
1583
1615
|
const [elementNameOnJsx, elementNameOnDom] = getElementNameOnJsxAndDom(
|
|
@@ -1589,9 +1621,9 @@ var no_unsafe_target_blank_default = createRule({
|
|
|
1589
1621
|
if (elementNameOnDom !== "a") return;
|
|
1590
1622
|
const elementScope = context.sourceCode.getScope(node);
|
|
1591
1623
|
const customComponent = findCustomComponent(elementNameOnJsx, additionalComponents);
|
|
1592
|
-
const getAttributeStringValue = (
|
|
1593
|
-
const customComponentProp = findCustomComponentProp(
|
|
1594
|
-
const propNameOnJsx = customComponentProp?.name ??
|
|
1624
|
+
const getAttributeStringValue = (name3) => {
|
|
1625
|
+
const customComponentProp = findCustomComponentProp(name3, customComponent?.attributes ?? []);
|
|
1626
|
+
const propNameOnJsx = customComponentProp?.name ?? name3;
|
|
1595
1627
|
const attributeNode = JSX.getAttribute(
|
|
1596
1628
|
propNameOnJsx,
|
|
1597
1629
|
node.openingElement.attributes,
|
|
@@ -1676,7 +1708,7 @@ var no_void_elements_with_children_default = createRule({
|
|
|
1676
1708
|
}
|
|
1677
1709
|
const { attributes } = node.openingElement;
|
|
1678
1710
|
const initialScope = context.sourceCode.getScope(node);
|
|
1679
|
-
const hasAttribute3 = (
|
|
1711
|
+
const hasAttribute3 = (name3) => JSX.hasAttribute(name3, attributes, initialScope);
|
|
1680
1712
|
if (hasAttribute3("children") || hasAttribute3("dangerouslySetInnerHTML")) {
|
|
1681
1713
|
context.report({
|
|
1682
1714
|
messageId: "noVoidElementsWithChildren",
|
|
@@ -1692,10 +1724,10 @@ var no_void_elements_with_children_default = createRule({
|
|
|
1692
1724
|
defaultOptions: []
|
|
1693
1725
|
});
|
|
1694
1726
|
|
|
1695
|
-
// src/
|
|
1696
|
-
var
|
|
1727
|
+
// src/plugin.ts
|
|
1728
|
+
var plugin = {
|
|
1697
1729
|
meta: {
|
|
1698
|
-
name,
|
|
1730
|
+
name: name2,
|
|
1699
1731
|
version
|
|
1700
1732
|
},
|
|
1701
1733
|
rules: {
|
|
@@ -1717,4 +1749,27 @@ var index_default = {
|
|
|
1717
1749
|
}
|
|
1718
1750
|
};
|
|
1719
1751
|
|
|
1752
|
+
// src/index.ts
|
|
1753
|
+
function makeConfig(config) {
|
|
1754
|
+
return {
|
|
1755
|
+
...config,
|
|
1756
|
+
plugins: {
|
|
1757
|
+
"react-dom": plugin
|
|
1758
|
+
}
|
|
1759
|
+
};
|
|
1760
|
+
}
|
|
1761
|
+
function makeLegacyConfig({ rules: rules2 }) {
|
|
1762
|
+
return {
|
|
1763
|
+
plugins: ["react-dom"],
|
|
1764
|
+
rules: rules2
|
|
1765
|
+
};
|
|
1766
|
+
}
|
|
1767
|
+
var index_default = {
|
|
1768
|
+
...plugin,
|
|
1769
|
+
configs: {
|
|
1770
|
+
["recommended"]: makeConfig(recommended_exports),
|
|
1771
|
+
["recommended-legacy"]: makeLegacyConfig(recommended_exports)
|
|
1772
|
+
}
|
|
1773
|
+
};
|
|
1774
|
+
|
|
1720
1775
|
export { index_default as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-dom",
|
|
3
|
-
"version": "1.26.3-next.
|
|
3
|
+
"version": "1.26.3-next.20",
|
|
4
4
|
"description": "ESLint React's ESLint plugin for React DOM related rules.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -43,24 +43,24 @@
|
|
|
43
43
|
"./package.json"
|
|
44
44
|
],
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@typescript-eslint/scope-manager": "^8.
|
|
47
|
-
"@typescript-eslint/types": "^8.
|
|
48
|
-
"@typescript-eslint/utils": "^8.
|
|
46
|
+
"@typescript-eslint/scope-manager": "^8.24.1",
|
|
47
|
+
"@typescript-eslint/types": "^8.24.1",
|
|
48
|
+
"@typescript-eslint/utils": "^8.24.1",
|
|
49
49
|
"compare-versions": "^6.1.1",
|
|
50
50
|
"string-ts": "^2.2.1",
|
|
51
51
|
"ts-pattern": "^5.6.2",
|
|
52
|
-
"@eslint-react/
|
|
53
|
-
"@eslint-react/
|
|
54
|
-
"@eslint-react/shared": "1.26.3-next.
|
|
55
|
-
"@eslint-react/
|
|
56
|
-
"@eslint-react/
|
|
57
|
-
"@eslint-react/
|
|
52
|
+
"@eslint-react/core": "1.26.3-next.20",
|
|
53
|
+
"@eslint-react/jsx": "1.26.3-next.20",
|
|
54
|
+
"@eslint-react/shared": "1.26.3-next.20",
|
|
55
|
+
"@eslint-react/var": "1.26.3-next.20",
|
|
56
|
+
"@eslint-react/eff": "1.26.3-next.20",
|
|
57
|
+
"@eslint-react/ast": "1.26.3-next.20"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@types/react": "^19.0.
|
|
61
|
-
"@types/react-dom": "^19.0.
|
|
60
|
+
"@types/react": "^19.0.10",
|
|
61
|
+
"@types/react-dom": "^19.0.4",
|
|
62
62
|
"tsup": "^8.3.6",
|
|
63
|
-
"@
|
|
63
|
+
"@local/configs": "0.0.0"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"eslint": "^8.57.0 || ^9.0.0",
|
|
@@ -84,6 +84,6 @@
|
|
|
84
84
|
"scripts": {
|
|
85
85
|
"build": "tsup --dts-resolve",
|
|
86
86
|
"lint:publish": "publint",
|
|
87
|
-
"lint:
|
|
87
|
+
"lint:ts": "tsc --noEmit"
|
|
88
88
|
}
|
|
89
89
|
}
|