eslint-plugin-react-dom 5.23.2 → 5.23.4
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 +8 -20
- package/package.json +8 -7
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import { Check, Extract } from "@eslint-react/ast";
|
|
|
6
6
|
import { createImportLookup } from "@eslint-react/var";
|
|
7
7
|
import { AST_NODE_TYPES } from "@typescript-eslint/types";
|
|
8
8
|
import { compare } from "compare-versions";
|
|
9
|
+
import { P, isMatching } from "ts-pattern";
|
|
9
10
|
|
|
10
11
|
//#region \0rolldown/runtime.js
|
|
11
12
|
var __defProp = Object.defineProperty;
|
|
@@ -26,7 +27,7 @@ var __exportAll = (all, no_symbols) => {
|
|
|
26
27
|
//#endregion
|
|
27
28
|
//#region package.json
|
|
28
29
|
var name$2 = "eslint-plugin-react-dom";
|
|
29
|
-
var version = "5.23.
|
|
30
|
+
var version = "5.23.4";
|
|
30
31
|
|
|
31
32
|
//#endregion
|
|
32
33
|
//#region src/utils/create-rule.ts
|
|
@@ -336,7 +337,7 @@ function create$9(context) {
|
|
|
336
337
|
return;
|
|
337
338
|
}
|
|
338
339
|
const sandboxValue = resolveAttributeValue(context, sandboxProp, "sandbox");
|
|
339
|
-
if (
|
|
340
|
+
if (isMatching(P.string, sandboxValue.toStatic())) return;
|
|
340
341
|
context.report({
|
|
341
342
|
messageId: "missingSandboxAttribute",
|
|
342
343
|
node: sandboxValue.node ?? sandboxProp,
|
|
@@ -473,7 +474,7 @@ function create$6(context) {
|
|
|
473
474
|
return { JSXAttribute(node) {
|
|
474
475
|
if (node.name.type !== AST_NODE_TYPES.JSXIdentifier || node.value == null) return;
|
|
475
476
|
const value = resolveAttributeValue(context, node).toStatic();
|
|
476
|
-
if (
|
|
477
|
+
if (isMatching(P.string, value) && RE_JAVASCRIPT_PROTOCOL.test(value)) context.report({
|
|
477
478
|
messageId: "default",
|
|
478
479
|
node: node.value
|
|
479
480
|
});
|
|
@@ -500,7 +501,7 @@ function create$5(context) {
|
|
|
500
501
|
const styleProp = findAttribute(context, node, "style");
|
|
501
502
|
if (styleProp == null) return;
|
|
502
503
|
const styleValue = resolveAttributeValue(context, styleProp);
|
|
503
|
-
if (
|
|
504
|
+
if (!isMatching(P.string, styleValue.toStatic())) return;
|
|
504
505
|
context.report({
|
|
505
506
|
messageId: "default",
|
|
506
507
|
node: styleValue.node ?? styleProp
|
|
@@ -1695,24 +1696,10 @@ function create$4(context) {
|
|
|
1695
1696
|
} };
|
|
1696
1697
|
}
|
|
1697
1698
|
|
|
1698
|
-
//#endregion
|
|
1699
|
-
//#region src/rules/no-unsafe-iframe-sandbox/lib.ts
|
|
1700
|
-
const UNSAFE_SANDBOX_VALUES = ["allow-scripts", "allow-same-origin"];
|
|
1701
|
-
/**
|
|
1702
|
-
* Check if the sandbox attribute value contains an unsafe combination
|
|
1703
|
-
* An iframe with both "allow-scripts" and "allow-same-origin" can remove its sandbox attribute,
|
|
1704
|
-
* making it as insecure as an iframe without any sandboxing
|
|
1705
|
-
* @param value The value of the sandbox attribute
|
|
1706
|
-
* @returns `true` if the value is a string and contains an unsafe combination, `false` otherwise
|
|
1707
|
-
*/
|
|
1708
|
-
function isUnsafeSandboxCombination(value) {
|
|
1709
|
-
if (typeof value !== "string") return false;
|
|
1710
|
-
return UNSAFE_SANDBOX_VALUES.every((v) => value.includes(v));
|
|
1711
|
-
}
|
|
1712
|
-
|
|
1713
1699
|
//#endregion
|
|
1714
1700
|
//#region src/rules/no-unsafe-iframe-sandbox/no-unsafe-iframe-sandbox.ts
|
|
1715
1701
|
const RULE_NAME$3 = "no-unsafe-iframe-sandbox";
|
|
1702
|
+
const UNSAFE_SANDBOX_VALUES = ["allow-scripts", "allow-same-origin"];
|
|
1716
1703
|
var no_unsafe_iframe_sandbox_default = createRule({
|
|
1717
1704
|
meta: {
|
|
1718
1705
|
type: "problem",
|
|
@@ -1732,7 +1719,8 @@ function create$3(context) {
|
|
|
1732
1719
|
const sandboxProp = findAttribute(context, node, "sandbox");
|
|
1733
1720
|
if (sandboxProp == null) return;
|
|
1734
1721
|
const sandboxValue = resolveAttributeValue(context, sandboxProp, "sandbox");
|
|
1735
|
-
|
|
1722
|
+
const value = sandboxValue.toStatic();
|
|
1723
|
+
if (!isMatching(P.string, value) || !UNSAFE_SANDBOX_VALUES.every((a) => value.includes(a))) return;
|
|
1736
1724
|
context.report({
|
|
1737
1725
|
messageId: "default",
|
|
1738
1726
|
node: sandboxValue.node ?? sandboxProp
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-dom",
|
|
3
|
-
"version": "5.23.
|
|
3
|
+
"version": "5.23.4",
|
|
4
4
|
"description": "ESLint React's ESLint plugin for DOM related rules.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -37,14 +37,15 @@
|
|
|
37
37
|
"dist"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@eslint-react/ast": "5.23.
|
|
41
|
-
"@eslint-react/eslint": "5.23.
|
|
42
|
-
"@eslint-react/jsx": "5.23.
|
|
43
|
-
"@eslint-react/shared": "5.23.
|
|
44
|
-
"@eslint-react/var": "5.23.
|
|
40
|
+
"@eslint-react/ast": "5.23.4",
|
|
41
|
+
"@eslint-react/eslint": "5.23.4",
|
|
42
|
+
"@eslint-react/jsx": "5.23.4",
|
|
43
|
+
"@eslint-react/shared": "5.23.4",
|
|
44
|
+
"@eslint-react/var": "5.23.4",
|
|
45
45
|
"@typescript-eslint/types": "^8.71.0",
|
|
46
46
|
"@typescript-eslint/utils": "^8.71.0",
|
|
47
|
-
"compare-versions": "^6.1.1"
|
|
47
|
+
"compare-versions": "^6.1.1",
|
|
48
|
+
"ts-pattern": "^5.9.0"
|
|
48
49
|
},
|
|
49
50
|
"devDependencies": {
|
|
50
51
|
"@local/configs": "0.0.0",
|