eslint-plugin-react-dom 2.0.0-next.0 → 2.0.0-next.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.
package/dist/index.js CHANGED
@@ -1,34 +1,11 @@
1
- 'use strict';
2
-
3
- var shared = require('@eslint-react/shared');
4
- var ER = require('@eslint-react/core');
5
- var utils = require('@typescript-eslint/utils');
6
- var AST = require('@eslint-react/ast');
7
- var types = require('@typescript-eslint/types');
8
- var compareVersions = require('compare-versions');
9
- var kit = require('@eslint-react/kit');
10
- var eff = require('@eslint-react/eff');
11
-
12
- function _interopNamespace(e) {
13
- if (e && e.__esModule) return e;
14
- var n = Object.create(null);
15
- if (e) {
16
- Object.keys(e).forEach(function (k) {
17
- if (k !== 'default') {
18
- var d = Object.getOwnPropertyDescriptor(e, k);
19
- Object.defineProperty(n, k, d.get ? d : {
20
- enumerable: true,
21
- get: function () { return e[k]; }
22
- });
23
- }
24
- });
25
- }
26
- n.default = e;
27
- return Object.freeze(n);
28
- }
29
-
30
- var ER__namespace = /*#__PURE__*/_interopNamespace(ER);
31
- var AST__namespace = /*#__PURE__*/_interopNamespace(AST);
1
+ import { getDocsUrl, getSettingsFromContext, DEFAULT_ESLINT_REACT_SETTINGS } from '@eslint-react/shared';
2
+ import * as ER from '@eslint-react/core';
3
+ import { ESLintUtils } from '@typescript-eslint/utils';
4
+ import * as AST from '@eslint-react/ast';
5
+ import { AST_NODE_TYPES } from '@typescript-eslint/types';
6
+ import { compare } from 'compare-versions';
7
+ import { RegExp, Reporter } from '@eslint-react/kit';
8
+ import { _ } from '@eslint-react/eff';
32
9
 
33
10
  var __defProp = Object.defineProperty;
34
11
  var __export = (target, all) => {
@@ -62,17 +39,17 @@ var rules = {
62
39
  "react-dom/no-void-elements-with-children": "error"
63
40
  };
64
41
  var settings = {
65
- "react-x": shared.DEFAULT_ESLINT_REACT_SETTINGS
42
+ "react-x": DEFAULT_ESLINT_REACT_SETTINGS
66
43
  };
67
44
 
68
45
  // package.json
69
46
  var name2 = "eslint-plugin-react-dom";
70
- var version = "2.0.0-next.0";
47
+ var version = "2.0.0-next.2";
71
48
  function createJsxElementResolver(context) {
72
- const { components, polymorphicPropName } = shared.getSettingsFromContext(context);
49
+ const { components, polymorphicPropName } = getSettingsFromContext(context);
73
50
  return {
74
51
  resolve(node) {
75
- const name3 = ER__namespace.getElementType(context, node);
52
+ const name3 = ER.getElementType(context, node);
76
53
  const component = components.findLast((c) => c.name === name3 || c.re.test(name3));
77
54
  const result = {
78
55
  attributes: component?.attributes ?? [],
@@ -83,14 +60,14 @@ function createJsxElementResolver(context) {
83
60
  return result;
84
61
  }
85
62
  const initialScope = context.sourceCode.getScope(node);
86
- const polymorphicPropAttr = ER__namespace.getAttribute(
63
+ const polymorphicPropAttr = ER.getAttribute(
87
64
  context,
88
65
  polymorphicPropName,
89
66
  node.openingElement.attributes,
90
67
  initialScope
91
68
  );
92
69
  if (polymorphicPropAttr != null) {
93
- const polymorphicPropValue = ER__namespace.getAttributeValue(
70
+ const polymorphicPropValue = ER.getAttributeValue(
94
71
  context,
95
72
  polymorphicPropAttr,
96
73
  polymorphicPropName
@@ -106,7 +83,7 @@ function createJsxElementResolver(context) {
106
83
  }
107
84
  };
108
85
  }
109
- var createRule = utils.ESLintUtils.RuleCreator(shared.getDocsUrl("dom"));
86
+ var createRule = ESLintUtils.RuleCreator(getDocsUrl("dom"));
110
87
 
111
88
  // src/utils/find-custom-component.ts
112
89
  function findCustomComponentProp(name3, props) {
@@ -137,7 +114,7 @@ function create(context) {
137
114
  if (!context.sourceCode.text.includes(dangerouslySetInnerHTML)) return {};
138
115
  return {
139
116
  JSXElement(node) {
140
- const attribute = ER__namespace.getAttribute(
117
+ const attribute = ER.getAttribute(
141
118
  context,
142
119
  dangerouslySetInnerHTML,
143
120
  node.openingElement.attributes,
@@ -176,8 +153,8 @@ function create2(context) {
176
153
  JSXElement(node) {
177
154
  const attributes = node.openingElement.attributes;
178
155
  const initialScope = context.sourceCode.getScope(node);
179
- const hasChildren = hasChildrenWithin(node) || ER__namespace.hasAttribute(context, "children", attributes, initialScope);
180
- if (hasChildren && ER__namespace.hasAttribute(context, dangerouslySetInnerHTML2, attributes, initialScope)) {
156
+ const hasChildren = hasChildrenWithin(node) || ER.hasAttribute(context, "children", attributes, initialScope);
157
+ if (hasChildren && ER.hasAttribute(context, dangerouslySetInnerHTML2, attributes, initialScope)) {
181
158
  context.report({
182
159
  messageId: "noDangerouslySetInnerhtmlWithChildren",
183
160
  node
@@ -187,7 +164,7 @@ function create2(context) {
187
164
  };
188
165
  }
189
166
  function hasChildrenWithin(node) {
190
- return node.children.length > 0 && node.children[0] != null && !AST__namespace.isLineBreak(node.children[0]);
167
+ return node.children.length > 0 && node.children[0] != null && !AST.isLineBreak(node.children[0]);
191
168
  }
192
169
  var RULE_NAME3 = "no-find-dom-node";
193
170
  var RULE_FEATURES3 = [];
@@ -214,13 +191,13 @@ function create3(context) {
214
191
  CallExpression(node) {
215
192
  const { callee } = node;
216
193
  switch (callee.type) {
217
- case types.AST_NODE_TYPES.Identifier:
194
+ case AST_NODE_TYPES.Identifier:
218
195
  if (callee.name === findDOMNode) {
219
196
  context.report({ messageId: "noFindDomNode", node });
220
197
  }
221
198
  return;
222
- case types.AST_NODE_TYPES.MemberExpression:
223
- if (callee.property.type === types.AST_NODE_TYPES.Identifier && callee.property.name === findDOMNode) {
199
+ case AST_NODE_TYPES.MemberExpression:
200
+ if (callee.property.type === AST_NODE_TYPES.Identifier && callee.property.name === findDOMNode) {
224
201
  context.report({ messageId: "noFindDomNode", node });
225
202
  }
226
203
  return;
@@ -253,13 +230,13 @@ function create4(context) {
253
230
  CallExpression(node) {
254
231
  const { callee } = node;
255
232
  switch (callee.type) {
256
- case types.AST_NODE_TYPES.Identifier:
233
+ case AST_NODE_TYPES.Identifier:
257
234
  if (callee.name === flushSync) {
258
235
  context.report({ messageId: "noFlushSync", node });
259
236
  }
260
237
  return;
261
- case types.AST_NODE_TYPES.MemberExpression:
262
- if (callee.property.type === types.AST_NODE_TYPES.Identifier && callee.property.name === flushSync) {
238
+ case AST_NODE_TYPES.MemberExpression:
239
+ if (callee.property.type === AST_NODE_TYPES.Identifier && callee.property.name === flushSync) {
263
240
  context.report({ messageId: "noFlushSync", node });
264
241
  }
265
242
  return;
@@ -291,21 +268,21 @@ var no_hydrate_default = createRule({
291
268
  var hydrate = "hydrate";
292
269
  function create5(context) {
293
270
  if (!context.sourceCode.text.includes(hydrate)) return {};
294
- const settings2 = shared.getSettingsFromContext(context);
295
- if (compareVersions.compare(settings2.version, "18.0.0", "<")) return {};
271
+ const settings2 = getSettingsFromContext(context);
272
+ if (compare(settings2.version, "18.0.0", "<")) return {};
296
273
  const reactDomNames = /* @__PURE__ */ new Set();
297
274
  const hydrateNames = /* @__PURE__ */ new Set();
298
275
  return {
299
276
  CallExpression(node) {
300
277
  switch (true) {
301
- case (node.callee.type === types.AST_NODE_TYPES.Identifier && hydrateNames.has(node.callee.name)):
278
+ case (node.callee.type === AST_NODE_TYPES.Identifier && hydrateNames.has(node.callee.name)):
302
279
  context.report({
303
280
  messageId: "noHydrate",
304
281
  node,
305
282
  fix: getFix(context, node)
306
283
  });
307
284
  return;
308
- case (node.callee.type === types.AST_NODE_TYPES.MemberExpression && node.callee.object.type === types.AST_NODE_TYPES.Identifier && node.callee.property.type === types.AST_NODE_TYPES.Identifier && node.callee.property.name === hydrate && reactDomNames.has(node.callee.object.name)):
285
+ case (node.callee.type === AST_NODE_TYPES.MemberExpression && node.callee.object.type === AST_NODE_TYPES.Identifier && node.callee.property.type === AST_NODE_TYPES.Identifier && node.callee.property.name === hydrate && reactDomNames.has(node.callee.object.name)):
309
286
  context.report({
310
287
  messageId: "noHydrate",
311
288
  node,
@@ -319,14 +296,14 @@ function create5(context) {
319
296
  if (baseSource !== "react-dom") return;
320
297
  for (const specifier of node.specifiers) {
321
298
  switch (specifier.type) {
322
- case types.AST_NODE_TYPES.ImportSpecifier:
323
- if (specifier.imported.type !== types.AST_NODE_TYPES.Identifier) continue;
299
+ case AST_NODE_TYPES.ImportSpecifier:
300
+ if (specifier.imported.type !== AST_NODE_TYPES.Identifier) continue;
324
301
  if (specifier.imported.name === hydrate) {
325
302
  hydrateNames.add(specifier.local.name);
326
303
  }
327
304
  continue;
328
- case types.AST_NODE_TYPES.ImportDefaultSpecifier:
329
- case types.AST_NODE_TYPES.ImportNamespaceSpecifier:
305
+ case AST_NODE_TYPES.ImportDefaultSpecifier:
306
+ case AST_NODE_TYPES.ImportNamespaceSpecifier:
330
307
  reactDomNames.add(specifier.local.name);
331
308
  continue;
332
309
  }
@@ -371,14 +348,14 @@ function create6(context) {
371
348
  if (domElementType !== "button") return;
372
349
  const customComponentProp = findCustomComponentProp("type", attributes);
373
350
  const propNameOnJsx = customComponentProp?.name ?? "type";
374
- const attributeNode = ER__namespace.getAttribute(
351
+ const attributeNode = ER.getAttribute(
375
352
  context,
376
353
  propNameOnJsx,
377
354
  node.openingElement.attributes,
378
355
  context.sourceCode.getScope(node)
379
356
  );
380
357
  if (attributeNode != null) {
381
- const attributeValue = ER__namespace.getAttributeValue(
358
+ const attributeValue = ER.getAttributeValue(
382
359
  context,
383
360
  attributeNode,
384
361
  propNameOnJsx
@@ -447,14 +424,14 @@ function create7(context) {
447
424
  if (domElementType !== "iframe") return;
448
425
  const customComponentProp = findCustomComponentProp("sandbox", attributes);
449
426
  const propNameOnJsx = customComponentProp?.name ?? "sandbox";
450
- const attributeNode = ER__namespace.getAttribute(
427
+ const attributeNode = ER.getAttribute(
451
428
  context,
452
429
  propNameOnJsx,
453
430
  node.openingElement.attributes,
454
431
  context.sourceCode.getScope(node)
455
432
  );
456
433
  if (attributeNode != null) {
457
- const attributeValue = ER__namespace.getAttributeValue(
434
+ const attributeValue = ER.getAttributeValue(
458
435
  context,
459
436
  attributeNode,
460
437
  propNameOnJsx
@@ -496,7 +473,7 @@ var no_namespace_default = createRule({
496
473
  function create8(context) {
497
474
  return {
498
475
  JSXElement(node) {
499
- const name3 = ER__namespace.getElementType(context, node);
476
+ const name3 = ER.getElementType(context, node);
500
477
  if (typeof name3 !== "string" || !name3.includes(":")) {
501
478
  return;
502
479
  }
@@ -533,21 +510,21 @@ var no_render_default = createRule({
533
510
  });
534
511
  function create9(context) {
535
512
  if (!context.sourceCode.text.includes("render")) return {};
536
- const settings2 = shared.getSettingsFromContext(context);
537
- if (compareVersions.compare(settings2.version, "18.0.0", "<")) return {};
513
+ const settings2 = getSettingsFromContext(context);
514
+ if (compare(settings2.version, "18.0.0", "<")) return {};
538
515
  const reactDomNames = /* @__PURE__ */ new Set(["ReactDOM", "ReactDom"]);
539
516
  const renderNames = /* @__PURE__ */ new Set();
540
517
  return {
541
518
  CallExpression(node) {
542
519
  switch (true) {
543
- case (node.callee.type === types.AST_NODE_TYPES.Identifier && renderNames.has(node.callee.name)):
520
+ case (node.callee.type === AST_NODE_TYPES.Identifier && renderNames.has(node.callee.name)):
544
521
  context.report({
545
522
  messageId: "noRender",
546
523
  node,
547
524
  fix: getFix2(context, node)
548
525
  });
549
526
  return;
550
- case (node.callee.type === types.AST_NODE_TYPES.MemberExpression && node.callee.object.type === types.AST_NODE_TYPES.Identifier && node.callee.property.type === types.AST_NODE_TYPES.Identifier && node.callee.property.name === "render" && reactDomNames.has(node.callee.object.name)):
527
+ case (node.callee.type === AST_NODE_TYPES.MemberExpression && node.callee.object.type === AST_NODE_TYPES.Identifier && node.callee.property.type === AST_NODE_TYPES.Identifier && node.callee.property.name === "render" && reactDomNames.has(node.callee.object.name)):
551
528
  context.report({
552
529
  messageId: "noRender",
553
530
  node,
@@ -561,14 +538,14 @@ function create9(context) {
561
538
  if (baseSource !== "react-dom") return;
562
539
  for (const specifier of node.specifiers) {
563
540
  switch (specifier.type) {
564
- case types.AST_NODE_TYPES.ImportSpecifier:
565
- if (specifier.imported.type !== types.AST_NODE_TYPES.Identifier) continue;
541
+ case AST_NODE_TYPES.ImportSpecifier:
542
+ if (specifier.imported.type !== AST_NODE_TYPES.Identifier) continue;
566
543
  if (specifier.imported.name === "render") {
567
544
  renderNames.add(specifier.local.name);
568
545
  }
569
546
  continue;
570
- case types.AST_NODE_TYPES.ImportDefaultSpecifier:
571
- case types.AST_NODE_TYPES.ImportNamespaceSpecifier:
547
+ case AST_NODE_TYPES.ImportDefaultSpecifier:
548
+ case AST_NODE_TYPES.ImportNamespaceSpecifier:
572
549
  reactDomNames.add(specifier.local.name);
573
550
  continue;
574
551
  }
@@ -590,11 +567,11 @@ function getFix2(context, node) {
590
567
  var RULE_NAME10 = "no-render-return-value";
591
568
  var RULE_FEATURES10 = [];
592
569
  var banParentTypes = [
593
- types.AST_NODE_TYPES.VariableDeclarator,
594
- types.AST_NODE_TYPES.Property,
595
- types.AST_NODE_TYPES.ReturnStatement,
596
- types.AST_NODE_TYPES.ArrowFunctionExpression,
597
- types.AST_NODE_TYPES.AssignmentExpression
570
+ AST_NODE_TYPES.VariableDeclarator,
571
+ AST_NODE_TYPES.Property,
572
+ AST_NODE_TYPES.ReturnStatement,
573
+ AST_NODE_TYPES.ArrowFunctionExpression,
574
+ AST_NODE_TYPES.AssignmentExpression
598
575
  ];
599
576
  var no_render_return_value_default = createRule({
600
577
  meta: {
@@ -618,13 +595,13 @@ function create10(context) {
618
595
  return {
619
596
  CallExpression(node) {
620
597
  switch (true) {
621
- case (node.callee.type === types.AST_NODE_TYPES.Identifier && renderNames.has(node.callee.name) && banParentTypes.includes(node.parent.type)):
598
+ case (node.callee.type === AST_NODE_TYPES.Identifier && renderNames.has(node.callee.name) && banParentTypes.includes(node.parent.type)):
622
599
  context.report({
623
600
  messageId: "noRenderReturnValue",
624
601
  node
625
602
  });
626
603
  return;
627
- case (node.callee.type === types.AST_NODE_TYPES.MemberExpression && node.callee.object.type === types.AST_NODE_TYPES.Identifier && node.callee.property.type === types.AST_NODE_TYPES.Identifier && node.callee.property.name === "render" && reactDomNames.has(node.callee.object.name) && banParentTypes.includes(node.parent.type)):
604
+ case (node.callee.type === AST_NODE_TYPES.MemberExpression && node.callee.object.type === AST_NODE_TYPES.Identifier && node.callee.property.type === AST_NODE_TYPES.Identifier && node.callee.property.name === "render" && reactDomNames.has(node.callee.object.name) && banParentTypes.includes(node.parent.type)):
628
605
  context.report({
629
606
  messageId: "noRenderReturnValue",
630
607
  node
@@ -637,14 +614,14 @@ function create10(context) {
637
614
  if (baseSource !== "react-dom") return;
638
615
  for (const specifier of node.specifiers) {
639
616
  switch (specifier.type) {
640
- case types.AST_NODE_TYPES.ImportSpecifier:
641
- if (specifier.imported.type !== types.AST_NODE_TYPES.Identifier) continue;
617
+ case AST_NODE_TYPES.ImportSpecifier:
618
+ if (specifier.imported.type !== AST_NODE_TYPES.Identifier) continue;
642
619
  if (specifier.imported.name === "render") {
643
620
  renderNames.add(specifier.local.name);
644
621
  }
645
622
  continue;
646
- case types.AST_NODE_TYPES.ImportDefaultSpecifier:
647
- case types.AST_NODE_TYPES.ImportNamespaceSpecifier:
623
+ case AST_NODE_TYPES.ImportDefaultSpecifier:
624
+ case AST_NODE_TYPES.ImportNamespaceSpecifier:
648
625
  reactDomNames.add(specifier.local.name);
649
626
  continue;
650
627
  }
@@ -673,12 +650,12 @@ var no_script_url_default = createRule({
673
650
  function create11(context) {
674
651
  return {
675
652
  JSXAttribute(node) {
676
- if (node.name.type !== types.AST_NODE_TYPES.JSXIdentifier || node.value == null) {
653
+ if (node.name.type !== AST_NODE_TYPES.JSXIdentifier || node.value == null) {
677
654
  return;
678
655
  }
679
- const attributeValue = ER__namespace.getAttributeValue(context, node, ER__namespace.getAttributeName(context, node));
656
+ const attributeValue = ER.getAttributeValue(context, node, ER.getAttributeName(context, node));
680
657
  if (attributeValue.kind === "none" || typeof attributeValue.value !== "string") return;
681
- if (kit.RegExp.JAVASCRIPT_PROTOCOL.test(attributeValue.value)) {
658
+ if (RegExp.JAVASCRIPT_PROTOCOL.test(attributeValue.value)) {
682
659
  context.report({
683
660
  messageId: "noScriptUrl",
684
661
  node: node.value
@@ -1655,7 +1632,7 @@ var no_unknown_property_default = createRule({
1655
1632
  defaultOptions: []
1656
1633
  });
1657
1634
  function create12(context) {
1658
- const report = kit.Reporter.make(context);
1635
+ const report = Reporter.make(context);
1659
1636
  function getIgnoreConfig() {
1660
1637
  return context.options[0]?.ignore || DEFAULTS.ignore;
1661
1638
  }
@@ -1742,8 +1719,8 @@ function getText(context, node) {
1742
1719
  return context.sourceCode.getText(node);
1743
1720
  }
1744
1721
  function testReactVersion(context, comparator, version2) {
1745
- const { version: localVersion } = shared.getSettingsFromContext(context);
1746
- return compareVersions.compare(localVersion, version2, comparator);
1722
+ const { version: localVersion } = getSettingsFromContext(context);
1723
+ return compare(localVersion, version2, comparator);
1747
1724
  }
1748
1725
  var RULE_NAME13 = "no-unsafe-iframe-sandbox";
1749
1726
  var RULE_FEATURES12 = [];
@@ -1780,14 +1757,14 @@ function create13(context) {
1780
1757
  if (domElementType !== "iframe") return;
1781
1758
  const customComponentProp = findCustomComponentProp("sandbox", attributes);
1782
1759
  const propNameOnJsx = customComponentProp?.name ?? "sandbox";
1783
- const attributeNode = ER__namespace.getAttribute(
1760
+ const attributeNode = ER.getAttribute(
1784
1761
  context,
1785
1762
  propNameOnJsx,
1786
1763
  node.openingElement.attributes,
1787
1764
  context.sourceCode.getScope(node)
1788
1765
  );
1789
1766
  if (attributeNode != null) {
1790
- const attributeValue = ER__namespace.getAttributeValue(
1767
+ const attributeValue = ER.getAttributeValue(
1791
1768
  context,
1792
1769
  attributeNode,
1793
1770
  propNameOnJsx
@@ -1846,18 +1823,18 @@ function create14(context) {
1846
1823
  const getAttributeStringValue = (name3) => {
1847
1824
  const customComponentProp = findCustomComponentProp(name3, attributes);
1848
1825
  const propNameOnJsx = customComponentProp?.name ?? name3;
1849
- const attributeNode = ER__namespace.getAttribute(
1826
+ const attributeNode = ER.getAttribute(
1850
1827
  context,
1851
1828
  propNameOnJsx,
1852
1829
  node.openingElement.attributes,
1853
1830
  elementScope
1854
1831
  );
1855
1832
  if (attributeNode == null) return customComponentProp?.defaultValue;
1856
- const attributeValue = ER__namespace.getAttributeValue(context, attributeNode, propNameOnJsx);
1833
+ const attributeValue = ER.getAttributeValue(context, attributeNode, propNameOnJsx);
1857
1834
  if (attributeValue.kind === "some" && typeof attributeValue.value === "string") {
1858
1835
  return attributeValue.value;
1859
1836
  }
1860
- return eff._;
1837
+ return _;
1861
1838
  };
1862
1839
  if (getAttributeStringValue("target") !== "_blank") {
1863
1840
  return;
@@ -1898,21 +1875,21 @@ var no_use_form_state_default = createRule({
1898
1875
  });
1899
1876
  function create15(context) {
1900
1877
  if (!context.sourceCode.text.includes("useFormState")) return {};
1901
- const settings2 = shared.getSettingsFromContext(context);
1902
- if (compareVersions.compare(settings2.version, "19.0.0", "<")) return {};
1878
+ const settings2 = getSettingsFromContext(context);
1879
+ if (compare(settings2.version, "19.0.0", "<")) return {};
1903
1880
  const reactDomNames = /* @__PURE__ */ new Set();
1904
1881
  const useFormStateNames = /* @__PURE__ */ new Set();
1905
1882
  return {
1906
1883
  CallExpression(node) {
1907
1884
  switch (true) {
1908
- case (node.callee.type === types.AST_NODE_TYPES.Identifier && useFormStateNames.has(node.callee.name)):
1885
+ case (node.callee.type === AST_NODE_TYPES.Identifier && useFormStateNames.has(node.callee.name)):
1909
1886
  context.report({
1910
1887
  messageId: "noUseFormState",
1911
1888
  node,
1912
1889
  fix: getFix3(context, node)
1913
1890
  });
1914
1891
  return;
1915
- case (node.callee.type === types.AST_NODE_TYPES.MemberExpression && node.callee.object.type === types.AST_NODE_TYPES.Identifier && node.callee.property.type === types.AST_NODE_TYPES.Identifier && node.callee.property.name === "useFormState" && reactDomNames.has(node.callee.object.name)):
1892
+ case (node.callee.type === AST_NODE_TYPES.MemberExpression && node.callee.object.type === AST_NODE_TYPES.Identifier && node.callee.property.type === AST_NODE_TYPES.Identifier && node.callee.property.name === "useFormState" && reactDomNames.has(node.callee.object.name)):
1916
1893
  context.report({
1917
1894
  messageId: "noUseFormState",
1918
1895
  node,
@@ -1926,14 +1903,14 @@ function create15(context) {
1926
1903
  if (baseSource !== "react-dom") return;
1927
1904
  for (const specifier of node.specifiers) {
1928
1905
  switch (specifier.type) {
1929
- case types.AST_NODE_TYPES.ImportSpecifier:
1930
- if (specifier.imported.type !== types.AST_NODE_TYPES.Identifier) continue;
1906
+ case AST_NODE_TYPES.ImportSpecifier:
1907
+ if (specifier.imported.type !== AST_NODE_TYPES.Identifier) continue;
1931
1908
  if (specifier.imported.name === "useFormState") {
1932
1909
  useFormStateNames.add(specifier.local.name);
1933
1910
  }
1934
1911
  continue;
1935
- case types.AST_NODE_TYPES.ImportDefaultSpecifier:
1936
- case types.AST_NODE_TYPES.ImportNamespaceSpecifier:
1912
+ case AST_NODE_TYPES.ImportDefaultSpecifier:
1913
+ case AST_NODE_TYPES.ImportNamespaceSpecifier:
1937
1914
  reactDomNames.add(specifier.local.name);
1938
1915
  continue;
1939
1916
  }
@@ -1942,7 +1919,7 @@ function create15(context) {
1942
1919
  };
1943
1920
  }
1944
1921
  function getFix3(context, node) {
1945
- const { importSource } = shared.getSettingsFromContext(context);
1922
+ const { importSource } = getSettingsFromContext(context);
1946
1923
  return (fixer) => {
1947
1924
  return [
1948
1925
  fixer.insertTextBefore(context.sourceCode.ast, `import { useActionState } from "${importSource}";
@@ -1990,7 +1967,7 @@ var no_void_elements_with_children_default = createRule({
1990
1967
  function create16(context) {
1991
1968
  return {
1992
1969
  JSXElement(node) {
1993
- const elementName = ER__namespace.getElementType(context, node);
1970
+ const elementName = ER.getElementType(context, node);
1994
1971
  if (elementName.length === 0 || !voidElements.has(elementName)) {
1995
1972
  return;
1996
1973
  }
@@ -2005,7 +1982,7 @@ function create16(context) {
2005
1982
  }
2006
1983
  const { attributes } = node.openingElement;
2007
1984
  const initialScope = context.sourceCode.getScope(node);
2008
- const hasAttribute3 = (name3) => ER__namespace.hasAttribute(context, name3, attributes, initialScope);
1985
+ const hasAttribute3 = (name3) => ER.hasAttribute(context, name3, attributes, initialScope);
2009
1986
  if (hasAttribute3("children") || hasAttribute3("dangerouslySetInnerHTML")) {
2010
1987
  context.report({
2011
1988
  messageId: "noVoidElementsWithChildren",
@@ -2068,4 +2045,4 @@ var index_default = {
2068
2045
  }
2069
2046
  };
2070
2047
 
2071
- module.exports = index_default;
2048
+ export { index_default as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-dom",
3
- "version": "2.0.0-next.0",
3
+ "version": "2.0.0-next.2",
4
4
  "description": "ESLint React's ESLint plugin for React DOM related rules.",
5
5
  "keywords": [
6
6
  "react",
@@ -22,22 +22,14 @@
22
22
  "license": "MIT",
23
23
  "author": "Rel1cx<rel1cx@proton.me>",
24
24
  "sideEffects": false,
25
+ "type": "module",
25
26
  "exports": {
26
27
  ".": {
27
- "import": {
28
- "types": "./dist/index.d.mts",
29
- "default": "./dist/index.mjs"
30
- },
31
- "require": {
32
- "types": "./dist/index.d.ts",
33
- "default": "./dist/index.js"
34
- }
28
+ "types": "./dist/index.d.ts",
29
+ "import": "./dist/index.js"
35
30
  },
36
31
  "./package.json": "./package.json"
37
32
  },
38
- "main": "dist/index.js",
39
- "module": "dist/index.mjs",
40
- "types": "dist/index.d.ts",
41
33
  "files": [
42
34
  "dist",
43
35
  "./package.json"
@@ -49,12 +41,12 @@
49
41
  "compare-versions": "^6.1.1",
50
42
  "string-ts": "^2.2.1",
51
43
  "ts-pattern": "^5.7.0",
52
- "@eslint-react/ast": "2.0.0-next.0",
53
- "@eslint-react/kit": "2.0.0-next.0",
54
- "@eslint-react/eff": "2.0.0-next.0",
55
- "@eslint-react/core": "2.0.0-next.0",
56
- "@eslint-react/var": "2.0.0-next.0",
57
- "@eslint-react/shared": "2.0.0-next.0"
44
+ "@eslint-react/ast": "2.0.0-next.2",
45
+ "@eslint-react/core": "2.0.0-next.2",
46
+ "@eslint-react/kit": "2.0.0-next.2",
47
+ "@eslint-react/eff": "2.0.0-next.2",
48
+ "@eslint-react/shared": "2.0.0-next.2",
49
+ "@eslint-react/var": "2.0.0-next.2"
58
50
  },
59
51
  "devDependencies": {
60
52
  "@types/react": "^19.1.2",
package/dist/index.d.mts DELETED
@@ -1,65 +0,0 @@
1
- import * as _typescript_eslint_utils_ts_eslint from '@typescript-eslint/utils/ts-eslint';
2
- import { RulePreset } from '@eslint-react/kit';
3
-
4
- declare const _default: {
5
- configs: {
6
- recommended: {
7
- plugins: {
8
- "react-dom": {
9
- readonly meta: {
10
- readonly name: string;
11
- readonly version: string;
12
- };
13
- readonly rules: {
14
- readonly "no-dangerously-set-innerhtml": _typescript_eslint_utils_ts_eslint.RuleModule<"noDangerouslySetInnerhtml", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
15
- readonly "no-dangerously-set-innerhtml-with-children": _typescript_eslint_utils_ts_eslint.RuleModule<"noDangerouslySetInnerhtmlWithChildren", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
16
- readonly "no-find-dom-node": _typescript_eslint_utils_ts_eslint.RuleModule<"noFindDomNode", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
17
- readonly "no-flush-sync": _typescript_eslint_utils_ts_eslint.RuleModule<"noFlushSync", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
18
- readonly "no-hydrate": _typescript_eslint_utils_ts_eslint.RuleModule<"noHydrate", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
19
- readonly "no-missing-button-type": _typescript_eslint_utils_ts_eslint.RuleModule<"noMissingButtonType", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
20
- readonly "no-missing-iframe-sandbox": _typescript_eslint_utils_ts_eslint.RuleModule<"noMissingIframeSandbox", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
21
- readonly "no-namespace": _typescript_eslint_utils_ts_eslint.RuleModule<"noNamespace", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
22
- readonly "no-render": _typescript_eslint_utils_ts_eslint.RuleModule<"noRender", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
23
- readonly "no-render-return-value": _typescript_eslint_utils_ts_eslint.RuleModule<"noRenderReturnValue", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
24
- readonly "no-script-url": _typescript_eslint_utils_ts_eslint.RuleModule<"noScriptUrl", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
25
- readonly "no-unknown-property": _typescript_eslint_utils_ts_eslint.RuleModule<"dataLowercaseRequired" | "invalidPropOnTag" | "unknownProp" | "unknownPropWithStandardName", unknown[], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
26
- readonly "no-unsafe-iframe-sandbox": _typescript_eslint_utils_ts_eslint.RuleModule<"noUnsafeIframeSandbox", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
27
- readonly "no-unsafe-target-blank": _typescript_eslint_utils_ts_eslint.RuleModule<"noUnsafeTargetBlank", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
28
- readonly "no-use-form-state": _typescript_eslint_utils_ts_eslint.RuleModule<"noUseFormState", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
29
- readonly "no-void-elements-with-children": _typescript_eslint_utils_ts_eslint.RuleModule<"noVoidElementsWithChildren", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
30
- };
31
- };
32
- };
33
- name: string;
34
- rules: RulePreset;
35
- };
36
- "recommended-legacy": {
37
- plugins: string[];
38
- rules: RulePreset;
39
- };
40
- };
41
- meta: {
42
- readonly name: string;
43
- readonly version: string;
44
- };
45
- rules: {
46
- readonly "no-dangerously-set-innerhtml": _typescript_eslint_utils_ts_eslint.RuleModule<"noDangerouslySetInnerhtml", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
47
- readonly "no-dangerously-set-innerhtml-with-children": _typescript_eslint_utils_ts_eslint.RuleModule<"noDangerouslySetInnerhtmlWithChildren", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
48
- readonly "no-find-dom-node": _typescript_eslint_utils_ts_eslint.RuleModule<"noFindDomNode", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
49
- readonly "no-flush-sync": _typescript_eslint_utils_ts_eslint.RuleModule<"noFlushSync", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
50
- readonly "no-hydrate": _typescript_eslint_utils_ts_eslint.RuleModule<"noHydrate", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
51
- readonly "no-missing-button-type": _typescript_eslint_utils_ts_eslint.RuleModule<"noMissingButtonType", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
52
- readonly "no-missing-iframe-sandbox": _typescript_eslint_utils_ts_eslint.RuleModule<"noMissingIframeSandbox", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
53
- readonly "no-namespace": _typescript_eslint_utils_ts_eslint.RuleModule<"noNamespace", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
54
- readonly "no-render": _typescript_eslint_utils_ts_eslint.RuleModule<"noRender", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
55
- readonly "no-render-return-value": _typescript_eslint_utils_ts_eslint.RuleModule<"noRenderReturnValue", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
56
- readonly "no-script-url": _typescript_eslint_utils_ts_eslint.RuleModule<"noScriptUrl", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
57
- readonly "no-unknown-property": _typescript_eslint_utils_ts_eslint.RuleModule<"dataLowercaseRequired" | "invalidPropOnTag" | "unknownProp" | "unknownPropWithStandardName", unknown[], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
58
- readonly "no-unsafe-iframe-sandbox": _typescript_eslint_utils_ts_eslint.RuleModule<"noUnsafeIframeSandbox", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
59
- readonly "no-unsafe-target-blank": _typescript_eslint_utils_ts_eslint.RuleModule<"noUnsafeTargetBlank", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
60
- readonly "no-use-form-state": _typescript_eslint_utils_ts_eslint.RuleModule<"noUseFormState", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
61
- readonly "no-void-elements-with-children": _typescript_eslint_utils_ts_eslint.RuleModule<"noVoidElementsWithChildren", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
62
- };
63
- };
64
-
65
- export { _default as default };