eslint-plugin-react-dom 1.20.1 → 1.20.2-beta.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
+ var eff = require('@eslint-react/eff');
3
4
  var JSX9 = require('@eslint-react/jsx');
4
- var tools = require('@eslint-react/tools');
5
5
  var shared = require('@eslint-react/shared');
6
6
  var types = require('@typescript-eslint/types');
7
7
  var core = require('@eslint-react/core');
@@ -32,13 +32,13 @@ var AST__namespace = /*#__PURE__*/_interopNamespace(AST);
32
32
 
33
33
  // package.json
34
34
  var name = "eslint-plugin-react-dom";
35
- var version = "1.20.1";
35
+ var version = "1.20.2-beta.3";
36
36
  var createRule = shared.createRuleForPlugin("dom");
37
37
  function findAttrInCustomAttributes(name2, attributes) {
38
- return tools.F.pipe(
39
- tools.O.fromNullable(attributes.findLast((a) => a.as === name2)),
40
- tools.O.map((a) => [a.name, a.defaultValue]),
41
- tools.O.getOrElse(() => [name2])
38
+ return eff.F.pipe(
39
+ eff.O.fromNullable(attributes.findLast((a) => a.as === name2)),
40
+ eff.O.map((a) => [a.name, a.defaultValue]),
41
+ eff.O.getOrElse(() => [name2])
42
42
  );
43
43
  }
44
44
 
@@ -94,7 +94,7 @@ var no_children_in_void_dom_elements_default = createRule({
94
94
  }
95
95
  const { attributes } = node.openingElement;
96
96
  const initialScope = context.sourceCode.getScope(node);
97
- const hasAttr = (name2) => tools.O.isSome(JSX9__namespace.findPropInAttributes(attributes, initialScope)(name2));
97
+ const hasAttr = (name2) => eff.O.isSome(JSX9__namespace.findPropInAttributes(attributes, initialScope)(name2));
98
98
  const hasChildrenOrDangerAttr = hasAttr("children") || hasAttr("dangerouslySetInnerHTML");
99
99
  if (hasChildrenOrDangerAttr) {
100
100
  context.report({
@@ -134,7 +134,7 @@ var no_dangerously_set_innerhtml_default = createRule({
134
134
  const maybeDanger = JSX9__namespace.findPropInAttributes(node.openingElement.attributes, initialScope)(
135
135
  "dangerouslySetInnerHTML"
136
136
  );
137
- if (tools.O.isSome(maybeDanger)) {
137
+ if (eff.O.isSome(maybeDanger)) {
138
138
  context.report({
139
139
  messageId: "noDangerouslySetInnerhtml",
140
140
  node
@@ -151,7 +151,7 @@ var RULE_FEATURES3 = [
151
151
  ];
152
152
  function firstChildIsText(node) {
153
153
  const [firstChild] = node.children;
154
- return node.children.length > 0 && !tools.isNullable(firstChild) && !JSX9__namespace.isLineBreak(firstChild);
154
+ return node.children.length > 0 && !eff.isNullable(firstChild) && !JSX9__namespace.isLineBreak(firstChild);
155
155
  }
156
156
  var no_dangerously_set_innerhtml_with_children_default = createRule({
157
157
  meta: {
@@ -246,7 +246,7 @@ var no_missing_button_type_default = createRule({
246
246
  const { attributes } = node.openingElement;
247
247
  const initialScope = context.sourceCode.getScope(node);
248
248
  const maybeTypeAttribute = JSX9__namespace.findPropInAttributes(attributes, initialScope)("type");
249
- if (tools.O.isSome(maybeTypeAttribute)) return;
249
+ if (eff.O.isSome(maybeTypeAttribute)) return;
250
250
  context.report({
251
251
  messageId: "noMissingButtonType",
252
252
  node: node.openingElement
@@ -299,7 +299,7 @@ var no_missing_iframe_sandbox_default = createRule({
299
299
  const { attributes } = node.openingElement;
300
300
  const initialScope = context.sourceCode.getScope(node);
301
301
  const maybeSandboxAttribute = JSX9__namespace.findPropInAttributes(attributes, initialScope)("sandbox");
302
- if (tools.O.isNone(maybeSandboxAttribute)) {
302
+ if (eff.O.isNone(maybeSandboxAttribute)) {
303
303
  context.report({
304
304
  messageId: "noMissingIframeSandbox",
305
305
  node: node.openingElement
@@ -307,11 +307,11 @@ var no_missing_iframe_sandbox_default = createRule({
307
307
  return;
308
308
  }
309
309
  const sandboxAttribute = maybeSandboxAttribute.value;
310
- const hasValidSandbox = tools.F.pipe(
310
+ const hasValidSandbox = eff.F.pipe(
311
311
  JSX9__namespace.getPropValue(sandboxAttribute, context.sourceCode.getScope(sandboxAttribute)),
312
- tools.O.filter(tools.isString),
313
- tools.O.map((value) => value.split(" ")),
314
- tools.O.exists((values) => values.every((value) => validTypes.some((validType) => validType === value)))
312
+ eff.O.filter(eff.isString),
313
+ eff.O.map((value) => value.split(" ")),
314
+ eff.O.exists((values) => values.every((value) => validTypes.some((validType) => validType === value)))
315
315
  );
316
316
  if (hasValidSandbox) return;
317
317
  context.report({
@@ -344,7 +344,7 @@ var no_namespace_default = createRule({
344
344
  return {
345
345
  JSXOpeningElement(node) {
346
346
  const name2 = JSX9__namespace.getElementName(node);
347
- if (!tools.isString(name2) || !name2.includes(":")) return;
347
+ if (!eff.isString(name2) || !name2.includes(":")) return;
348
348
  context.report({
349
349
  messageId: "noNamespace",
350
350
  node,
@@ -425,10 +425,10 @@ var no_script_url_default = createRule({
425
425
  return {
426
426
  JSXAttribute(node) {
427
427
  if (node.name.type !== types.AST_NODE_TYPES.JSXIdentifier || !node.value) return;
428
- const isJavaScript = tools.F.pipe(
428
+ const isJavaScript = eff.F.pipe(
429
429
  JSX9__namespace.getPropValue(node, context.sourceCode.getScope(node)),
430
- tools.O.filter(tools.isString),
431
- tools.O.exists((v) => shared.RE_JAVASCRIPT_PROTOCOL.test(v))
430
+ eff.O.filter(eff.isString),
431
+ eff.O.exists((v) => shared.RE_JAVASCRIPT_PROTOCOL.test(v))
432
432
  );
433
433
  if (isJavaScript) {
434
434
  context.report({
@@ -1527,15 +1527,15 @@ var no_unsafe_iframe_sandbox_default = createRule({
1527
1527
  const { attributes } = node.openingElement;
1528
1528
  const initialScope = context.sourceCode.getScope(node);
1529
1529
  const maybeSandboxAttribute = JSX9__namespace.findPropInAttributes(attributes, initialScope)("sandbox");
1530
- if (tools.O.isNone(maybeSandboxAttribute)) return;
1531
- const isSafeSandboxValue = !tools.F.pipe(
1530
+ if (eff.O.isNone(maybeSandboxAttribute)) return;
1531
+ const isSafeSandboxValue = !eff.F.pipe(
1532
1532
  JSX9__namespace.getPropValue(maybeSandboxAttribute.value, context.sourceCode.getScope(maybeSandboxAttribute.value)),
1533
- tools.O.flatMapNullable(
1534
- (v) => tsPattern.match(v).with(tsPattern.P.string, tools.F.identity).with({ sandbox: tsPattern.P.string }, ({ sandbox }) => sandbox).otherwise(tools.F.constNull)
1533
+ eff.O.flatMapNullable(
1534
+ (v) => tsPattern.match(v).with(tsPattern.P.string, eff.F.identity).with({ sandbox: tsPattern.P.string }, ({ sandbox }) => sandbox).otherwise(eff.F.constNull)
1535
1535
  ),
1536
- tools.O.filter(tools.isString),
1537
- tools.O.map((value) => value.split(" ")),
1538
- tools.O.exists(
1536
+ eff.O.filter(eff.isString),
1537
+ eff.O.map((value) => value.split(" ")),
1538
+ eff.O.exists(
1539
1539
  (values) => unsafeCombinations.some((combinations) => combinations.every((unsafeValue) => values.includes(unsafeValue)))
1540
1540
  )
1541
1541
  );
@@ -1578,7 +1578,7 @@ var no_unsafe_target_blank_default = createRule({
1578
1578
  function getReportDescriptor(node) {
1579
1579
  const name2 = JSX9__namespace.getElementName(node.openingElement);
1580
1580
  const elementName = core.getElementRepresentName(node.openingElement, context);
1581
- if (elementName !== "a" && !additionalComponents.some((c) => c.re.test(name2))) return tools.O.none();
1581
+ if (elementName !== "a" && !additionalComponents.some((c) => c.re.test(name2))) return eff.O.none();
1582
1582
  const { attributes } = node.openingElement;
1583
1583
  const initialScope = context.sourceCode.getScope(node);
1584
1584
  const additionalAttributes = additionalComponents.findLast((c) => c.re.test(name2))?.attributes ?? [];
@@ -1587,50 +1587,50 @@ var no_unsafe_target_blank_default = createRule({
1587
1587
  targetPropDefaultValue
1588
1588
  ] = findAttrInCustomAttributes("target", additionalAttributes);
1589
1589
  const targetProp = JSX9__namespace.findPropInAttributes(attributes, initialScope)(targetPropName);
1590
- const targetPropValue = tools.O.isNone(targetProp) ? tools.O.fromNullable(targetPropDefaultValue) : tools.F.pipe(
1590
+ const targetPropValue = eff.O.isNone(targetProp) ? eff.O.fromNullable(targetPropDefaultValue) : eff.F.pipe(
1591
1591
  targetProp,
1592
- tools.O.flatMap((attr) => JSX9__namespace.getPropValue(attr, context.sourceCode.getScope(attr))),
1593
- tools.O.flatMapNullable(
1594
- (v) => tsPattern.match(v).with(tsPattern.P.string, tools.F.identity).with({ [targetPropName]: tsPattern.P.string }, (v2) => v2[targetPropName]).otherwise(tools.F.constNull)
1592
+ eff.O.flatMap((attr) => JSX9__namespace.getPropValue(attr, context.sourceCode.getScope(attr))),
1593
+ eff.O.flatMapNullable(
1594
+ (v) => tsPattern.match(v).with(tsPattern.P.string, eff.F.identity).with({ [targetPropName]: tsPattern.P.string }, (v2) => v2[targetPropName]).otherwise(eff.F.constNull)
1595
1595
  ),
1596
- tools.O.filter(tools.isString)
1596
+ eff.O.filter(eff.isString)
1597
1597
  );
1598
- if (!tools.O.exists(targetPropValue, (t) => t === "_blank")) return tools.O.none();
1598
+ if (!eff.O.exists(targetPropValue, (t) => t === "_blank")) return eff.O.none();
1599
1599
  const [
1600
1600
  hrefPropName,
1601
1601
  hrefPropDefaultValue
1602
1602
  ] = findAttrInCustomAttributes("href", additionalAttributes);
1603
1603
  const hrefProp = JSX9__namespace.findPropInAttributes(attributes, initialScope)(hrefPropName);
1604
- const hrefPropValue = tools.O.isNone(hrefProp) ? tools.O.fromNullable(hrefPropDefaultValue) : tools.F.pipe(
1604
+ const hrefPropValue = eff.O.isNone(hrefProp) ? eff.O.fromNullable(hrefPropDefaultValue) : eff.F.pipe(
1605
1605
  hrefProp,
1606
- tools.O.flatMap((attr) => JSX9__namespace.getPropValue(attr, context.sourceCode.getScope(attr))),
1607
- tools.O.flatMapNullable(
1608
- (v) => tsPattern.match(v).with(tsPattern.P.string, tools.F.identity).with(tsPattern.P.shape({ [hrefPropName]: tsPattern.P.string }), (v2) => v2[hrefPropName]).otherwise(tools.F.constNull)
1606
+ eff.O.flatMap((attr) => JSX9__namespace.getPropValue(attr, context.sourceCode.getScope(attr))),
1607
+ eff.O.flatMapNullable(
1608
+ (v) => tsPattern.match(v).with(tsPattern.P.string, eff.F.identity).with(tsPattern.P.shape({ [hrefPropName]: tsPattern.P.string }), (v2) => v2[hrefPropName]).otherwise(eff.F.constNull)
1609
1609
  ),
1610
- tools.O.filter(tools.isString)
1610
+ eff.O.filter(eff.isString)
1611
1611
  );
1612
- if (!tools.O.exists(hrefPropValue, isExternalLinkLike)) return tools.O.none();
1612
+ if (!eff.O.exists(hrefPropValue, isExternalLinkLike)) return eff.O.none();
1613
1613
  const [
1614
1614
  relPropName,
1615
1615
  relPropDefaultValue
1616
1616
  ] = findAttrInCustomAttributes("rel", additionalAttributes);
1617
1617
  const relProp = JSX9__namespace.findPropInAttributes(attributes, initialScope)(relPropName);
1618
- const relPropValue = tools.O.isNone(relProp) ? tools.O.fromNullable(relPropDefaultValue) : tools.F.pipe(
1618
+ const relPropValue = eff.O.isNone(relProp) ? eff.O.fromNullable(relPropDefaultValue) : eff.F.pipe(
1619
1619
  relProp,
1620
- tools.O.flatMap((attr) => JSX9__namespace.getPropValue(attr, context.sourceCode.getScope(attr))),
1621
- tools.O.flatMapNullable(
1622
- (v) => tsPattern.match(v).with(tsPattern.P.string, tools.F.identity).with(tsPattern.P.shape({ [relPropName]: tsPattern.P.string }), (v2) => v2[relPropName]).otherwise(tools.F.constNull)
1620
+ eff.O.flatMap((attr) => JSX9__namespace.getPropValue(attr, context.sourceCode.getScope(attr))),
1621
+ eff.O.flatMapNullable(
1622
+ (v) => tsPattern.match(v).with(tsPattern.P.string, eff.F.identity).with(tsPattern.P.shape({ [relPropName]: tsPattern.P.string }), (v2) => v2[relPropName]).otherwise(eff.F.constNull)
1623
1623
  ),
1624
- tools.O.filter(tools.isString)
1624
+ eff.O.filter(eff.isString)
1625
1625
  );
1626
- if (tools.O.exists(relPropValue, isSafeRel)) return tools.O.none();
1627
- return tools.O.some({
1626
+ if (eff.O.exists(relPropValue, isSafeRel)) return eff.O.none();
1627
+ return eff.O.some({
1628
1628
  messageId: "noUnsafeTargetBlank",
1629
1629
  node
1630
1630
  });
1631
1631
  }
1632
1632
  return {
1633
- JSXElement: tools.F.flow(getReportDescriptor, tools.O.map(context.report))
1633
+ JSXElement: eff.F.flow(getReportDescriptor, eff.O.map(context.report))
1634
1634
  };
1635
1635
  },
1636
1636
  defaultOptions: []
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
+ import { O, F, isString, isNullable } from '@eslint-react/eff';
1
2
  import * as JSX9 from '@eslint-react/jsx';
2
- import { O, F, isString, isNullable } from '@eslint-react/tools';
3
3
  import { createRuleForPlugin, RE_JAVASCRIPT_PROTOCOL, normalizeSettings, decodeSettings } from '@eslint-react/shared';
4
4
  import { AST_NODE_TYPES } from '@typescript-eslint/types';
5
5
  import { getElementRepresentName } from '@eslint-react/core';
@@ -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.20.1";
12
+ var version = "1.20.2-beta.3";
13
13
  var createRule = createRuleForPlugin("dom");
14
14
  function findAttrInCustomAttributes(name2, attributes) {
15
15
  return F.pipe(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-dom",
3
- "version": "1.20.1",
3
+ "version": "1.20.2-beta.3",
4
4
  "description": "ESLint React's ESLint plugin for React DOM related rules.",
5
5
  "keywords": [
6
6
  "react",
@@ -48,16 +48,16 @@
48
48
  "@typescript-eslint/utils": "^8.18.1",
49
49
  "compare-versions": "^6.1.1",
50
50
  "ts-pattern": "^5.6.0",
51
- "@eslint-react/ast": "1.20.1",
52
- "@eslint-react/jsx": "1.20.1",
53
- "@eslint-react/core": "1.20.1",
54
- "@eslint-react/shared": "1.20.1",
55
- "@eslint-react/tools": "1.20.1",
56
- "@eslint-react/types": "1.20.1",
57
- "@eslint-react/var": "1.20.1"
51
+ "@eslint-react/ast": "1.20.2-beta.3",
52
+ "@eslint-react/jsx": "1.20.2-beta.3",
53
+ "@eslint-react/types": "1.20.2-beta.3",
54
+ "@eslint-react/var": "1.20.2-beta.3",
55
+ "@eslint-react/core": "1.20.2-beta.3",
56
+ "@eslint-react/eff": "1.20.2-beta.3",
57
+ "@eslint-react/shared": "1.20.2-beta.3"
58
58
  },
59
59
  "devDependencies": {
60
- "@types/react": "^19.0.1",
60
+ "@types/react": "^19.0.2",
61
61
  "@types/react-dom": "^19.0.2",
62
62
  "string-ts": "^2.2.0",
63
63
  "tsup": "^8.3.5",