eslint-plugin-react-x 3.0.0-rc.0 → 3.0.0-rc.1

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 +18 -5
  2. package/package.json +9 -6
package/dist/index.js CHANGED
@@ -146,7 +146,7 @@ const rules$7 = {
146
146
  //#endregion
147
147
  //#region package.json
148
148
  var name$6 = "eslint-plugin-react-x";
149
- var version = "3.0.0-rc.0";
149
+ var version = "3.0.0-rc.1";
150
150
 
151
151
  //#endregion
152
152
  //#region src/utils/create-rule.ts
@@ -7353,7 +7353,10 @@ var unstable_rules_of_props_default = createRule({
7353
7353
  meta: {
7354
7354
  type: "problem",
7355
7355
  docs: { description: "Enforces the Rules of Props." },
7356
- messages: { noControlledAndUncontrolledTogether: "Prop `{{controlled}}` and `{{uncontrolled}}` should not be used together. Use either controlled or uncontrolled components, not both." },
7356
+ messages: {
7357
+ noDuplicateProps: "Prop `{{prop}}` is specified more than once. Only the last one will take effect.",
7358
+ noControlledAndUncontrolledTogether: "Prop `{{controlled}}` and `{{uncontrolled}}` should not be used together. Use either controlled or uncontrolled components, not both."
7359
+ },
7357
7360
  schema: []
7358
7361
  },
7359
7362
  name: RULE_NAME,
@@ -7365,16 +7368,26 @@ function toControlledName(uncontrolledName) {
7365
7368
  if (head == null || tail == null) return null;
7366
7369
  return head.toLowerCase() + tail;
7367
7370
  }
7371
+ function getPropName(attribute) {
7372
+ const { name: nameNode } = attribute;
7373
+ if (nameNode.type === AST_NODE_TYPES.JSXNamespacedName) return `${nameNode.namespace.name}:${nameNode.name.name}`;
7374
+ return nameNode.name;
7375
+ }
7368
7376
  function create(context) {
7369
7377
  return defineRuleListener({ JSXOpeningElement(node) {
7370
7378
  const attributes = /* @__PURE__ */ new Map();
7371
7379
  for (const attribute of node.attributes) {
7372
7380
  if (attribute.type === AST_NODE_TYPES.JSXSpreadAttribute) continue;
7373
- const { name: identifier } = attribute.name;
7374
- if (typeof identifier !== "string") continue;
7375
- attributes.set(identifier, attribute);
7381
+ const propName = getPropName(attribute);
7382
+ if (attributes.has(propName)) context.report({
7383
+ data: { prop: propName },
7384
+ messageId: "noDuplicateProps",
7385
+ node: attribute
7386
+ });
7387
+ attributes.set(propName, attribute);
7376
7388
  }
7377
7389
  for (const [propName, attrNode] of attributes) {
7390
+ if (propName.includes(":")) continue;
7378
7391
  const controlledProp = toControlledName(propName);
7379
7392
  if (controlledProp == null) continue;
7380
7393
  if (!attributes.has(controlledProp)) continue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-x",
3
- "version": "3.0.0-rc.0",
3
+ "version": "3.0.0-rc.1",
4
4
  "description": "A set of composable ESLint rules for libraries and frameworks that use React as a UI runtime.",
5
5
  "keywords": [
6
6
  "react",
@@ -45,16 +45,16 @@
45
45
  "string-ts": "^2.3.1",
46
46
  "ts-api-utils": "^2.4.0",
47
47
  "ts-pattern": "^5.9.0",
48
- "@eslint-react/ast": "3.0.0-rc.0",
49
- "@eslint-react/core": "3.0.0-rc.0",
50
- "@eslint-react/var": "3.0.0-rc.0",
51
- "@eslint-react/shared": "3.0.0-rc.0"
48
+ "@eslint-react/ast": "3.0.0-rc.1",
49
+ "@eslint-react/shared": "3.0.0-rc.1",
50
+ "@eslint-react/core": "3.0.0-rc.1",
51
+ "@eslint-react/var": "3.0.0-rc.1"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@types/react": "^19.2.14",
55
55
  "@types/react-dom": "^19.2.3",
56
56
  "eslint": "^10.0.3",
57
- "tsdown": "^0.21.0",
57
+ "tsdown": "^0.21.2",
58
58
  "tsl-dx": "^0.9.0",
59
59
  "@local/configs": "0.0.0",
60
60
  "@local/eff": "3.0.0-beta.72"
@@ -69,6 +69,9 @@
69
69
  "publishConfig": {
70
70
  "access": "public"
71
71
  },
72
+ "inlinedDependencies": {
73
+ "@local/eff": "workspace:*"
74
+ },
72
75
  "scripts": {
73
76
  "build": "tsdown",
74
77
  "lint:publish": "publint",