eslint-plugin-react-dom 1.23.2-next.3 → 1.23.2

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 +19 -22
  2. package/dist/index.mjs +20 -23
  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.2-next.3";
35
+ var version = "1.23.2";
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
  };
@@ -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
  };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
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
3
  import { createRuleForPlugin, RE_JAVASCRIPT_PROTOCOL, getSettingsFromContext } from '@eslint-react/shared';
4
4
  import { AST_NODE_TYPES } from '@typescript-eslint/types';
@@ -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.2-next.3";
12
+ var version = "1.23.2";
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
  };
@@ -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
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-dom",
3
- "version": "1.23.2-next.3",
3
+ "version": "1.23.2",
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/ast": "1.23.2-next.3",
51
- "@eslint-react/core": "1.23.2-next.3",
52
- "@eslint-react/jsx": "1.23.2-next.3",
53
- "@eslint-react/shared": "1.23.2-next.3",
54
- "@eslint-react/eff": "1.23.2-next.3",
55
- "@eslint-react/types": "1.23.2-next.3",
56
- "@eslint-react/var": "1.23.2-next.3"
50
+ "@eslint-react/core": "1.23.2",
51
+ "@eslint-react/ast": "1.23.2",
52
+ "@eslint-react/eff": "1.23.2",
53
+ "@eslint-react/jsx": "1.23.2",
54
+ "@eslint-react/shared": "1.23.2",
55
+ "@eslint-react/var": "1.23.2",
56
+ "@eslint-react/types": "1.23.2"
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"