Babel-eslint: `\` character inside JSX text flags no-useless-escape

Created on 20 Oct 2016  路  6Comments  路  Source: babel/babel-eslint

Not sure if this is a babel-eslint issue or not, but not sure where else to put it. If you have a \ character inside of a JSX text node, for instance like so:

<div>Here it is: \ </div>

Which is valid and compiles / displays fine, eslint throws an error:

error Unnecessary escape character: \ no-useless-escape

Interestingly enough, it throws the same error at the same spot when the \ is HTML-encoded as &#x5C;.

bug eslint

All 6 comments

Can you see if this also happens with the default ESLint parser (which also supports JSX)? If so, this is a bug for the no-useless-escape rule in ESLint core

@kaicataldo tested locally, this also throws an error with espree. So looks like its an eslint rule issue. Will look into it and maybe be able to provide a patch.

Is there a corresponding eslint issue open at the moment to reference?

@sstern6 Not that I know of, but I could have missed it. Feel free to make an issue, and thanks for looking into this!

Think i found the issue, will open the Issue on eslint and open a PR shortly. Will link to both in here when I do to keep track!

Thanks

@kaicataldo this can be closed, i believe. PR merged into Eslint.

Thanks

Great, thanks!

Was this page helpful?
0 / 5 - 0 ratings