eslint-plugin-react-dom 1.23.1 → 1.23.2-beta.6

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.
Files changed (3) hide show
  1. package/dist/index.js +21 -24
  2. package/dist/index.mjs +23 -26
  3. package/package.json +12 -12
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.23.1";
35
+ var version = "1.23.2-beta.6";
36
36
  var createRule = shared.createRuleForPlugin("dom");
37
37
  function findAttrInCustomAttributes(name2, attributes) {
38
38
  return eff.F.pipe(
@@ -63,16 +63,12 @@ var no_dangerously_set_innerhtml_default = createRule({
63
63
  create(context) {
64
64
  return {
65
65
  JSXElement(node) {
66
- const initialScope = context.sourceCode.getScope(node);
67
- const maybeDanger = JSX8__namespace.findPropInAttributes(node.openingElement.attributes, initialScope)(
68
- "dangerouslySetInnerHTML"
66
+ eff.F.pipe(
67
+ eff.O.some("dangerouslySetInnerHTML"),
68
+ eff.O.flatMap(JSX8__namespace.findPropInAttributes(node.openingElement.attributes, context.sourceCode.getScope(node))),
69
+ eff.O.map((prop) => ({ messageId: "noDangerouslySetInnerhtml", node: prop })),
70
+ eff.O.map(context.report)
69
71
  );
70
- if (eff.O.isSome(maybeDanger)) {
71
- context.report({
72
- messageId: "noDangerouslySetInnerhtml",
73
- node
74
- });
75
- }
76
72
  }
77
73
  };
78
74
  },
@@ -178,11 +174,11 @@ var no_missing_button_type_default = createRule({
178
174
  if (elementName !== "button") return;
179
175
  const { attributes } = node.openingElement;
180
176
  const initialScope = context.sourceCode.getScope(node);
181
- const maybeTypeAttribute = JSX8__namespace.findPropInAttributes(attributes, initialScope)("type");
182
- if (eff.O.isSome(maybeTypeAttribute)) return;
177
+ const mbProp = JSX8__namespace.findPropInAttributes(attributes, initialScope)("type");
178
+ if (eff.O.isSome(mbProp)) return;
183
179
  context.report({
184
180
  messageId: "noMissingButtonType",
185
- node: node.openingElement
181
+ node
186
182
  });
187
183
  }
188
184
  };
@@ -231,17 +227,17 @@ var no_missing_iframe_sandbox_default = createRule({
231
227
  if (elementName !== "iframe") return;
232
228
  const { attributes } = node.openingElement;
233
229
  const initialScope = context.sourceCode.getScope(node);
234
- const maybeSandboxAttribute = JSX8__namespace.findPropInAttributes(attributes, initialScope)("sandbox");
235
- if (eff.O.isNone(maybeSandboxAttribute)) {
230
+ const mbProp = JSX8__namespace.findPropInAttributes(attributes, initialScope)("sandbox");
231
+ if (eff.O.isNone(mbProp)) {
236
232
  context.report({
237
233
  messageId: "noMissingIframeSandbox",
238
234
  node: node.openingElement
239
235
  });
240
236
  return;
241
237
  }
242
- const sandboxAttribute = maybeSandboxAttribute.value;
238
+ const prop = mbProp.value;
243
239
  const hasValidSandbox = eff.F.pipe(
244
- JSX8__namespace.getPropValue(sandboxAttribute, context.sourceCode.getScope(sandboxAttribute)),
240
+ JSX8__namespace.getPropValue(prop, context.sourceCode.getScope(prop)),
245
241
  eff.O.filter(eff.isString),
246
242
  eff.O.map((value) => value.split(" ")),
247
243
  eff.O.exists((values) => values.every((value) => validTypes.some((validType) => validType === value)))
@@ -249,7 +245,7 @@ var no_missing_iframe_sandbox_default = createRule({
249
245
  if (hasValidSandbox) return;
250
246
  context.report({
251
247
  messageId: "noMissingIframeSandbox",
252
- node: sandboxAttribute
248
+ node: prop
253
249
  });
254
250
  }
255
251
  };
@@ -1428,7 +1424,7 @@ function report(context, message, messageId, data) {
1428
1424
  });
1429
1425
  }
1430
1426
  function testReactVersion(context, comparator, version2) {
1431
- const { version: localVersion } = shared.normalizeSettings(shared.decodeSettings(context.settings));
1427
+ const { version: localVersion } = shared.getSettingsFromContext(context);
1432
1428
  return compareVersions.compare(localVersion, version2, comparator);
1433
1429
  }
1434
1430
  var RULE_NAME10 = "no-unsafe-iframe-sandbox";
@@ -1459,10 +1455,11 @@ var no_unsafe_iframe_sandbox_default = createRule({
1459
1455
  if (elementName !== "iframe") return;
1460
1456
  const { attributes } = node.openingElement;
1461
1457
  const initialScope = context.sourceCode.getScope(node);
1462
- const maybeSandboxAttribute = JSX8__namespace.findPropInAttributes(attributes, initialScope)("sandbox");
1463
- if (eff.O.isNone(maybeSandboxAttribute)) return;
1458
+ const mbProp = JSX8__namespace.findPropInAttributes(attributes, initialScope)("sandbox");
1459
+ if (eff.O.isNone(mbProp)) return;
1460
+ const prop = mbProp.value;
1464
1461
  const isSafeSandboxValue = !eff.F.pipe(
1465
- JSX8__namespace.getPropValue(maybeSandboxAttribute.value, context.sourceCode.getScope(maybeSandboxAttribute.value)),
1462
+ JSX8__namespace.getPropValue(prop, context.sourceCode.getScope(prop)),
1466
1463
  eff.O.flatMapNullable(
1467
1464
  (v) => tsPattern.match(v).with(tsPattern.P.string, eff.F.identity).with({ sandbox: tsPattern.P.string }, ({ sandbox }) => sandbox).otherwise(eff.F.constNull)
1468
1465
  ),
@@ -1475,7 +1472,7 @@ var no_unsafe_iframe_sandbox_default = createRule({
1475
1472
  if (isSafeSandboxValue) return;
1476
1473
  context.report({
1477
1474
  messageId: "noUnsafeIframeSandbox",
1478
- node: maybeSandboxAttribute.value
1475
+ node: prop
1479
1476
  });
1480
1477
  }
1481
1478
  };
@@ -1506,7 +1503,7 @@ var no_unsafe_target_blank_default = createRule({
1506
1503
  },
1507
1504
  name: RULE_NAME11,
1508
1505
  create(context) {
1509
- const settings = shared.normalizeSettings(shared.decodeSettings(context.settings));
1506
+ const settings = shared.getSettingsFromContext(context);
1510
1507
  const additionalComponents = settings.additionalComponents.filter((c) => c.as === "a");
1511
1508
  function getReportDescriptor(node) {
1512
1509
  const name2 = JSX8__namespace.getElementName(node.openingElement);
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { O, F, isString, isNullable } from '@eslint-react/eff';
1
+ import { F, O, isString, isNullable } from '@eslint-react/eff';
2
2
  import * as JSX8 from '@eslint-react/jsx';
3
- import { createRuleForPlugin, RE_JAVASCRIPT_PROTOCOL, normalizeSettings, decodeSettings } from '@eslint-react/shared';
3
+ import { createRuleForPlugin, RE_JAVASCRIPT_PROTOCOL, getSettingsFromContext } from '@eslint-react/shared';
4
4
  import { AST_NODE_TYPES } from '@typescript-eslint/types';
5
5
  import { getElementRepresentName } from '@eslint-react/core';
6
6
  import * as AST from '@eslint-react/ast';
@@ -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.23.1";
12
+ var version = "1.23.2-beta.6";
13
13
  var createRule = createRuleForPlugin("dom");
14
14
  function findAttrInCustomAttributes(name2, attributes) {
15
15
  return F.pipe(
@@ -40,16 +40,12 @@ var no_dangerously_set_innerhtml_default = createRule({
40
40
  create(context) {
41
41
  return {
42
42
  JSXElement(node) {
43
- const initialScope = context.sourceCode.getScope(node);
44
- const maybeDanger = JSX8.findPropInAttributes(node.openingElement.attributes, initialScope)(
45
- "dangerouslySetInnerHTML"
43
+ F.pipe(
44
+ O.some("dangerouslySetInnerHTML"),
45
+ O.flatMap(JSX8.findPropInAttributes(node.openingElement.attributes, context.sourceCode.getScope(node))),
46
+ O.map((prop) => ({ messageId: "noDangerouslySetInnerhtml", node: prop })),
47
+ O.map(context.report)
46
48
  );
47
- if (O.isSome(maybeDanger)) {
48
- context.report({
49
- messageId: "noDangerouslySetInnerhtml",
50
- node
51
- });
52
- }
53
49
  }
54
50
  };
55
51
  },
@@ -155,11 +151,11 @@ var no_missing_button_type_default = createRule({
155
151
  if (elementName !== "button") return;
156
152
  const { attributes } = node.openingElement;
157
153
  const initialScope = context.sourceCode.getScope(node);
158
- const maybeTypeAttribute = JSX8.findPropInAttributes(attributes, initialScope)("type");
159
- if (O.isSome(maybeTypeAttribute)) return;
154
+ const mbProp = JSX8.findPropInAttributes(attributes, initialScope)("type");
155
+ if (O.isSome(mbProp)) return;
160
156
  context.report({
161
157
  messageId: "noMissingButtonType",
162
- node: node.openingElement
158
+ node
163
159
  });
164
160
  }
165
161
  };
@@ -208,17 +204,17 @@ var no_missing_iframe_sandbox_default = createRule({
208
204
  if (elementName !== "iframe") return;
209
205
  const { attributes } = node.openingElement;
210
206
  const initialScope = context.sourceCode.getScope(node);
211
- const maybeSandboxAttribute = JSX8.findPropInAttributes(attributes, initialScope)("sandbox");
212
- if (O.isNone(maybeSandboxAttribute)) {
207
+ const mbProp = JSX8.findPropInAttributes(attributes, initialScope)("sandbox");
208
+ if (O.isNone(mbProp)) {
213
209
  context.report({
214
210
  messageId: "noMissingIframeSandbox",
215
211
  node: node.openingElement
216
212
  });
217
213
  return;
218
214
  }
219
- const sandboxAttribute = maybeSandboxAttribute.value;
215
+ const prop = mbProp.value;
220
216
  const hasValidSandbox = F.pipe(
221
- JSX8.getPropValue(sandboxAttribute, context.sourceCode.getScope(sandboxAttribute)),
217
+ JSX8.getPropValue(prop, context.sourceCode.getScope(prop)),
222
218
  O.filter(isString),
223
219
  O.map((value) => value.split(" ")),
224
220
  O.exists((values) => values.every((value) => validTypes.some((validType) => validType === value)))
@@ -226,7 +222,7 @@ var no_missing_iframe_sandbox_default = createRule({
226
222
  if (hasValidSandbox) return;
227
223
  context.report({
228
224
  messageId: "noMissingIframeSandbox",
229
- node: sandboxAttribute
225
+ node: prop
230
226
  });
231
227
  }
232
228
  };
@@ -1405,7 +1401,7 @@ function report(context, message, messageId, data) {
1405
1401
  });
1406
1402
  }
1407
1403
  function testReactVersion(context, comparator, version2) {
1408
- const { version: localVersion } = normalizeSettings(decodeSettings(context.settings));
1404
+ const { version: localVersion } = getSettingsFromContext(context);
1409
1405
  return compare(localVersion, version2, comparator);
1410
1406
  }
1411
1407
  var RULE_NAME10 = "no-unsafe-iframe-sandbox";
@@ -1436,10 +1432,11 @@ var no_unsafe_iframe_sandbox_default = createRule({
1436
1432
  if (elementName !== "iframe") return;
1437
1433
  const { attributes } = node.openingElement;
1438
1434
  const initialScope = context.sourceCode.getScope(node);
1439
- const maybeSandboxAttribute = JSX8.findPropInAttributes(attributes, initialScope)("sandbox");
1440
- if (O.isNone(maybeSandboxAttribute)) return;
1435
+ const mbProp = JSX8.findPropInAttributes(attributes, initialScope)("sandbox");
1436
+ if (O.isNone(mbProp)) return;
1437
+ const prop = mbProp.value;
1441
1438
  const isSafeSandboxValue = !F.pipe(
1442
- JSX8.getPropValue(maybeSandboxAttribute.value, context.sourceCode.getScope(maybeSandboxAttribute.value)),
1439
+ JSX8.getPropValue(prop, context.sourceCode.getScope(prop)),
1443
1440
  O.flatMapNullable(
1444
1441
  (v) => match(v).with(P.string, F.identity).with({ sandbox: P.string }, ({ sandbox }) => sandbox).otherwise(F.constNull)
1445
1442
  ),
@@ -1452,7 +1449,7 @@ var no_unsafe_iframe_sandbox_default = createRule({
1452
1449
  if (isSafeSandboxValue) return;
1453
1450
  context.report({
1454
1451
  messageId: "noUnsafeIframeSandbox",
1455
- node: maybeSandboxAttribute.value
1452
+ node: prop
1456
1453
  });
1457
1454
  }
1458
1455
  };
@@ -1483,7 +1480,7 @@ var no_unsafe_target_blank_default = createRule({
1483
1480
  },
1484
1481
  name: RULE_NAME11,
1485
1482
  create(context) {
1486
- const settings = normalizeSettings(decodeSettings(context.settings));
1483
+ const settings = getSettingsFromContext(context);
1487
1484
  const additionalComponents = settings.additionalComponents.filter((c) => c.as === "a");
1488
1485
  function getReportDescriptor(node) {
1489
1486
  const name2 = JSX8.getElementName(node.openingElement);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-dom",
3
- "version": "1.23.1",
3
+ "version": "1.23.2-beta.6",
4
4
  "description": "ESLint React's ESLint plugin for React DOM related rules.",
5
5
  "keywords": [
6
6
  "react",
@@ -41,22 +41,22 @@
41
41
  "./package.json"
42
42
  ],
43
43
  "dependencies": {
44
- "@typescript-eslint/scope-manager": "^8.19.0",
45
- "@typescript-eslint/types": "^8.19.0",
46
- "@typescript-eslint/utils": "^8.19.0",
44
+ "@typescript-eslint/scope-manager": "^8.19.1",
45
+ "@typescript-eslint/types": "^8.19.1",
46
+ "@typescript-eslint/utils": "^8.19.1",
47
47
  "compare-versions": "^6.1.1",
48
48
  "string-ts": "^2.2.0",
49
49
  "ts-pattern": "^5.6.0",
50
- "@eslint-react/core": "1.23.1",
51
- "@eslint-react/ast": "1.23.1",
52
- "@eslint-react/eff": "1.23.1",
53
- "@eslint-react/shared": "1.23.1",
54
- "@eslint-react/types": "1.23.1",
55
- "@eslint-react/jsx": "1.23.1",
56
- "@eslint-react/var": "1.23.1"
50
+ "@eslint-react/ast": "1.23.2-beta.6",
51
+ "@eslint-react/eff": "1.23.2-beta.6",
52
+ "@eslint-react/core": "1.23.2-beta.6",
53
+ "@eslint-react/jsx": "1.23.2-beta.6",
54
+ "@eslint-react/shared": "1.23.2-beta.6",
55
+ "@eslint-react/types": "1.23.2-beta.6",
56
+ "@eslint-react/var": "1.23.2-beta.6"
57
57
  },
58
58
  "devDependencies": {
59
- "@types/react": "^19.0.2",
59
+ "@types/react": "^19.0.3",
60
60
  "@types/react-dom": "^19.0.2",
61
61
  "tsup": "^8.3.5",
62
62
  "@workspace/configs": "0.0.0"