eslint-plugin-react-dom 5.8.2 → 5.8.4-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +29 -4
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -25,7 +25,7 @@ var __exportAll = (all, no_symbols) => {
|
|
|
25
25
|
//#endregion
|
|
26
26
|
//#region package.json
|
|
27
27
|
var name$2 = "eslint-plugin-react-dom";
|
|
28
|
-
var version = "5.8.
|
|
28
|
+
var version = "5.8.4-next.0";
|
|
29
29
|
|
|
30
30
|
//#endregion
|
|
31
31
|
//#region src/utils/create-rule.ts
|
|
@@ -1454,6 +1454,18 @@ const POPOVER_API_PROPS = [
|
|
|
1454
1454
|
"onToggle",
|
|
1455
1455
|
"onBeforeToggle"
|
|
1456
1456
|
];
|
|
1457
|
+
const REACT_19_PROPS = [...POPOVER_API_PROPS];
|
|
1458
|
+
/**
|
|
1459
|
+
* Tag-specific attributes added in React 19
|
|
1460
|
+
*/
|
|
1461
|
+
const REACT_19_ATTRIBUTE_TAGS_MAP = {
|
|
1462
|
+
blocking: [
|
|
1463
|
+
"link",
|
|
1464
|
+
"script",
|
|
1465
|
+
"style"
|
|
1466
|
+
],
|
|
1467
|
+
precedence: ["link", "style"]
|
|
1468
|
+
};
|
|
1457
1469
|
/**
|
|
1458
1470
|
* Tests React version against a comparator
|
|
1459
1471
|
* @param context ESLint context
|
|
@@ -1477,11 +1489,23 @@ function getDOMPropertyNames(context) {
|
|
|
1477
1489
|
return ALL_DOM_PROPERTY_NAMES;
|
|
1478
1490
|
}
|
|
1479
1491
|
if (testReactVersion(context, ">=", "16.4.0")) ALL_DOM_PROPERTY_NAMES.push(...REACT_ON_PROPS);
|
|
1480
|
-
if (testReactVersion(context, ">=", "19.0.0-rc.0")) ALL_DOM_PROPERTY_NAMES.push(...
|
|
1481
|
-
else ALL_DOM_PROPERTY_NAMES.push(...
|
|
1492
|
+
if (testReactVersion(context, ">=", "19.0.0-rc.0")) ALL_DOM_PROPERTY_NAMES.push(...REACT_19_PROPS);
|
|
1493
|
+
else ALL_DOM_PROPERTY_NAMES.push(...REACT_19_PROPS.map((prop) => prop.toLowerCase()));
|
|
1482
1494
|
return ALL_DOM_PROPERTY_NAMES;
|
|
1483
1495
|
}
|
|
1484
1496
|
/**
|
|
1497
|
+
* Gets the map of attributes to their allowed tags based on React version
|
|
1498
|
+
* @param context ESLint rule context
|
|
1499
|
+
* @returns Map of attributes to allowed tags
|
|
1500
|
+
*/
|
|
1501
|
+
function getAttributeTagsMap(context) {
|
|
1502
|
+
if (testReactVersion(context, ">=", "19.0.0-rc.0")) return {
|
|
1503
|
+
...ATTRIBUTE_TAGS_MAP,
|
|
1504
|
+
...REACT_19_ATTRIBUTE_TAGS_MAP
|
|
1505
|
+
};
|
|
1506
|
+
return ATTRIBUTE_TAGS_MAP;
|
|
1507
|
+
}
|
|
1508
|
+
/**
|
|
1485
1509
|
* Check if a node's parent is a JSX tag that is written with lowercase letters,
|
|
1486
1510
|
* and is not a custom web component.
|
|
1487
1511
|
* @param childNode JSX element being tested
|
|
@@ -1649,7 +1673,8 @@ function create$4(context) {
|
|
|
1649
1673
|
const tagName = getTagName(node);
|
|
1650
1674
|
if (tagName === "fbt" || tagName === "fbs") return;
|
|
1651
1675
|
if (!isValidHTMLTagInJSX(node)) return;
|
|
1652
|
-
const
|
|
1676
|
+
const attributeTagsMap = getAttributeTagsMap(context);
|
|
1677
|
+
const allowedTags = has(attributeTagsMap, name) ? attributeTagsMap[name] : null;
|
|
1653
1678
|
if (tagName != null && allowedTags != null) {
|
|
1654
1679
|
if (!allowedTags.includes(tagName)) context.report({
|
|
1655
1680
|
data: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-dom",
|
|
3
|
-
"version": "5.8.
|
|
3
|
+
"version": "5.8.4-next.0",
|
|
4
4
|
"description": "ESLint React's ESLint plugin for DOM related rules.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -40,10 +40,10 @@
|
|
|
40
40
|
"@typescript-eslint/types": "^8.59.3",
|
|
41
41
|
"@typescript-eslint/utils": "^8.59.3",
|
|
42
42
|
"compare-versions": "^6.1.1",
|
|
43
|
-
"@eslint-react/
|
|
44
|
-
"@eslint-react/
|
|
45
|
-
"@eslint-react/
|
|
46
|
-
"@eslint-react/
|
|
43
|
+
"@eslint-react/ast": "5.8.4-next.0",
|
|
44
|
+
"@eslint-react/eslint": "5.8.4-next.0",
|
|
45
|
+
"@eslint-react/jsx": "5.8.4-next.0",
|
|
46
|
+
"@eslint-react/shared": "5.8.4-next.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@types/react": "^19.2.14",
|