eslint-plugin-react-dom 5.30.0-beta.7 → 5.30.0-beta.9

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 +40 -49
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { DEFAULT_ESLINT_REACT_SETTINGS, RE_JAVASCRIPT_PROTOCOL, getSettingsFromContext } from "@eslint-react/shared";
2
2
  import * as ESLintUtils from "@typescript-eslint/utils/eslint-utils";
3
3
  import { findAttribute, getAttributeStaticValue, getAttributeStaticValueByName, getAttributeValue, getAttributeValueByName, getElementFullType, hasAnyAttribute, hasAttribute, isEmptyExpressionContainer, isHostElement, isPaddingWhitespace, isPlainAttribute } from "@eslint-react/jsx";
4
- import { complete, getText } from "@eslint-react/eslint";
4
+ import { getText } from "@eslint-react/eslint";
5
5
  import { Check, Extract } from "@eslint-react/ast";
6
6
  import { AST_NODE_TYPES } from "@typescript-eslint/types";
7
7
  import { createImportLookup } from "@eslint-react/var";
@@ -19,7 +19,7 @@ var __exportAll = (all, no_symbols) => {
19
19
  };
20
20
  // package.json
21
21
  var name$2 = "eslint-plugin-react-dom";
22
- var version = "5.30.0-beta.7";
22
+ var version = "5.30.0-beta.9";
23
23
  // src/utils/create-rule.ts
24
24
  function getDocsUrl(ruleName) {
25
25
  return `https://eslint-react.xyz/docs/rules/dom-${ruleName}`;
@@ -1479,47 +1479,41 @@ function getStandardName(name, context) {
1479
1479
  const lookup = getStandardNameLookup(version);
1480
1480
  return lookup.exact.get(name) ?? lookup.lower.get(name.toLowerCase()) ?? null;
1481
1481
  }
1482
- // src/rules/no-unknown-property/no-unknown-property.ts
1483
- const RULE_NAME$4 = "no-unknown-property";
1484
- const defaultOptions$1 = [{
1485
- ignore: [],
1486
- requireDataLowercase: false
1487
- }];
1488
- const schema$1 = [{
1489
- type: "object",
1490
- additionalProperties: false,
1491
- properties: {
1492
- ignore: {
1493
- type: "array",
1494
- description: "Property names to ignore.",
1495
- items: { type: "string" }
1496
- },
1497
- requireDataLowercase: {
1498
- type: "boolean",
1499
- description: "Require lowercase names for data-* attributes."
1500
- }
1501
- }
1502
- }];
1503
- const messages = {
1504
- "data-lowercase-required": "React does not recognize data-* props with uppercase characters on a DOM element. Found '{{name}}', use '{{lowerCaseName}}' instead",
1505
- "invalid-prop-on-tag": "Invalid property '{{name}}' found on tag '{{tagName}}', but it is only allowed on: {{allowedTags}}",
1506
- "unknown-prop": "Unknown property '{{name}}' found",
1507
- "unknown-prop-with-standard-name": "Unknown property '{{name}}' found, use '{{standardName}}' instead"
1508
- };
1509
1482
  var no_unknown_property_default = createRule({
1510
1483
  meta: {
1511
1484
  type: "problem",
1512
- defaultOptions: [...defaultOptions$1],
1485
+ defaultOptions: [{}],
1513
1486
  docs: { description: "Disallows unknown 'DOM' properties." },
1514
1487
  fixable: "code",
1515
- messages,
1516
- schema: schema$1
1488
+ messages: {
1489
+ "data-lowercase-required": "React does not recognize data-* props with uppercase characters on a DOM element. Found '{{name}}', use '{{lowerCaseName}}' instead",
1490
+ "invalid-prop-on-tag": "Invalid property '{{name}}' found on tag '{{tagName}}', but it is only allowed on: {{allowedTags}}",
1491
+ "unknown-prop": "Unknown property '{{name}}' found",
1492
+ "unknown-prop-with-standard-name": "Unknown property '{{name}}' found, use '{{standardName}}' instead"
1493
+ },
1494
+ schema: [{
1495
+ type: "object",
1496
+ additionalProperties: false,
1497
+ properties: {
1498
+ ignore: {
1499
+ type: "array",
1500
+ description: "Property names to ignore.",
1501
+ items: { type: "string" }
1502
+ },
1503
+ requireDataLowercase: {
1504
+ type: "boolean",
1505
+ description: "Require lowercase names for data-* attributes."
1506
+ }
1507
+ }
1508
+ }]
1517
1509
  },
1518
- name: RULE_NAME$4,
1510
+ name: "no-unknown-property",
1519
1511
  create: create$4
1520
1512
  });
1521
1513
  function create$4(context) {
1522
- const { ignore, requireDataLowercase } = complete(context.options[0], defaultOptions$1[0]);
1514
+ const options = { ...context.options[0] ?? {} };
1515
+ const ignore = options.ignore ??= [];
1516
+ const requireDataLowercase = options.requireDataLowercase ??= false;
1523
1517
  let attributeTagsMap = null;
1524
1518
  return { JSXAttribute(node) {
1525
1519
  const actualName = getText(context, node.name);
@@ -1616,21 +1610,10 @@ function isSafeRel(value, allowReferrer) {
1616
1610
  if (/\bnoreferrer\b/u.test(value)) return true;
1617
1611
  return allowReferrer && /\bnoopener\b/u.test(value);
1618
1612
  }
1619
- // src/rules/no-unsafe-target-blank/no-unsafe-target-blank.ts
1620
- const RULE_NAME$2 = "no-unsafe-target-blank";
1621
- const defaultOptions = [{ allowReferrer: false }];
1622
- const schema = [{
1623
- type: "object",
1624
- additionalProperties: false,
1625
- properties: { allowReferrer: {
1626
- type: "boolean",
1627
- description: "Allow 'rel=\"noopener\"' without 'noreferrer' so referrer information is preserved."
1628
- } }
1629
- }];
1630
1613
  var no_unsafe_target_blank_default = createRule({
1631
1614
  meta: {
1632
1615
  type: "problem",
1633
- defaultOptions: [...defaultOptions],
1616
+ defaultOptions: [{}],
1634
1617
  docs: { description: "Disallows 'target=\"_blank\"' without 'rel=\"noreferrer\"'." },
1635
1618
  fixable: "code",
1636
1619
  hasSuggestions: true,
@@ -1638,13 +1621,21 @@ var no_unsafe_target_blank_default = createRule({
1638
1621
  default: `Using 'target="_blank"' on an external link without '{{rel}}' is a security risk.`,
1639
1622
  suggest: `Add '{{rel}}' to the link to prevent security risks.`
1640
1623
  },
1641
- schema
1624
+ schema: [{
1625
+ type: "object",
1626
+ additionalProperties: false,
1627
+ properties: { allowReferrer: {
1628
+ type: "boolean",
1629
+ description: "Allow 'rel=\"noopener\"' without 'noreferrer' so referrer information is preserved."
1630
+ } }
1631
+ }]
1642
1632
  },
1643
- name: RULE_NAME$2,
1633
+ name: "no-unsafe-target-blank",
1644
1634
  create: create$2
1645
1635
  });
1646
1636
  function create$2(context) {
1647
- const { allowReferrer } = complete(context.options[0], defaultOptions[0]);
1637
+ const options = { ...context.options[0] ?? {} };
1638
+ const allowReferrer = options.allowReferrer ??= false;
1648
1639
  const resolver = createJSXElementResolver(context);
1649
1640
  const requiredRelAttribute = `rel="${allowReferrer ? "noopener" : "noreferrer"}"`;
1650
1641
  return { JSXElement(node) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-dom",
3
- "version": "5.30.0-beta.7",
3
+ "version": "5.30.0-beta.9",
4
4
  "description": "ESLint React's ESLint plugin for DOM related rules.",
5
5
  "keywords": [
6
6
  "react",
@@ -37,11 +37,11 @@
37
37
  "dist"
38
38
  ],
39
39
  "dependencies": {
40
- "@eslint-react/ast": "5.30.0-beta.7",
41
- "@eslint-react/eslint": "5.30.0-beta.7",
42
- "@eslint-react/jsx": "5.30.0-beta.7",
43
- "@eslint-react/shared": "5.30.0-beta.7",
44
- "@eslint-react/var": "5.30.0-beta.7",
40
+ "@eslint-react/ast": "5.30.0-beta.9",
41
+ "@eslint-react/eslint": "5.30.0-beta.9",
42
+ "@eslint-react/jsx": "5.30.0-beta.9",
43
+ "@eslint-react/shared": "5.30.0-beta.9",
44
+ "@eslint-react/var": "5.30.0-beta.9",
45
45
  "@typescript-eslint/types": "^8.72.1",
46
46
  "@typescript-eslint/utils": "^8.72.1",
47
47
  "compare-versions": "^6.1.1",