Skip to content
This repository was archived by the owner on Jan 19, 2019. It is now read-only.

JSX fragment causes false positives with no-multi-str #503

Closed
nickserv opened this issue Jul 25, 2018 · 6 comments · Fixed by #538
Closed

JSX fragment causes false positives with no-multi-str #503

nickserv opened this issue Jul 25, 2018 · 6 comments · Fixed by #538

Comments

@nickserv
Copy link

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

@nickserv nickserv changed the title Fragment shorthands cause false positives with no-multi-str JSX fragment shorthand causes false positives with no-multi-str Jul 25, 2018
@nickserv nickserv changed the title JSX fragment shorthand causes false positives with no-multi-str JSX fragment causes false positives with no-multi-str Jul 25, 2018
@sbason
Copy link

sbason commented Aug 3, 2018

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

@nickserv
Copy link
Author

nickserv commented Aug 3, 2018

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.

@ThaJay
Copy link

ThaJay commented Aug 10, 2018

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)

@lostfictions
Copy link

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

@infctr
Copy link

infctr commented Oct 29, 2018

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

@alangpierce
Copy link

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.)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants