eslint-plugin-react-dom 1.19.0 → 1.20.0-beta.13
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 +1 -14
- package/dist/index.d.mts +0 -10
- package/dist/index.d.ts +0 -10
- package/dist/index.js +57 -29
- package/dist/index.mjs +57 -29
- package/package.json +15 -13
package/README.md
CHANGED
|
@@ -48,17 +48,4 @@ export default [
|
|
|
48
48
|
|
|
49
49
|
## Rules
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
| :------------------------------------------- | :-------------------------------------------------------------------------------------- | :-: | :-: | :-: |
|
|
53
|
-
| `no-children-in-void-dom-elements` | Prevents usage of `children` in void `DOM elements`. | ✔️ | | |
|
|
54
|
-
| `no-dangerously-set-innerhtml-with-children` | Prevents `DOM element` using `dangerouslySetInnerHTML` and `children` at the same time. | ✔️ | | |
|
|
55
|
-
| `no-dangerously-set-innerhtml` | Prevents `DOM element` using `dangerouslySetInnerHTML`. | 🔒 | | |
|
|
56
|
-
| `no-find-dom-node` | Prevents usage of `findDOMNode`. | ⛔ | | |
|
|
57
|
-
| `no-missing-button-type` | Enforces explicit `type` attribute for `<button>` elements. | ✔️ | | |
|
|
58
|
-
| `no-missing-iframe-sandbox` | Enforces explicit `sandbox` attribute for `iframe` elements. | 🔒 | | |
|
|
59
|
-
| `no-namespace` | Enforces the absence of a `namespace` in React elements. | ✔️ | | |
|
|
60
|
-
| `no-render-return-value` | Prevents usage of the return value of `ReactDOM.render`. | ⛔ | | |
|
|
61
|
-
| `no-script-url` | Prevents usage of `javascript:` URLs as the value of certain attributes. | 🔒 | | |
|
|
62
|
-
| `no-unknown-property` | Prevents usage of unknown DOM property. | ✔️ | | 🔧 |
|
|
63
|
-
| `no-unsafe-iframe-sandbox` | Enforces `sandbox` attribute for `iframe` elements is not set to unsafe combinations. | 🔒 | | |
|
|
64
|
-
| `no-unsafe-target-blank` | Prevents usage of `target="_blank"` without `rel="noreferrer noopener"`. | 🔒 | | |
|
|
51
|
+
<https://eslint-react.xyz/docs/rules/overview#dom-rules>
|
package/dist/index.d.mts
CHANGED
|
@@ -19,16 +19,6 @@ declare const _default: {
|
|
|
19
19
|
readonly "no-unsafe-iframe-sandbox": _typescript_eslint_utils_ts_eslint.RuleModule<"noUnsafeIframeSandbox", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
20
20
|
readonly "no-unsafe-target-blank": _typescript_eslint_utils_ts_eslint.RuleModule<"noUnsafeTargetBlank", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
21
21
|
};
|
|
22
|
-
readonly DEFAULT_ESLINT_REACT_SETTINGS: {
|
|
23
|
-
readonly additionalComponents: [{
|
|
24
|
-
readonly name: "Link";
|
|
25
|
-
readonly as: "a";
|
|
26
|
-
readonly attributes: [{
|
|
27
|
-
readonly name: "to";
|
|
28
|
-
readonly as: "href";
|
|
29
|
-
}];
|
|
30
|
-
}];
|
|
31
|
-
};
|
|
32
22
|
};
|
|
33
23
|
|
|
34
24
|
export { _default as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -19,16 +19,6 @@ declare const _default: {
|
|
|
19
19
|
readonly "no-unsafe-iframe-sandbox": _typescript_eslint_utils_ts_eslint.RuleModule<"noUnsafeIframeSandbox", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
20
20
|
readonly "no-unsafe-target-blank": _typescript_eslint_utils_ts_eslint.RuleModule<"noUnsafeTargetBlank", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
21
21
|
};
|
|
22
|
-
readonly DEFAULT_ESLINT_REACT_SETTINGS: {
|
|
23
|
-
readonly additionalComponents: [{
|
|
24
|
-
readonly name: "Link";
|
|
25
|
-
readonly as: "a";
|
|
26
|
-
readonly attributes: [{
|
|
27
|
-
readonly name: "to";
|
|
28
|
-
readonly as: "href";
|
|
29
|
-
}];
|
|
30
|
-
}];
|
|
31
|
-
};
|
|
32
22
|
};
|
|
33
23
|
|
|
34
24
|
export { _default as default };
|
package/dist/index.js
CHANGED
|
@@ -32,7 +32,7 @@ var AST__namespace = /*#__PURE__*/_interopNamespace(AST);
|
|
|
32
32
|
|
|
33
33
|
// package.json
|
|
34
34
|
var name = "eslint-plugin-react-dom";
|
|
35
|
-
var version = "1.
|
|
35
|
+
var version = "1.20.0-beta.13";
|
|
36
36
|
var createRule = shared.createRuleForPlugin("dom");
|
|
37
37
|
function findAttrInCustomAttributes(name2, attributes) {
|
|
38
38
|
return tools.F.pipe(
|
|
@@ -44,6 +44,9 @@ function findAttrInCustomAttributes(name2, attributes) {
|
|
|
44
44
|
|
|
45
45
|
// src/rules/no-children-in-void-dom-elements.ts
|
|
46
46
|
var RULE_NAME = "no-children-in-void-dom-elements";
|
|
47
|
+
var RULE_FEATURES = [
|
|
48
|
+
"CHK"
|
|
49
|
+
];
|
|
47
50
|
var voidElements = [
|
|
48
51
|
"area",
|
|
49
52
|
"base",
|
|
@@ -66,7 +69,8 @@ var no_children_in_void_dom_elements_default = createRule({
|
|
|
66
69
|
meta: {
|
|
67
70
|
type: "problem",
|
|
68
71
|
docs: {
|
|
69
|
-
description: "disallow passing 'children' to void DOM elements"
|
|
72
|
+
description: "disallow passing 'children' to void DOM elements",
|
|
73
|
+
[Symbol.for("rule_features")]: RULE_FEATURES
|
|
70
74
|
},
|
|
71
75
|
messages: {
|
|
72
76
|
noChildrenInVoidDomElements: "A void DOM element '<{{element}} />' cannot have children."
|
|
@@ -107,11 +111,15 @@ var no_children_in_void_dom_elements_default = createRule({
|
|
|
107
111
|
defaultOptions: []
|
|
108
112
|
});
|
|
109
113
|
var RULE_NAME2 = "no-dangerously-set-innerhtml";
|
|
114
|
+
var RULE_FEATURES2 = [
|
|
115
|
+
"CHK"
|
|
116
|
+
];
|
|
110
117
|
var no_dangerously_set_innerhtml_default = createRule({
|
|
111
118
|
meta: {
|
|
112
119
|
type: "problem",
|
|
113
120
|
docs: {
|
|
114
|
-
description: "disallow when a DOM component is using 'dangerouslySetInnerHTML'"
|
|
121
|
+
description: "disallow when a DOM component is using 'dangerouslySetInnerHTML'",
|
|
122
|
+
[Symbol.for("rule_features")]: RULE_FEATURES2
|
|
115
123
|
},
|
|
116
124
|
messages: {
|
|
117
125
|
noDangerouslySetInnerhtml: "Using 'dangerouslySetInnerHTML' may have security implications."
|
|
@@ -138,6 +146,9 @@ var no_dangerously_set_innerhtml_default = createRule({
|
|
|
138
146
|
defaultOptions: []
|
|
139
147
|
});
|
|
140
148
|
var RULE_NAME3 = "no-dangerously-set-innerhtml-with-children";
|
|
149
|
+
var RULE_FEATURES3 = [
|
|
150
|
+
"CHK"
|
|
151
|
+
];
|
|
141
152
|
function firstChildIsText(node) {
|
|
142
153
|
const [firstChild] = node.children;
|
|
143
154
|
return node.children.length > 0 && !tools.isNullable(firstChild) && !JSX9__namespace.isLineBreak(firstChild);
|
|
@@ -146,7 +157,8 @@ var no_dangerously_set_innerhtml_with_children_default = createRule({
|
|
|
146
157
|
meta: {
|
|
147
158
|
type: "problem",
|
|
148
159
|
docs: {
|
|
149
|
-
description: "disallow when a DOM component is using both 'children' and 'dangerouslySetInnerHTML'"
|
|
160
|
+
description: "disallow when a DOM component is using both 'children' and 'dangerouslySetInnerHTML'",
|
|
161
|
+
[Symbol.for("rule_features")]: RULE_FEATURES3
|
|
150
162
|
},
|
|
151
163
|
messages: {
|
|
152
164
|
noDangerouslySetInnerhtmlWithChildren: "A DOM component cannot use both 'children' and 'dangerouslySetInnerHTML'."
|
|
@@ -172,11 +184,15 @@ var no_dangerously_set_innerhtml_with_children_default = createRule({
|
|
|
172
184
|
defaultOptions: []
|
|
173
185
|
});
|
|
174
186
|
var RULE_NAME4 = "no-find-dom-node";
|
|
187
|
+
var RULE_FEATURES4 = [
|
|
188
|
+
"CHK"
|
|
189
|
+
];
|
|
175
190
|
var no_find_dom_node_default = createRule({
|
|
176
191
|
meta: {
|
|
177
192
|
type: "problem",
|
|
178
193
|
docs: {
|
|
179
|
-
description: "disallow 'findDOMNode'"
|
|
194
|
+
description: "disallow 'findDOMNode'",
|
|
195
|
+
[Symbol.for("rule_features")]: RULE_FEATURES4
|
|
180
196
|
},
|
|
181
197
|
messages: {
|
|
182
198
|
noFindDomNode: "[Deprecated] Use alternatives instead."
|
|
@@ -206,11 +222,15 @@ var no_find_dom_node_default = createRule({
|
|
|
206
222
|
defaultOptions: []
|
|
207
223
|
});
|
|
208
224
|
var RULE_NAME5 = "no-missing-button-type";
|
|
225
|
+
var RULE_FEATURES5 = [
|
|
226
|
+
"CHK"
|
|
227
|
+
];
|
|
209
228
|
var no_missing_button_type_default = createRule({
|
|
210
229
|
meta: {
|
|
211
230
|
type: "problem",
|
|
212
231
|
docs: {
|
|
213
|
-
description: "enforce that button component have an explicit 'type' attribute"
|
|
232
|
+
description: "enforce that button component have an explicit 'type' attribute",
|
|
233
|
+
[Symbol.for("rule_features")]: RULE_FEATURES5
|
|
214
234
|
},
|
|
215
235
|
messages: {
|
|
216
236
|
noMissingButtonType: "Add missing 'type' attribute on 'button' component."
|
|
@@ -237,6 +257,9 @@ var no_missing_button_type_default = createRule({
|
|
|
237
257
|
defaultOptions: []
|
|
238
258
|
});
|
|
239
259
|
var RULE_NAME6 = "no-missing-iframe-sandbox";
|
|
260
|
+
var RULE_FEATURES6 = [
|
|
261
|
+
"CHK"
|
|
262
|
+
];
|
|
240
263
|
var validTypes = [
|
|
241
264
|
"",
|
|
242
265
|
"allow-downloads",
|
|
@@ -259,7 +282,8 @@ var no_missing_iframe_sandbox_default = createRule({
|
|
|
259
282
|
meta: {
|
|
260
283
|
type: "problem",
|
|
261
284
|
docs: {
|
|
262
|
-
description: "enforce that 'iframe' component have an explicit 'sandbox' attribute"
|
|
285
|
+
description: "enforce that 'iframe' component have an explicit 'sandbox' attribute",
|
|
286
|
+
[Symbol.for("rule_features")]: RULE_FEATURES6
|
|
263
287
|
},
|
|
264
288
|
messages: {
|
|
265
289
|
noMissingIframeSandbox: "Add missing 'sandbox' attribute on 'iframe' component."
|
|
@@ -300,11 +324,15 @@ var no_missing_iframe_sandbox_default = createRule({
|
|
|
300
324
|
defaultOptions: []
|
|
301
325
|
});
|
|
302
326
|
var RULE_NAME7 = "no-namespace";
|
|
327
|
+
var RULE_FEATURES7 = [
|
|
328
|
+
"CHK"
|
|
329
|
+
];
|
|
303
330
|
var no_namespace_default = createRule({
|
|
304
331
|
meta: {
|
|
305
332
|
type: "problem",
|
|
306
333
|
docs: {
|
|
307
|
-
description: "enforce that namespaces are not used in React elements"
|
|
334
|
+
description: "enforce that namespaces are not used in React elements",
|
|
335
|
+
[Symbol.for("rule_features")]: RULE_FEATURES7
|
|
308
336
|
},
|
|
309
337
|
messages: {
|
|
310
338
|
noNamespace: "A React component '{{name}}' must not be in a namespace, as React does not support them."
|
|
@@ -330,6 +358,9 @@ var no_namespace_default = createRule({
|
|
|
330
358
|
defaultOptions: []
|
|
331
359
|
});
|
|
332
360
|
var RULE_NAME8 = "no-render-return-value";
|
|
361
|
+
var RULE_FEATURES8 = [
|
|
362
|
+
"CHK"
|
|
363
|
+
];
|
|
333
364
|
var banParentTypes = [
|
|
334
365
|
types.AST_NODE_TYPES.VariableDeclarator,
|
|
335
366
|
types.AST_NODE_TYPES.Property,
|
|
@@ -341,7 +372,8 @@ var no_render_return_value_default = createRule({
|
|
|
341
372
|
meta: {
|
|
342
373
|
type: "problem",
|
|
343
374
|
docs: {
|
|
344
|
-
description: "disallow usage of the return value of 'ReactDOM.render'"
|
|
375
|
+
description: "disallow usage of the return value of 'ReactDOM.render'",
|
|
376
|
+
[Symbol.for("rule_features")]: RULE_FEATURES8
|
|
345
377
|
},
|
|
346
378
|
messages: {
|
|
347
379
|
noRenderReturnValue: "Do not depend on the return value from '{{objectName}}.render'."
|
|
@@ -373,11 +405,15 @@ var no_render_return_value_default = createRule({
|
|
|
373
405
|
defaultOptions: []
|
|
374
406
|
});
|
|
375
407
|
var RULE_NAME9 = "no-script-url";
|
|
408
|
+
var RULE_FEATURES9 = [
|
|
409
|
+
"CHK"
|
|
410
|
+
];
|
|
376
411
|
var no_script_url_default = createRule({
|
|
377
412
|
meta: {
|
|
378
413
|
type: "problem",
|
|
379
414
|
docs: {
|
|
380
|
-
description: "disallow 'javascript:' URLs as JSX event handler prop's value"
|
|
415
|
+
description: "disallow 'javascript:' URLs as JSX event handler prop's value",
|
|
416
|
+
[Symbol.for("rule_features")]: RULE_FEATURES9
|
|
381
417
|
},
|
|
382
418
|
messages: {
|
|
383
419
|
noScriptUrl: "Using a `javascript:` URL is a security risk and should be avoided."
|
|
@@ -1463,6 +1499,9 @@ function testReactVersion(context, comparator, version2) {
|
|
|
1463
1499
|
return compareVersions.compare(localVersion, version2, comparator);
|
|
1464
1500
|
}
|
|
1465
1501
|
var RULE_NAME11 = "no-unsafe-iframe-sandbox";
|
|
1502
|
+
var RULE_FEATURES10 = [
|
|
1503
|
+
"CHK"
|
|
1504
|
+
];
|
|
1466
1505
|
var unsafeCombinations = [
|
|
1467
1506
|
["allow-scripts", "allow-same-origin"]
|
|
1468
1507
|
// ...
|
|
@@ -1471,7 +1510,8 @@ var no_unsafe_iframe_sandbox_default = createRule({
|
|
|
1471
1510
|
meta: {
|
|
1472
1511
|
type: "problem",
|
|
1473
1512
|
docs: {
|
|
1474
|
-
description: "disallow unsafe iframe 'sandbox' attribute combinations"
|
|
1513
|
+
description: "disallow unsafe iframe 'sandbox' attribute combinations",
|
|
1514
|
+
[Symbol.for("rule_features")]: RULE_FEATURES10
|
|
1475
1515
|
},
|
|
1476
1516
|
messages: {
|
|
1477
1517
|
noUnsafeIframeSandbox: "Unsafe 'sandbox' attribute value on 'iframe' component."
|
|
@@ -1510,6 +1550,9 @@ var no_unsafe_iframe_sandbox_default = createRule({
|
|
|
1510
1550
|
defaultOptions: []
|
|
1511
1551
|
});
|
|
1512
1552
|
var RULE_NAME12 = "no-unsafe-target-blank";
|
|
1553
|
+
var RULE_FEATURES11 = [
|
|
1554
|
+
"CHK"
|
|
1555
|
+
];
|
|
1513
1556
|
function isExternalLinkLike(value) {
|
|
1514
1557
|
return value.startsWith("https://") || /^(?:\w+:|\/\/)/u.test(value);
|
|
1515
1558
|
}
|
|
@@ -1520,7 +1563,8 @@ var no_unsafe_target_blank_default = createRule({
|
|
|
1520
1563
|
meta: {
|
|
1521
1564
|
type: "problem",
|
|
1522
1565
|
docs: {
|
|
1523
|
-
description: `disallow 'target="_blank"' on an external link without 'rel="noreferrer noopener"'
|
|
1566
|
+
description: `disallow 'target="_blank"' on an external link without 'rel="noreferrer noopener"'`,
|
|
1567
|
+
[Symbol.for("rule_features")]: RULE_FEATURES11
|
|
1524
1568
|
},
|
|
1525
1569
|
messages: {
|
|
1526
1570
|
noUnsafeTargetBlank: `Using 'target="_blank"' on an external link without 'rel="noreferrer noopener"' is a security risk.`
|
|
@@ -1593,20 +1637,6 @@ var no_unsafe_target_blank_default = createRule({
|
|
|
1593
1637
|
});
|
|
1594
1638
|
|
|
1595
1639
|
// src/index.ts
|
|
1596
|
-
var DEFAULT_ESLINT_REACT_SETTINGS = {
|
|
1597
|
-
additionalComponents: [
|
|
1598
|
-
{
|
|
1599
|
-
name: "Link",
|
|
1600
|
-
as: "a",
|
|
1601
|
-
attributes: [
|
|
1602
|
-
{
|
|
1603
|
-
name: "to",
|
|
1604
|
-
as: "href"
|
|
1605
|
-
}
|
|
1606
|
-
]
|
|
1607
|
-
}
|
|
1608
|
-
]
|
|
1609
|
-
};
|
|
1610
1640
|
var src_default = {
|
|
1611
1641
|
meta: {
|
|
1612
1642
|
name,
|
|
@@ -1625,9 +1655,7 @@ var src_default = {
|
|
|
1625
1655
|
"no-unknown-property": no_unknown_property_default,
|
|
1626
1656
|
"no-unsafe-iframe-sandbox": no_unsafe_iframe_sandbox_default,
|
|
1627
1657
|
"no-unsafe-target-blank": no_unsafe_target_blank_default
|
|
1628
|
-
}
|
|
1629
|
-
// eslint-disable-next-line perfectionist/sort-objects
|
|
1630
|
-
DEFAULT_ESLINT_REACT_SETTINGS
|
|
1658
|
+
}
|
|
1631
1659
|
};
|
|
1632
1660
|
|
|
1633
1661
|
module.exports = src_default;
|
package/dist/index.mjs
CHANGED
|
@@ -9,7 +9,7 @@ import { match, P } from 'ts-pattern';
|
|
|
9
9
|
|
|
10
10
|
// package.json
|
|
11
11
|
var name = "eslint-plugin-react-dom";
|
|
12
|
-
var version = "1.
|
|
12
|
+
var version = "1.20.0-beta.13";
|
|
13
13
|
var createRule = createRuleForPlugin("dom");
|
|
14
14
|
function findAttrInCustomAttributes(name2, attributes) {
|
|
15
15
|
return F.pipe(
|
|
@@ -21,6 +21,9 @@ function findAttrInCustomAttributes(name2, attributes) {
|
|
|
21
21
|
|
|
22
22
|
// src/rules/no-children-in-void-dom-elements.ts
|
|
23
23
|
var RULE_NAME = "no-children-in-void-dom-elements";
|
|
24
|
+
var RULE_FEATURES = [
|
|
25
|
+
"CHK"
|
|
26
|
+
];
|
|
24
27
|
var voidElements = [
|
|
25
28
|
"area",
|
|
26
29
|
"base",
|
|
@@ -43,7 +46,8 @@ var no_children_in_void_dom_elements_default = createRule({
|
|
|
43
46
|
meta: {
|
|
44
47
|
type: "problem",
|
|
45
48
|
docs: {
|
|
46
|
-
description: "disallow passing 'children' to void DOM elements"
|
|
49
|
+
description: "disallow passing 'children' to void DOM elements",
|
|
50
|
+
[Symbol.for("rule_features")]: RULE_FEATURES
|
|
47
51
|
},
|
|
48
52
|
messages: {
|
|
49
53
|
noChildrenInVoidDomElements: "A void DOM element '<{{element}} />' cannot have children."
|
|
@@ -84,11 +88,15 @@ var no_children_in_void_dom_elements_default = createRule({
|
|
|
84
88
|
defaultOptions: []
|
|
85
89
|
});
|
|
86
90
|
var RULE_NAME2 = "no-dangerously-set-innerhtml";
|
|
91
|
+
var RULE_FEATURES2 = [
|
|
92
|
+
"CHK"
|
|
93
|
+
];
|
|
87
94
|
var no_dangerously_set_innerhtml_default = createRule({
|
|
88
95
|
meta: {
|
|
89
96
|
type: "problem",
|
|
90
97
|
docs: {
|
|
91
|
-
description: "disallow when a DOM component is using 'dangerouslySetInnerHTML'"
|
|
98
|
+
description: "disallow when a DOM component is using 'dangerouslySetInnerHTML'",
|
|
99
|
+
[Symbol.for("rule_features")]: RULE_FEATURES2
|
|
92
100
|
},
|
|
93
101
|
messages: {
|
|
94
102
|
noDangerouslySetInnerhtml: "Using 'dangerouslySetInnerHTML' may have security implications."
|
|
@@ -115,6 +123,9 @@ var no_dangerously_set_innerhtml_default = createRule({
|
|
|
115
123
|
defaultOptions: []
|
|
116
124
|
});
|
|
117
125
|
var RULE_NAME3 = "no-dangerously-set-innerhtml-with-children";
|
|
126
|
+
var RULE_FEATURES3 = [
|
|
127
|
+
"CHK"
|
|
128
|
+
];
|
|
118
129
|
function firstChildIsText(node) {
|
|
119
130
|
const [firstChild] = node.children;
|
|
120
131
|
return node.children.length > 0 && !isNullable(firstChild) && !JSX9.isLineBreak(firstChild);
|
|
@@ -123,7 +134,8 @@ var no_dangerously_set_innerhtml_with_children_default = createRule({
|
|
|
123
134
|
meta: {
|
|
124
135
|
type: "problem",
|
|
125
136
|
docs: {
|
|
126
|
-
description: "disallow when a DOM component is using both 'children' and 'dangerouslySetInnerHTML'"
|
|
137
|
+
description: "disallow when a DOM component is using both 'children' and 'dangerouslySetInnerHTML'",
|
|
138
|
+
[Symbol.for("rule_features")]: RULE_FEATURES3
|
|
127
139
|
},
|
|
128
140
|
messages: {
|
|
129
141
|
noDangerouslySetInnerhtmlWithChildren: "A DOM component cannot use both 'children' and 'dangerouslySetInnerHTML'."
|
|
@@ -149,11 +161,15 @@ var no_dangerously_set_innerhtml_with_children_default = createRule({
|
|
|
149
161
|
defaultOptions: []
|
|
150
162
|
});
|
|
151
163
|
var RULE_NAME4 = "no-find-dom-node";
|
|
164
|
+
var RULE_FEATURES4 = [
|
|
165
|
+
"CHK"
|
|
166
|
+
];
|
|
152
167
|
var no_find_dom_node_default = createRule({
|
|
153
168
|
meta: {
|
|
154
169
|
type: "problem",
|
|
155
170
|
docs: {
|
|
156
|
-
description: "disallow 'findDOMNode'"
|
|
171
|
+
description: "disallow 'findDOMNode'",
|
|
172
|
+
[Symbol.for("rule_features")]: RULE_FEATURES4
|
|
157
173
|
},
|
|
158
174
|
messages: {
|
|
159
175
|
noFindDomNode: "[Deprecated] Use alternatives instead."
|
|
@@ -183,11 +199,15 @@ var no_find_dom_node_default = createRule({
|
|
|
183
199
|
defaultOptions: []
|
|
184
200
|
});
|
|
185
201
|
var RULE_NAME5 = "no-missing-button-type";
|
|
202
|
+
var RULE_FEATURES5 = [
|
|
203
|
+
"CHK"
|
|
204
|
+
];
|
|
186
205
|
var no_missing_button_type_default = createRule({
|
|
187
206
|
meta: {
|
|
188
207
|
type: "problem",
|
|
189
208
|
docs: {
|
|
190
|
-
description: "enforce that button component have an explicit 'type' attribute"
|
|
209
|
+
description: "enforce that button component have an explicit 'type' attribute",
|
|
210
|
+
[Symbol.for("rule_features")]: RULE_FEATURES5
|
|
191
211
|
},
|
|
192
212
|
messages: {
|
|
193
213
|
noMissingButtonType: "Add missing 'type' attribute on 'button' component."
|
|
@@ -214,6 +234,9 @@ var no_missing_button_type_default = createRule({
|
|
|
214
234
|
defaultOptions: []
|
|
215
235
|
});
|
|
216
236
|
var RULE_NAME6 = "no-missing-iframe-sandbox";
|
|
237
|
+
var RULE_FEATURES6 = [
|
|
238
|
+
"CHK"
|
|
239
|
+
];
|
|
217
240
|
var validTypes = [
|
|
218
241
|
"",
|
|
219
242
|
"allow-downloads",
|
|
@@ -236,7 +259,8 @@ var no_missing_iframe_sandbox_default = createRule({
|
|
|
236
259
|
meta: {
|
|
237
260
|
type: "problem",
|
|
238
261
|
docs: {
|
|
239
|
-
description: "enforce that 'iframe' component have an explicit 'sandbox' attribute"
|
|
262
|
+
description: "enforce that 'iframe' component have an explicit 'sandbox' attribute",
|
|
263
|
+
[Symbol.for("rule_features")]: RULE_FEATURES6
|
|
240
264
|
},
|
|
241
265
|
messages: {
|
|
242
266
|
noMissingIframeSandbox: "Add missing 'sandbox' attribute on 'iframe' component."
|
|
@@ -277,11 +301,15 @@ var no_missing_iframe_sandbox_default = createRule({
|
|
|
277
301
|
defaultOptions: []
|
|
278
302
|
});
|
|
279
303
|
var RULE_NAME7 = "no-namespace";
|
|
304
|
+
var RULE_FEATURES7 = [
|
|
305
|
+
"CHK"
|
|
306
|
+
];
|
|
280
307
|
var no_namespace_default = createRule({
|
|
281
308
|
meta: {
|
|
282
309
|
type: "problem",
|
|
283
310
|
docs: {
|
|
284
|
-
description: "enforce that namespaces are not used in React elements"
|
|
311
|
+
description: "enforce that namespaces are not used in React elements",
|
|
312
|
+
[Symbol.for("rule_features")]: RULE_FEATURES7
|
|
285
313
|
},
|
|
286
314
|
messages: {
|
|
287
315
|
noNamespace: "A React component '{{name}}' must not be in a namespace, as React does not support them."
|
|
@@ -307,6 +335,9 @@ var no_namespace_default = createRule({
|
|
|
307
335
|
defaultOptions: []
|
|
308
336
|
});
|
|
309
337
|
var RULE_NAME8 = "no-render-return-value";
|
|
338
|
+
var RULE_FEATURES8 = [
|
|
339
|
+
"CHK"
|
|
340
|
+
];
|
|
310
341
|
var banParentTypes = [
|
|
311
342
|
AST_NODE_TYPES.VariableDeclarator,
|
|
312
343
|
AST_NODE_TYPES.Property,
|
|
@@ -318,7 +349,8 @@ var no_render_return_value_default = createRule({
|
|
|
318
349
|
meta: {
|
|
319
350
|
type: "problem",
|
|
320
351
|
docs: {
|
|
321
|
-
description: "disallow usage of the return value of 'ReactDOM.render'"
|
|
352
|
+
description: "disallow usage of the return value of 'ReactDOM.render'",
|
|
353
|
+
[Symbol.for("rule_features")]: RULE_FEATURES8
|
|
322
354
|
},
|
|
323
355
|
messages: {
|
|
324
356
|
noRenderReturnValue: "Do not depend on the return value from '{{objectName}}.render'."
|
|
@@ -350,11 +382,15 @@ var no_render_return_value_default = createRule({
|
|
|
350
382
|
defaultOptions: []
|
|
351
383
|
});
|
|
352
384
|
var RULE_NAME9 = "no-script-url";
|
|
385
|
+
var RULE_FEATURES9 = [
|
|
386
|
+
"CHK"
|
|
387
|
+
];
|
|
353
388
|
var no_script_url_default = createRule({
|
|
354
389
|
meta: {
|
|
355
390
|
type: "problem",
|
|
356
391
|
docs: {
|
|
357
|
-
description: "disallow 'javascript:' URLs as JSX event handler prop's value"
|
|
392
|
+
description: "disallow 'javascript:' URLs as JSX event handler prop's value",
|
|
393
|
+
[Symbol.for("rule_features")]: RULE_FEATURES9
|
|
358
394
|
},
|
|
359
395
|
messages: {
|
|
360
396
|
noScriptUrl: "Using a `javascript:` URL is a security risk and should be avoided."
|
|
@@ -1440,6 +1476,9 @@ function testReactVersion(context, comparator, version2) {
|
|
|
1440
1476
|
return compare(localVersion, version2, comparator);
|
|
1441
1477
|
}
|
|
1442
1478
|
var RULE_NAME11 = "no-unsafe-iframe-sandbox";
|
|
1479
|
+
var RULE_FEATURES10 = [
|
|
1480
|
+
"CHK"
|
|
1481
|
+
];
|
|
1443
1482
|
var unsafeCombinations = [
|
|
1444
1483
|
["allow-scripts", "allow-same-origin"]
|
|
1445
1484
|
// ...
|
|
@@ -1448,7 +1487,8 @@ var no_unsafe_iframe_sandbox_default = createRule({
|
|
|
1448
1487
|
meta: {
|
|
1449
1488
|
type: "problem",
|
|
1450
1489
|
docs: {
|
|
1451
|
-
description: "disallow unsafe iframe 'sandbox' attribute combinations"
|
|
1490
|
+
description: "disallow unsafe iframe 'sandbox' attribute combinations",
|
|
1491
|
+
[Symbol.for("rule_features")]: RULE_FEATURES10
|
|
1452
1492
|
},
|
|
1453
1493
|
messages: {
|
|
1454
1494
|
noUnsafeIframeSandbox: "Unsafe 'sandbox' attribute value on 'iframe' component."
|
|
@@ -1487,6 +1527,9 @@ var no_unsafe_iframe_sandbox_default = createRule({
|
|
|
1487
1527
|
defaultOptions: []
|
|
1488
1528
|
});
|
|
1489
1529
|
var RULE_NAME12 = "no-unsafe-target-blank";
|
|
1530
|
+
var RULE_FEATURES11 = [
|
|
1531
|
+
"CHK"
|
|
1532
|
+
];
|
|
1490
1533
|
function isExternalLinkLike(value) {
|
|
1491
1534
|
return value.startsWith("https://") || /^(?:\w+:|\/\/)/u.test(value);
|
|
1492
1535
|
}
|
|
@@ -1497,7 +1540,8 @@ var no_unsafe_target_blank_default = createRule({
|
|
|
1497
1540
|
meta: {
|
|
1498
1541
|
type: "problem",
|
|
1499
1542
|
docs: {
|
|
1500
|
-
description: `disallow 'target="_blank"' on an external link without 'rel="noreferrer noopener"'
|
|
1543
|
+
description: `disallow 'target="_blank"' on an external link without 'rel="noreferrer noopener"'`,
|
|
1544
|
+
[Symbol.for("rule_features")]: RULE_FEATURES11
|
|
1501
1545
|
},
|
|
1502
1546
|
messages: {
|
|
1503
1547
|
noUnsafeTargetBlank: `Using 'target="_blank"' on an external link without 'rel="noreferrer noopener"' is a security risk.`
|
|
@@ -1570,20 +1614,6 @@ var no_unsafe_target_blank_default = createRule({
|
|
|
1570
1614
|
});
|
|
1571
1615
|
|
|
1572
1616
|
// src/index.ts
|
|
1573
|
-
var DEFAULT_ESLINT_REACT_SETTINGS = {
|
|
1574
|
-
additionalComponents: [
|
|
1575
|
-
{
|
|
1576
|
-
name: "Link",
|
|
1577
|
-
as: "a",
|
|
1578
|
-
attributes: [
|
|
1579
|
-
{
|
|
1580
|
-
name: "to",
|
|
1581
|
-
as: "href"
|
|
1582
|
-
}
|
|
1583
|
-
]
|
|
1584
|
-
}
|
|
1585
|
-
]
|
|
1586
|
-
};
|
|
1587
1617
|
var src_default = {
|
|
1588
1618
|
meta: {
|
|
1589
1619
|
name,
|
|
@@ -1602,9 +1632,7 @@ var src_default = {
|
|
|
1602
1632
|
"no-unknown-property": no_unknown_property_default,
|
|
1603
1633
|
"no-unsafe-iframe-sandbox": no_unsafe_iframe_sandbox_default,
|
|
1604
1634
|
"no-unsafe-target-blank": no_unsafe_target_blank_default
|
|
1605
|
-
}
|
|
1606
|
-
// eslint-disable-next-line perfectionist/sort-objects
|
|
1607
|
-
DEFAULT_ESLINT_REACT_SETTINGS
|
|
1635
|
+
}
|
|
1608
1636
|
};
|
|
1609
1637
|
|
|
1610
1638
|
export { src_default as default };
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-dom",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.20.0-beta.13",
|
|
4
4
|
"description": "ESLint React's ESLint plugin for React DOM related rules.",
|
|
5
5
|
"keywords": [
|
|
6
|
+
"react",
|
|
7
|
+
"dom",
|
|
6
8
|
"eslint",
|
|
9
|
+
"eslint-react",
|
|
7
10
|
"eslint-plugin",
|
|
8
|
-
"react-dom"
|
|
9
|
-
"react",
|
|
10
|
-
"dom"
|
|
11
|
+
"eslint-plugin-react-dom"
|
|
11
12
|
],
|
|
12
13
|
"homepage": "https://github.com/rel1cx/eslint-react",
|
|
13
14
|
"bugs": {
|
|
@@ -46,20 +47,21 @@
|
|
|
46
47
|
"@typescript-eslint/types": "^8.18.0",
|
|
47
48
|
"@typescript-eslint/utils": "^8.18.0",
|
|
48
49
|
"compare-versions": "^6.1.1",
|
|
49
|
-
"ts-pattern": "^5.
|
|
50
|
-
"@eslint-react/core": "1.
|
|
51
|
-
"@eslint-react/
|
|
52
|
-
"@eslint-react/
|
|
53
|
-
"@eslint-react/
|
|
54
|
-
"@eslint-react/
|
|
55
|
-
"@eslint-react/
|
|
56
|
-
"@eslint-react/
|
|
50
|
+
"ts-pattern": "^5.6.0",
|
|
51
|
+
"@eslint-react/core": "1.20.0-beta.13",
|
|
52
|
+
"@eslint-react/ast": "1.20.0-beta.13",
|
|
53
|
+
"@eslint-react/jsx": "1.20.0-beta.13",
|
|
54
|
+
"@eslint-react/shared": "1.20.0-beta.13",
|
|
55
|
+
"@eslint-react/tools": "1.20.0-beta.13",
|
|
56
|
+
"@eslint-react/var": "1.20.0-beta.13",
|
|
57
|
+
"@eslint-react/types": "1.20.0-beta.13"
|
|
57
58
|
},
|
|
58
59
|
"devDependencies": {
|
|
59
60
|
"@types/react": "^19.0.1",
|
|
60
61
|
"@types/react-dom": "^19.0.2",
|
|
61
62
|
"string-ts": "^2.2.0",
|
|
62
|
-
"tsup": "^8.3.5"
|
|
63
|
+
"tsup": "^8.3.5",
|
|
64
|
+
"@workspace/configs": "0.0.0"
|
|
63
65
|
},
|
|
64
66
|
"peerDependencies": {
|
|
65
67
|
"eslint": "^8.57.0 || ^9.0.0",
|