eslint/typescript-eslint-parser

JSX fragment causes false positives with no-multi-str

nickserv opened this issue · 6 comments

What version of TypeScript are you using?
2.9.2

What version of typescript-eslint-parser are you using?
16.0.1

What code were you trying to parse?

export default function Home() {
  return (
    <>
      {description}
      <br />
      <Options labels={getOptions(questions)} />
    </>
  )
}

What did you expect to happen?
No errors, because <></> is short for <React.Fragment></React.Fragment> and React is already imported.

What happened?
Multiline support is limited to browsers supporting ES5 only no-multi-str

+1 I am getting the same thing with quotes throwing false positives

I couldn't figure out how to get it to behave with the shorthand, so I disabled the rule. With the number of exceptions to rules like this in this parser, I think it would be really useful to include a shared config that disables rules conflicting with TypeScript and the parser implementation.

subscribing, I als have both issues (quotes and no-multi-str get triggered on fragment)

With just jsx the quotes rule got triggered and I moved to babel/quotes to fix this.
Now with tsx both rules get triggered (and thus the babel/quotes rule also does not work for ts)

Looks like this might be fixed (via #511, now brought in as JamesHenry/typescript-estree#15)

Is the dependency going to be updated? It currently has "typescript-estree": "2.1.0" while 4.0.0 is the latest version

JamesHenry/typescript-estree#15 was published in typescript-estree 2.1.0, so I was able to get fragments working by updating typescript-eslint-parser to latest. (Looks like the 4.0.0 is just from two breaking change commits since the fragments commit, not sure how important those are to pull in.)