npetruzzelli / eslint-config-prettier-standard

An ESLint shareable config for projects using 'Prettier' and 'JavaScript Standard Style' as ESLint rules.
BSD 3-Clause "New" or "Revised" License
39 stars 3 forks source link

Unexpected no-unused-vars for React components #9

Closed cdfa closed 5 years ago

cdfa commented 5 years ago

Hi, I'm gettting no-unused-vars for all React components in my application. If you can't reproduce, feel free to ask me for more info.

Minimal example:

const Test = () => <div>Test</div>;

const Usage = () => <Test />;

Expected behaviour:

3:7  error  'Usage' is assigned a value but never used  no-unused-vars

Actual behaviour:

1:7  error  'Test' is assigned a value but never used   no-unused-vars
3:7  error  'Usage' is assigned a value but never used  no-unused-vars

eslintrc.json:

...
  "extends": [
    "prettier-standard/prettier-file",
    "prettier/react"
  ],
  "plugins": ["react", "prettier", "json", "jest", "no-loops"],
...
cdfa commented 5 years ago

I had another attempt today and now I'm not getting them anymore. Not sure exactly what I did differently, but I think this can now be closed.

npetruzzelli commented 5 years ago

Hi @cdfa ,

I'm glad it worked out for you. If I had to guess, maybe there was a problem with the React plugin, you may have resolved it by starting a new command line window or reinstalling the plugin. But this is still just a guess.

As a side note, you don't have to specify "prettier" in plugins, but it shouldn't hurt anything either. This config does that for you.

Happy coding!