Skip to content

jsx-no-target-blank fails when spread props is before target even when warnOnSpreadAttributes is false #2952

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
DatDinoDoe opened this issue Mar 24, 2021 · 1 comment · Fixed by #2953

Comments

@DatDinoDoe
Copy link

Starting in 7.23.0, the jsx-no-target-blank rule will fail when warnOnSpreadAttributes is false and there's a spread before a non-_blank target, which is supposed to pass even if warnOnSpreadAttributes is true.

Example:
When warnOnSpreadAttributes is false (or default):

 <a href='some-link' {...otherProps} target='some-non-blank-target'>

Would fail, while

 <a href='some-link' target='some-non-blank-target' {...otherProps} >

would pass. If warnOnSpreadAttributes was true, both would fail.

I believe the issue is the if/elseif logic here:
https://github.com/yannickcr/eslint-plugin-react/blob/v7.23.1/lib/rules/jsx-no-target-blank.js#L149

@ljharb
Copy link
Member

ljharb commented Mar 24, 2021

cc @Nokel81

# for free to join this conversation on GitHub. Already have an account? # to comment
Development

Successfully merging a pull request may close this issue.

2 participants