sheerun / prettier-standard

Formats with Prettier and lints with ESLint+Standard! (✿◠‿◠)
MIT License
868 stars 44 forks source link

Flow generics are not handled correctly #70

Closed KidkArolis closed 5 years ago

KidkArolis commented 5 years ago

I don't know if this is an issue with prettier or prettier-standard, but this how this code gets formatted into invalid syntax:

import { withRouter } from 'next/router'
import type { Router } from 'next/router'

type Props = {
  router: Router
}

-const MyComponent = withRouter<Props>(({ router }: Props) => ())
+const MyComponent = withRouter < Props > (({ router }: Props) => ())
KidkArolis commented 5 years ago

I tried ignoring the line, but that doesn't seem to work:

// prettier-ignore
export default withRouter<Props>(Index)
KidkArolis commented 5 years ago

Same issue filed in the prettier repo: https://github.com/prettier/prettier/issues/5460

KidkArolis commented 5 years ago

// prettier-ignore works if I create .eslintrc with:

{
  "extends": ["plugin:flowtype/recommended"],
  "plugins": ["flowtype"],
}
KidkArolis commented 5 years ago

Kinda works now after .. updating all dependencies. I think it might be ok after all. Will come back after I double check.

sheerun commented 5 years ago

prettier-standard 9 uses most recent version of prettier so it should fix the issue (you can configure parser by create appropriate .prettierrc file, .eslintrc is now ignored)