eslint-plugin-react-dom 3.0.0-beta.58 → 3.0.0-beta.59

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 (2) hide show
  1. package/dist/index.js +42 -42
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -23,7 +23,7 @@ var __exportAll = (all, no_symbols) => {
23
23
  //#endregion
24
24
  //#region package.json
25
25
  var name$2 = "eslint-plugin-react-dom";
26
- var version = "3.0.0-beta.58";
26
+ var version = "3.0.0-beta.59";
27
27
 
28
28
  //#endregion
29
29
  //#region src/utils/create-jsx-element-resolver.ts
@@ -229,16 +229,16 @@ function create$13(context) {
229
229
  switch (true) {
230
230
  case node.callee.type === AST_NODE_TYPES.Identifier && hydrateNames.has(node.callee.name):
231
231
  context.report({
232
+ fix: getFix$2(context, node),
232
233
  messageId: "default",
233
- node,
234
- fix: getFix$2(context, node)
234
+ node
235
235
  });
236
236
  return;
237
237
  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):
238
238
  context.report({
239
+ fix: getFix$2(context, node),
239
240
  messageId: "default",
240
- node,
241
- fix: getFix$2(context, node)
241
+ node
242
242
  });
243
243
  return;
244
244
  }
@@ -300,9 +300,9 @@ function create$12(context) {
300
300
  messageId: "missingTypeAttribute",
301
301
  node: node.openingElement,
302
302
  suggest: BUTTON_TYPES.map((type) => ({
303
- messageId: "addTypeAttribute",
304
303
  data: { type },
305
- fix: (fixer) => fixer.insertTextAfter(node.openingElement.name, ` type="${type}"`)
304
+ fix: (fixer) => fixer.insertTextAfter(node.openingElement.name, ` type="${type}"`),
305
+ messageId: "addTypeAttribute"
306
306
  }))
307
307
  });
308
308
  } });
@@ -338,11 +338,11 @@ function create$11(context) {
338
338
  messageId: "missingSandboxAttribute",
339
339
  node: node.openingElement,
340
340
  suggest: [{
341
- messageId: "addSandboxAttribute",
342
341
  data: { value: "" },
343
342
  fix(fixer) {
344
343
  return fixer.insertTextAfter(node.openingElement.name, ` sandbox=""`);
345
- }
344
+ },
345
+ messageId: "addSandboxAttribute"
346
346
  }]
347
347
  });
348
348
  return;
@@ -353,12 +353,12 @@ function create$11(context) {
353
353
  messageId: "missingSandboxAttribute",
354
354
  node: sandboxValue.node ?? sandboxProp,
355
355
  suggest: [{
356
- messageId: "addSandboxAttribute",
357
356
  data: { value: "" },
358
357
  fix(fixer) {
359
358
  if (sandboxValue.kind.startsWith("spread")) return null;
360
359
  return fixer.replaceText(sandboxProp, `sandbox=""`);
361
- }
360
+ },
361
+ messageId: "addSandboxAttribute"
362
362
  }]
363
363
  });
364
364
  } });
@@ -383,9 +383,9 @@ function create$10(context) {
383
383
  const name = core.getJsxElementType(context, node);
384
384
  if (typeof name !== "string" || !name.includes(":")) return;
385
385
  context.report({
386
+ data: { name },
386
387
  messageId: "default",
387
- node: node.openingElement.name,
388
- data: { name }
388
+ node: node.openingElement.name
389
389
  });
390
390
  } });
391
391
  }
@@ -473,16 +473,16 @@ function create$8(context) {
473
473
  switch (true) {
474
474
  case node.callee.type === AST_NODE_TYPES.Identifier && renderNames.has(node.callee.name):
475
475
  context.report({
476
+ fix: getFix$1(context, node),
476
477
  messageId: "default",
477
- node,
478
- fix: getFix$1(context, node)
478
+ node
479
479
  });
480
480
  return;
481
481
  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):
482
482
  context.report({
483
+ fix: getFix$1(context, node),
483
484
  messageId: "default",
484
- node,
485
- fix: getFix$1(context, node)
485
+ node
486
486
  });
487
487
  return;
488
488
  }
@@ -679,7 +679,6 @@ const SVGDOM_ATTRIBUTE_NAMES = {
679
679
  * Map of attributes that are only valid on specific HTML tags
680
680
  */
681
681
  const ATTRIBUTE_TAGS_MAP = {
682
- as: ["link"],
683
682
  abbr: ["th", "td"],
684
683
  align: [
685
684
  "applet",
@@ -698,6 +697,7 @@ const ATTRIBUTE_TAGS_MAP = {
698
697
  "tr"
699
698
  ],
700
699
  allowFullScreen: ["iframe", "video"],
700
+ as: ["link"],
701
701
  autoPictureInPicture: ["video"],
702
702
  charset: ["meta"],
703
703
  checked: ["input"],
@@ -1654,12 +1654,12 @@ function create$5(context) {
1654
1654
  if (tagNameHasDot(node)) return;
1655
1655
  if (isValidDataAttribute(name)) {
1656
1656
  if (getRequireDataLowercase() && hasUpperCaseCharacter(name)) context.report({
1657
- messageId: "dataLowercaseRequired",
1658
- node,
1659
1657
  data: {
1660
1658
  name: actualName,
1661
1659
  lowerCaseName: actualName.toLowerCase()
1662
- }
1660
+ },
1661
+ messageId: "dataLowercaseRequired",
1662
+ node
1663
1663
  });
1664
1664
  return;
1665
1665
  }
@@ -1670,13 +1670,13 @@ function create$5(context) {
1670
1670
  const allowedTags = has(ATTRIBUTE_TAGS_MAP, name) ? ATTRIBUTE_TAGS_MAP[name] : null;
1671
1671
  if (tagName != null && allowedTags != null) {
1672
1672
  if (!allowedTags.includes(tagName)) context.report({
1673
- messageId: "invalidPropOnTag",
1674
- node,
1675
1673
  data: {
1676
1674
  name: actualName,
1677
1675
  allowedTags: allowedTags.join(", "),
1678
1676
  tagName
1679
- }
1677
+ },
1678
+ messageId: "invalidPropOnTag",
1679
+ node
1680
1680
  });
1681
1681
  return;
1682
1682
  }
@@ -1685,22 +1685,22 @@ function create$5(context) {
1685
1685
  if (standardName != null && standardName === name) return;
1686
1686
  if (hasStandardNameButIsNotUsed) {
1687
1687
  context.report({
1688
- messageId: "unknownPropWithStandardName",
1689
- node,
1690
1688
  data: {
1691
1689
  name: actualName,
1692
1690
  standardName
1693
1691
  },
1694
1692
  fix(fixer) {
1695
1693
  return fixer.replaceText(node.name, standardName);
1696
- }
1694
+ },
1695
+ messageId: "unknownPropWithStandardName",
1696
+ node
1697
1697
  });
1698
1698
  return;
1699
1699
  }
1700
1700
  context.report({
1701
+ data: { name: actualName },
1701
1702
  messageId: "unknownProp",
1702
- node,
1703
- data: { name: actualName }
1703
+ node
1704
1704
  });
1705
1705
  } });
1706
1706
  }
@@ -1802,10 +1802,10 @@ function create$3(context) {
1802
1802
  messageId: "default",
1803
1803
  node: node.openingElement,
1804
1804
  suggest: [{
1805
- messageId: "addRelNoreferrerNoopener",
1806
1805
  fix(fixer) {
1807
1806
  return fixer.insertTextAfter(node.openingElement.name, ` rel="noreferrer noopener"`);
1808
- }
1807
+ },
1808
+ messageId: "addRelNoreferrerNoopener"
1809
1809
  }]
1810
1810
  });
1811
1811
  return;
@@ -1815,10 +1815,10 @@ function create$3(context) {
1815
1815
  messageId: "default",
1816
1816
  node: relProp,
1817
1817
  suggest: [{
1818
- messageId: "addRelNoreferrerNoopener",
1819
1818
  fix(fixer) {
1820
1819
  return fixer.replaceText(relProp, `rel="noreferrer noopener"`);
1821
- }
1820
+ },
1821
+ messageId: "addRelNoreferrerNoopener"
1822
1822
  }]
1823
1823
  });
1824
1824
  } });
@@ -1849,16 +1849,16 @@ function create$2(context) {
1849
1849
  switch (true) {
1850
1850
  case node.callee.type === AST_NODE_TYPES.Identifier && useFormStateNames.has(node.callee.name):
1851
1851
  context.report({
1852
+ fix: getFix(context, node),
1852
1853
  messageId: "default",
1853
- node,
1854
- fix: getFix(context, node)
1854
+ node
1855
1855
  });
1856
1856
  return;
1857
1857
  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):
1858
1858
  context.report({
1859
+ fix: getFix(context, node),
1859
1860
  messageId: "default",
1860
- node,
1861
- fix: getFix(context, node)
1861
+ node
1862
1862
  });
1863
1863
  return;
1864
1864
  }
@@ -1927,9 +1927,9 @@ function create$1(context) {
1927
1927
  const hasChildrenProp = findJsxAttribute("children") != null;
1928
1928
  const hasDangerouslySetInnerHTML = findJsxAttribute("dangerouslySetInnerHTML") != null;
1929
1929
  if (node.children.length > 0 || hasChildrenProp || hasDangerouslySetInnerHTML) context.report({
1930
+ data: { elementType: domElementType },
1930
1931
  messageId: "default",
1931
- node,
1932
- data: { elementType: domElementType }
1932
+ node
1933
1933
  });
1934
1934
  } });
1935
1935
  }
@@ -1960,8 +1960,6 @@ function create(context) {
1960
1960
  if (!importSources.includes(importSource)) return;
1961
1961
  const hasOtherSpecifiers = node.parent.specifiers.length > 1;
1962
1962
  context.report({
1963
- messageId: "default",
1964
- node: hasOtherSpecifiers ? node : node.parent,
1965
1963
  data: { importSource },
1966
1964
  fix(fixer) {
1967
1965
  const importDeclarationText = context.sourceCode.getText(node.parent);
@@ -1972,7 +1970,9 @@ function create(context) {
1972
1970
  if (!hasOtherSpecifiers) return fixer.replaceText(node.parent, `${importStringPrefix} * as ${node.local.name} from ${importSourceQuoted}${semi}`);
1973
1971
  const specifiers = importDeclarationText.slice(importDeclarationText.indexOf("{"), importDeclarationText.indexOf("}") + 1);
1974
1972
  return fixer.replaceText(node.parent, [`${importStringPrefix} * as ${node.local.name} from ${importSourceQuoted}${semi}`, `${importStringPrefix} ${specifiers} from ${importSourceQuoted}${semi}`].join("\n"));
1975
- }
1973
+ },
1974
+ messageId: "default",
1975
+ node: hasOtherSpecifiers ? node : node.parent
1976
1976
  });
1977
1977
  } });
1978
1978
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-dom",
3
- "version": "3.0.0-beta.58",
3
+ "version": "3.0.0-beta.59",
4
4
  "description": "ESLint React's ESLint plugin for DOM related rules.",
5
5
  "keywords": [
6
6
  "react",
@@ -43,11 +43,11 @@
43
43
  "@typescript-eslint/utils": "canary",
44
44
  "compare-versions": "^6.1.1",
45
45
  "ts-pattern": "^5.9.0",
46
- "@eslint-react/core": "3.0.0-beta.58",
47
- "@eslint-react/ast": "3.0.0-beta.58",
48
- "@eslint-react/eff": "3.0.0-beta.58",
49
- "@eslint-react/var": "3.0.0-beta.58",
50
- "@eslint-react/shared": "3.0.0-beta.58"
46
+ "@eslint-react/ast": "3.0.0-beta.59",
47
+ "@eslint-react/eff": "3.0.0-beta.59",
48
+ "@eslint-react/shared": "3.0.0-beta.59",
49
+ "@eslint-react/var": "3.0.0-beta.59",
50
+ "@eslint-react/core": "3.0.0-beta.59"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@types/react": "^19.2.14",