eslint-plugin-react-dom 2.1.0-next.3 → 2.1.0-next.5
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.d.ts +6 -0
- package/dist/index.js +76 -57
- package/package.json +9 -9
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,12 @@ declare const _default: {
|
|
|
9
9
|
rules?: Record<string, _eslint_react_kit0.RuleConfig>;
|
|
10
10
|
settings?: _eslint_react_kit0.SettingsConfig;
|
|
11
11
|
};
|
|
12
|
+
strict: {
|
|
13
|
+
plugins: {};
|
|
14
|
+
name?: string;
|
|
15
|
+
rules?: Record<string, _eslint_react_kit0.RuleConfig>;
|
|
16
|
+
settings?: _eslint_react_kit0.SettingsConfig;
|
|
17
|
+
};
|
|
12
18
|
};
|
|
13
19
|
meta: {
|
|
14
20
|
name: string;
|
package/dist/index.js
CHANGED
|
@@ -9,45 +9,17 @@ import { RE_JAVASCRIPT_PROTOCOL } from "@eslint-react/kit";
|
|
|
9
9
|
var __defProp = Object.defineProperty;
|
|
10
10
|
var __export = (all) => {
|
|
11
11
|
let target = {};
|
|
12
|
-
for (var name$
|
|
13
|
-
get: all[name$
|
|
12
|
+
for (var name$3 in all) __defProp(target, name$3, {
|
|
13
|
+
get: all[name$3],
|
|
14
14
|
enumerable: true
|
|
15
15
|
});
|
|
16
16
|
return target;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
//#endregion
|
|
20
|
-
//#region src/configs/recommended.ts
|
|
21
|
-
var recommended_exports = /* @__PURE__ */ __export({
|
|
22
|
-
name: () => name$1,
|
|
23
|
-
rules: () => rules,
|
|
24
|
-
settings: () => settings
|
|
25
|
-
});
|
|
26
|
-
const name$1 = "react-dom/recommended";
|
|
27
|
-
const rules = {
|
|
28
|
-
"react-dom/no-dangerously-set-innerhtml": "warn",
|
|
29
|
-
"react-dom/no-dangerously-set-innerhtml-with-children": "error",
|
|
30
|
-
"react-dom/no-find-dom-node": "error",
|
|
31
|
-
"react-dom/no-flush-sync": "error",
|
|
32
|
-
"react-dom/no-hydrate": "error",
|
|
33
|
-
"react-dom/no-missing-button-type": "warn",
|
|
34
|
-
"react-dom/no-missing-iframe-sandbox": "warn",
|
|
35
|
-
"react-dom/no-namespace": "error",
|
|
36
|
-
"react-dom/no-render": "error",
|
|
37
|
-
"react-dom/no-render-return-value": "error",
|
|
38
|
-
"react-dom/no-script-url": "warn",
|
|
39
|
-
"react-dom/no-string-style-prop": "error",
|
|
40
|
-
"react-dom/no-unsafe-iframe-sandbox": "warn",
|
|
41
|
-
"react-dom/no-unsafe-target-blank": "warn",
|
|
42
|
-
"react-dom/no-use-form-state": "error",
|
|
43
|
-
"react-dom/no-void-elements-with-children": "error"
|
|
44
|
-
};
|
|
45
|
-
const settings = { "react-x": DEFAULT_ESLINT_REACT_SETTINGS };
|
|
46
|
-
|
|
47
19
|
//#endregion
|
|
48
20
|
//#region package.json
|
|
49
|
-
var name = "eslint-plugin-react-dom";
|
|
50
|
-
var version = "2.1.0-next.
|
|
21
|
+
var name$2 = "eslint-plugin-react-dom";
|
|
22
|
+
var version = "2.1.0-next.5";
|
|
51
23
|
|
|
52
24
|
//#endregion
|
|
53
25
|
//#region src/utils/create-jsx-element-resolver.ts
|
|
@@ -433,12 +405,12 @@ var no_namespace_default = createRule({
|
|
|
433
405
|
});
|
|
434
406
|
function create$10(context) {
|
|
435
407
|
return { JSXElement(node) {
|
|
436
|
-
const name$
|
|
437
|
-
if (typeof name$
|
|
408
|
+
const name$3 = getJsxElementType(context, node);
|
|
409
|
+
if (typeof name$3 !== "string" || !name$3.includes(":")) return;
|
|
438
410
|
context.report({
|
|
439
411
|
messageId: "noNamespace",
|
|
440
412
|
node: node.openingElement.name,
|
|
441
|
-
data: { name: name$
|
|
413
|
+
data: { name: name$3 }
|
|
442
414
|
});
|
|
443
415
|
} };
|
|
444
416
|
}
|
|
@@ -1579,32 +1551,32 @@ function isValidHTMLTagInJSX(childNode) {
|
|
|
1579
1551
|
* @param name - Attribute name to normalize
|
|
1580
1552
|
* @returns Normalized attribute name
|
|
1581
1553
|
*/
|
|
1582
|
-
function normalizeAttributeCase(name$
|
|
1583
|
-
return DOM_PROPERTIES_IGNORE_CASE.find((element) => element.toLowerCase() === name$
|
|
1554
|
+
function normalizeAttributeCase(name$3) {
|
|
1555
|
+
return DOM_PROPERTIES_IGNORE_CASE.find((element) => element.toLowerCase() === name$3.toLowerCase()) || name$3;
|
|
1584
1556
|
}
|
|
1585
1557
|
/**
|
|
1586
1558
|
* Checks if an attribute name is a valid data-* attribute
|
|
1587
1559
|
* @param name - Attribute name to test
|
|
1588
1560
|
* @returns Whether the attribute is a valid data attribute
|
|
1589
1561
|
*/
|
|
1590
|
-
function isValidDataAttribute(name$
|
|
1591
|
-
return !/^data-xml/i.test(name$
|
|
1562
|
+
function isValidDataAttribute(name$3) {
|
|
1563
|
+
return !/^data-xml/i.test(name$3) && /^data-[^:]*$/.test(name$3);
|
|
1592
1564
|
}
|
|
1593
1565
|
/**
|
|
1594
1566
|
* Checks if an attribute name has uppercase characters
|
|
1595
1567
|
* @param name - Attribute name to test
|
|
1596
1568
|
* @returns Whether the name has uppercase characters
|
|
1597
1569
|
*/
|
|
1598
|
-
function hasUpperCaseCharacter(name$
|
|
1599
|
-
return name$
|
|
1570
|
+
function hasUpperCaseCharacter(name$3) {
|
|
1571
|
+
return name$3.toLowerCase() !== name$3;
|
|
1600
1572
|
}
|
|
1601
1573
|
/**
|
|
1602
1574
|
* Checks if an attribute is a valid ARIA attribute
|
|
1603
1575
|
* @param name - Attribute name to test
|
|
1604
1576
|
* @returns Whether the attribute is a valid ARIA attribute
|
|
1605
1577
|
*/
|
|
1606
|
-
function isValidAriaAttribute(name$
|
|
1607
|
-
return ARIA_PROPERTIES.some((element) => element === name$
|
|
1578
|
+
function isValidAriaAttribute(name$3) {
|
|
1579
|
+
return ARIA_PROPERTIES.some((element) => element === name$3);
|
|
1608
1580
|
}
|
|
1609
1581
|
/**
|
|
1610
1582
|
* Gets the tag name for a JSXAttribute
|
|
@@ -1629,10 +1601,10 @@ function tagNameHasDot(node) {
|
|
|
1629
1601
|
* @param context - ESLint context
|
|
1630
1602
|
* @returns Standard name or undefined
|
|
1631
1603
|
*/
|
|
1632
|
-
function getStandardName(name$
|
|
1633
|
-
if (has(DOM_ATTRIBUTE_NAMES, name$
|
|
1634
|
-
if (has(SVGDOM_ATTRIBUTE_NAMES, name$
|
|
1635
|
-
return getDOMPropertyNames(context).find((element) => element.toLowerCase() === name$
|
|
1604
|
+
function getStandardName(name$3, context) {
|
|
1605
|
+
if (has(DOM_ATTRIBUTE_NAMES, name$3)) return DOM_ATTRIBUTE_NAMES[name$3];
|
|
1606
|
+
if (has(SVGDOM_ATTRIBUTE_NAMES, name$3)) return SVGDOM_ATTRIBUTE_NAMES[name$3];
|
|
1607
|
+
return getDOMPropertyNames(context).find((element) => element.toLowerCase() === name$3.toLowerCase());
|
|
1636
1608
|
}
|
|
1637
1609
|
/**
|
|
1638
1610
|
* Checks if an object has a property
|
|
@@ -1718,10 +1690,10 @@ function create$5(context) {
|
|
|
1718
1690
|
const ignoreNames = getIgnoreConfig();
|
|
1719
1691
|
const actualName = getText(context, node.name);
|
|
1720
1692
|
if (ignoreNames.indexOf(actualName) >= 0) return;
|
|
1721
|
-
const name$
|
|
1693
|
+
const name$3 = normalizeAttributeCase(actualName);
|
|
1722
1694
|
if (tagNameHasDot(node)) return;
|
|
1723
|
-
if (isValidDataAttribute(name$
|
|
1724
|
-
if (getRequireDataLowercase() && hasUpperCaseCharacter(name$
|
|
1695
|
+
if (isValidDataAttribute(name$3)) {
|
|
1696
|
+
if (getRequireDataLowercase() && hasUpperCaseCharacter(name$3)) context.report({
|
|
1725
1697
|
node,
|
|
1726
1698
|
messageId: "dataLowercaseRequired",
|
|
1727
1699
|
data: {
|
|
@@ -1731,11 +1703,11 @@ function create$5(context) {
|
|
|
1731
1703
|
});
|
|
1732
1704
|
return;
|
|
1733
1705
|
}
|
|
1734
|
-
if (isValidAriaAttribute(name$
|
|
1706
|
+
if (isValidAriaAttribute(name$3)) return;
|
|
1735
1707
|
const tagName = getTagName(node);
|
|
1736
1708
|
if (tagName === "fbt" || tagName === "fbs") return;
|
|
1737
1709
|
if (!isValidHTMLTagInJSX(node)) return;
|
|
1738
|
-
const allowedTags = has(ATTRIBUTE_TAGS_MAP, name$
|
|
1710
|
+
const allowedTags = has(ATTRIBUTE_TAGS_MAP, name$3) ? ATTRIBUTE_TAGS_MAP[name$3] : null;
|
|
1739
1711
|
if (tagName && allowedTags) {
|
|
1740
1712
|
if (allowedTags.indexOf(tagName) === -1) context.report({
|
|
1741
1713
|
node,
|
|
@@ -1748,9 +1720,9 @@ function create$5(context) {
|
|
|
1748
1720
|
});
|
|
1749
1721
|
return;
|
|
1750
1722
|
}
|
|
1751
|
-
const standardName = getStandardName(name$
|
|
1752
|
-
const hasStandardNameButIsNotUsed = !!standardName && standardName !== name$
|
|
1753
|
-
if (!!standardName && standardName === name$
|
|
1723
|
+
const standardName = getStandardName(name$3, context);
|
|
1724
|
+
const hasStandardNameButIsNotUsed = !!standardName && standardName !== name$3;
|
|
1725
|
+
if (!!standardName && standardName === name$3) return;
|
|
1754
1726
|
if (hasStandardNameButIsNotUsed) {
|
|
1755
1727
|
context.report({
|
|
1756
1728
|
node,
|
|
@@ -2069,7 +2041,7 @@ function create(context) {
|
|
|
2069
2041
|
//#region src/plugin.ts
|
|
2070
2042
|
const plugin = {
|
|
2071
2043
|
meta: {
|
|
2072
|
-
name,
|
|
2044
|
+
name: name$2,
|
|
2073
2045
|
version
|
|
2074
2046
|
},
|
|
2075
2047
|
rules: {
|
|
@@ -2094,12 +2066,59 @@ const plugin = {
|
|
|
2094
2066
|
}
|
|
2095
2067
|
};
|
|
2096
2068
|
|
|
2069
|
+
//#endregion
|
|
2070
|
+
//#region src/configs/recommended.ts
|
|
2071
|
+
var recommended_exports = /* @__PURE__ */ __export({
|
|
2072
|
+
name: () => name$1,
|
|
2073
|
+
plugins: () => plugins$1,
|
|
2074
|
+
rules: () => rules$1,
|
|
2075
|
+
settings: () => settings$1
|
|
2076
|
+
});
|
|
2077
|
+
const name$1 = "react-dom/recommended";
|
|
2078
|
+
const rules$1 = {
|
|
2079
|
+
"react-dom/no-dangerously-set-innerhtml": "warn",
|
|
2080
|
+
"react-dom/no-dangerously-set-innerhtml-with-children": "error",
|
|
2081
|
+
"react-dom/no-find-dom-node": "error",
|
|
2082
|
+
"react-dom/no-flush-sync": "error",
|
|
2083
|
+
"react-dom/no-hydrate": "error",
|
|
2084
|
+
"react-dom/no-namespace": "error",
|
|
2085
|
+
"react-dom/no-render": "error",
|
|
2086
|
+
"react-dom/no-render-return-value": "error",
|
|
2087
|
+
"react-dom/no-script-url": "warn",
|
|
2088
|
+
"react-dom/no-unsafe-iframe-sandbox": "warn",
|
|
2089
|
+
"react-dom/no-use-form-state": "error",
|
|
2090
|
+
"react-dom/no-void-elements-with-children": "error"
|
|
2091
|
+
};
|
|
2092
|
+
const plugins$1 = { "react-dom": plugin };
|
|
2093
|
+
const settings$1 = { "react-x": DEFAULT_ESLINT_REACT_SETTINGS };
|
|
2094
|
+
|
|
2095
|
+
//#endregion
|
|
2096
|
+
//#region src/configs/strict.ts
|
|
2097
|
+
var strict_exports = /* @__PURE__ */ __export({
|
|
2098
|
+
name: () => name,
|
|
2099
|
+
plugins: () => plugins,
|
|
2100
|
+
rules: () => rules,
|
|
2101
|
+
settings: () => settings
|
|
2102
|
+
});
|
|
2103
|
+
const name = "react-dom/strict";
|
|
2104
|
+
const rules = {
|
|
2105
|
+
...rules$1,
|
|
2106
|
+
"react-dom/no-missing-button-type": "warn",
|
|
2107
|
+
"react-dom/no-missing-iframe-sandbox": "warn",
|
|
2108
|
+
"react-dom/no-unsafe-target-blank": "warn"
|
|
2109
|
+
};
|
|
2110
|
+
const plugins = { ...plugins$1 };
|
|
2111
|
+
const settings = { ...settings$1 };
|
|
2112
|
+
|
|
2097
2113
|
//#endregion
|
|
2098
2114
|
//#region src/index.ts
|
|
2099
2115
|
const { toFlatConfig } = getConfigAdapters("react-dom", plugin);
|
|
2100
2116
|
var src_default = {
|
|
2101
2117
|
...plugin,
|
|
2102
|
-
configs: {
|
|
2118
|
+
configs: {
|
|
2119
|
+
["recommended"]: toFlatConfig(recommended_exports),
|
|
2120
|
+
["strict"]: toFlatConfig(strict_exports)
|
|
2121
|
+
}
|
|
2103
2122
|
};
|
|
2104
2123
|
|
|
2105
2124
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-dom",
|
|
3
|
-
"version": "2.1.0-next.
|
|
3
|
+
"version": "2.1.0-next.5",
|
|
4
4
|
"description": "ESLint React's ESLint plugin for React DOM related rules.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -41,12 +41,12 @@
|
|
|
41
41
|
"compare-versions": "^6.1.1",
|
|
42
42
|
"string-ts": "^2.2.1",
|
|
43
43
|
"ts-pattern": "^5.8.0",
|
|
44
|
-
"@eslint-react/ast": "2.1.0-next.
|
|
45
|
-
"@eslint-react/
|
|
46
|
-
"@eslint-react/
|
|
47
|
-
"@eslint-react/kit": "2.1.0-next.
|
|
48
|
-
"@eslint-react/
|
|
49
|
-
"@eslint-react/var": "2.1.0-next.
|
|
44
|
+
"@eslint-react/ast": "2.1.0-next.5",
|
|
45
|
+
"@eslint-react/core": "2.1.0-next.5",
|
|
46
|
+
"@eslint-react/eff": "2.1.0-next.5",
|
|
47
|
+
"@eslint-react/kit": "2.1.0-next.5",
|
|
48
|
+
"@eslint-react/shared": "2.1.0-next.5",
|
|
49
|
+
"@eslint-react/var": "2.1.0-next.5"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@types/react": "^19.2.2",
|
|
@@ -55,8 +55,8 @@
|
|
|
55
55
|
"@local/configs": "0.0.0"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
|
-
"eslint": "^9.
|
|
59
|
-
"typescript": "^5.9.
|
|
58
|
+
"eslint": "^9.37.0",
|
|
59
|
+
"typescript": "^5.9.3"
|
|
60
60
|
},
|
|
61
61
|
"engines": {
|
|
62
62
|
"node": ">=20.19.0"
|