Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If i want use eslint-plugin-react-hooks, is it necessary to use standardx? #1276

Closed
Junting-Liu opened this issue Apr 21, 2019 · 6 comments

Comments

@Junting-Liu
Copy link

Junting-Liu commented Apr 21, 2019

I want to config standard for eslint-plugin-react-hooks, but it doesn't work. So, i replace standard with standardx,like...

 "standardx": {
    "parser": "babel-eslint",
    "plugins": [
      "react-hooks"
    ]
  },
  "eslintConfig": {
    "rules": {
      "react-hooks/rules-of-hooks": "error",
      "react-hooks/exhaustive-deps": "warn"
    }
  },

But, is it the only way?
And, vscode-standardjs can't give the warning about react hook, what should i do ?

@Junting-Liu
Copy link
Author

I think i find the reason.
It' seem like StandardJS (the vscode plugin) can't read the standardx in package.json.
Will this problem be fixed?

@jousmo
Copy link

jousmo commented Jun 6, 2019

Hello Junting
you were able to configure it ?

@Junting-Liu
Copy link
Author

Hello Junting
you were able to configure it ?

maybe, you need to see this issue at first. It seems like a bug of vscode-standardjs and It seems can't be solved quickly。

There is my final config。 I have to use both vscode-standardjs and eslint extension in vscode,It means the real tips about hooks come from eslint。I think my config is not good,but i don't have any other better solutions right now.

  "standardx": {
    "parser": "babel-eslint",
    "plugins": [
      "react-hooks"
    ]
  },
  "eslintConfig": {
    "parser": "babel-eslint",
    "plugins": [
      "react-hooks"
    ],
    "rules": {
      "react-hooks/rules-of-hooks": "error",
      "react-hooks/exhaustive-deps": "warn"
    }
  },
  "standard": {
    "parser": "babel-eslint"
  },

@feross
Copy link
Member

feross commented Aug 13, 2019

@Junting-Liu This will be fixed once we release a new version of vscode-standardjs. Sorry that this hack is required in the meantime.

@feross feross closed this as completed Aug 13, 2019
@orpheus
Copy link

orpheus commented Sep 27, 2019

what about for Webstorm, how do I configure standardjs to use eslint-plugin-react-hooks?
Do I need to install eslint or have an .eslintrc file?

currently I just added react-hooks to my standard config in package.json with nothing happening:

  "standard": {
    "parser": "babel-eslint",
    "env": [
      "jest"
    ],
    // here. how do I specify rules for plugins in this config?
    "plugins": [
      "react-hooks"
    ]
  }

@mightyiam
Copy link
Member

@orpheus, adding a plugin usually does not add the rules provided by that plugin to your list of rules that participate in linting.

Currently, customizing or adding rules in Standard is not supported. Please see #1356 and my proposal #703.

If these rules are important to you, you could quite easily replace standard with eslint and the eslint-config-standard package.
https://www.npmjs.com/package/eslint-config-standard

But then you need to know a little bit about how to use ESLint and configure rules and plugins and use the command line and you'd use an ESLint extension for you editor instead of a Standard extension.

ESLint's documentation is quite alright. Good luck.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

5 participants