Skip to content

linter: react/jsx-curly-brace-presence fixer changes escaped JSX attribute values #25934

Description

@selenehyun

Oxlint version

1.79.0

Command

oxlint --react-plugin \
  -D react/jsx-curly-brace-presence \
  --fix repro.tsx

No configuration file is used.

What happened?

Given:

<Markdown content={`\\* Want to learn more`} />

Oxlint produces:

<Markdown content="\\* Want to learn more" />

The original template literal passes one backslash at runtime. Backslashes in a quoted JSX attribute are literal, so the fixed code passes two backslashes.

The fixer therefore changes the runtime value while using the standard --fix option.

Expected behavior

The fixer should leave the expression unchanged or otherwise preserve its runtime value. If it converts the expression into a quoted JSX attribute, the result should contain one source backslash:

<Markdown content="\* Want to learn more" />

Reproduction

https://github.com/selenehyun/oxlint-jsx-curly-brace-presence-backslash-repro

npm install
npm run reproduce

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions