nfour / eslint-config-standard-typescript-prettier

A simple eslint config for modern TypeScript projects.
MIT License
22 stars 8 forks source link

Error with no-use-before-define and React #9

Closed femiveys closed 2 years ago

femiveys commented 3 years ago

When using this module in a React with Typescript problem you get an error with no-use-before-define in every file you use the React import.

'React' was used before it was defined. (eslint/no-use-before-define)

This can be fixed by re-enabling the @typescript-eslint/no-use-before-define that you disabled. Why did you disable this useful rule?

So in .eslintrc.json add:

  "rules": {
    "no-use-before-define": "off",
    "@typescript-eslint/no-use-before-define": ["error"]
  }
nfour commented 2 years ago

I disabled it because it's not actually useful in my experience - order in JS is fairly intuitive once you understand it and enforcing specific ordering can be left up to individuals. It also intriduces