Eslint-plugin-react: jsx-no-target-blank usage with jsx-curly-brace-presence

Created on 30 Nov 2019  路  2Comments  路  Source: yannickcr/eslint-plugin-react

eslint: 6.7.2
eslint-plugin-react: 7.17.0
eslint config: https://gist.github.com/robertgorbul/414e99899a12b56fef8d6ec9db4bf72e

29:11 Using target="_blank" without rel="noopener noreferrer" is a security risk: see https://mathiasbynens.github.io/rel-noopener
  27 |         href={'https://www.gatsbyjs.org'}
  28 |         aria-label={'Gatsby.js - Blazing fast modern site generator for React'}
> 29 |         target={'_blank'}
     |         ^
  30 |         rel={'noopener noreferrer'}
  31 |         >
  32 |         Gatsby
30:15 Need to wrap this literal in a JSX expression.
    28 |    aria-label={'Gatsby.js - Blazing fast modern site generator for React'}
    29 |    target={'_blank'}
  > 30 |    rel='noopener noreferrer'
       |    ^
    31 |    >
    32 |      Gatsby
    33 |    </a>
bug help wanted

Most helpful comment

Btw it's started throwing error with 7.17.0, versions prior to that is fine

All 2 comments

Looks like jsx-no-target-blank could add an exception for a string literal inside curly braces. (i suspect nobody ran into it since a curly-brace-presence of always for props is an exceedingly rare convention)

Btw it's started throwing error with 7.17.0, versions prior to that is fine

Was this page helpful?
0 / 5 - 0 ratings