Skip to content

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

@DatDinoDoe

Description

@DatDinoDoe

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions