Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

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

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

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

Successfully merging a pull request may close this issue.

2 participants