Skip to content

Add sx support to no-conflicting-props eslint rule#1705

Open
mjames-c wants to merge 1 commit into
facebook:mainfrom
mjames-c:mj--sx-conflicting-props
Open

Add sx support to no-conflicting-props eslint rule#1705
mjames-c wants to merge 1 commit into
facebook:mainfrom
mjames-c:mj--sx-conflicting-props

Conversation

@mjames-c

@mjames-c mjames-c commented Jun 9, 2026

Copy link
Copy Markdown

What changed / motivation ?

sx and className should not be used together (similar to ...stylex.props(...))

Linked PR/Issues

Fixes #1359

Pre-flight checklist

Copilot AI review requested due to automatic review settings June 9, 2026 04:09
@mjames-c mjames-c requested review from mellyeliu and nmn as code owners June 9, 2026 04:09
@meta-cla

meta-cla Bot commented Jun 9, 2026

Copy link
Copy Markdown

Hi @mjames-c!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@vercel

vercel Bot commented Jun 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
stylex Skipped Skipped Jun 9, 2026 4:23am

Request Review

@mjames-c mjames-c changed the title Add sx support to no-conflicting-props eslint rule Add sx support to no-conflicting-props eslint rule Jun 9, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates the stylex-no-conflicting-props ESLint rule to flag className/style conflicts not only with stylex.props() spreads, but also with a configurable StyleX “shorthand” prop (default: sx) on host elements.

Changes:

  • Add detection for a shorthand StyleX prop (default sx) on lowercase JSX host elements and report conflicting className/style.
  • Introduce an sxPropName option (string or false) and tailor report messages based on whether the conflict comes from stylex.props() or shorthand usage.
  • Extend unit tests to cover shorthand behavior and configuration.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
packages/@stylexjs/eslint-plugin/src/stylex-no-conflicting-props.js Adds shorthand-prop detection, new option schema, and message selection logic.
packages/@stylexjs/eslint-plugin/tests/stylex-no-conflicting-props-test.js Adds valid/invalid cases for shorthand prop conflicts and configuration.

Comment on lines +107 to +113
function isLowercaseHostElement(node: JSXOpeningElement): boolean {
return (
node.name.type === 'JSXIdentifier' &&
typeof node.name.name === 'string' &&
node.name.name[0] === node.name.name[0].toLowerCase()
);
}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this matches the logic in the babel transformer:

node.name.type !== 'JSXIdentifier' ||
typeof node.name.name !== 'string' ||
node.name.name[0] !== node.name.name[0].toLowerCase()

Comment thread packages/@stylexjs/eslint-plugin/src/stylex-no-conflicting-props.js Outdated
Comment thread packages/@stylexjs/eslint-plugin/src/stylex-no-conflicting-props.js
@mjames-c mjames-c force-pushed the mj--sx-conflicting-props branch from e641a81 to fe600b1 Compare June 9, 2026 04:22
@mjames-c

mjames-c commented Jun 9, 2026

Copy link
Copy Markdown
Author

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

my company (Canva) does have a CLA with Meta but I'm waiting to be added to the list of contributors (hopefully by end of week)

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 10, 2026
@meta-cla

meta-cla Bot commented Jun 10, 2026

Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

stylex.propssx() transform

2 participants