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

Correct custom eslint instructions #12980

Closed
KyleAMathews opened this issue Apr 1, 2019 · 8 comments
Closed

Correct custom eslint instructions #12980

KyleAMathews opened this issue Apr 1, 2019 · 8 comments
Labels
good first issue Issue that doesn't require previous experience with Gatsby help wanted Issue with a clear description that the community can help with. type: documentation An issue or pull request for improving or updating Gatsby's documentation

Comments

@KyleAMathews
Copy link
Contributor

If people customize their eslint setup, we should recommend they start from our default setup https://www.npmjs.com/package/eslint-config-react-app and go from there.

Our current docs recommend something entirely different:
https://www.gatsbyjs.org/docs/eslint/#configuring-eslint

@KyleAMathews
Copy link
Contributor Author

@KyleAMathews KyleAMathews added the help wanted Issue with a clear description that the community can help with. label Apr 1, 2019
@KyleAMathews
Copy link
Contributor Author

@kkemple looked into writing out the schema so then a custom eslint config could use it. @freiksenet @stefanprobst — it'd be great to do that #6167

@stefanprobst
Copy link
Contributor

@KyleAMathews this is on the roadmap. In the meantime there is this plugin.

@DSchau DSchau added the type: documentation An issue or pull request for improving or updating Gatsby's documentation label Apr 1, 2019
@KyleAMathews
Copy link
Contributor Author

Ok, no worries @stefanprobst

So for now we should just recommend people use:

{
      globals: {
        graphql: true,
        __PATH_PREFIX__: true,
      },
      extends: `react-app`,
}

@DSchau DSchau added the good first issue Issue that doesn't require previous experience with Gatsby label Apr 1, 2019
@DSchau
Copy link
Contributor

DSchau commented Apr 1, 2019

Would love for someone to pick this up--right now we're displaying a document that is a little bit less focused than we'd like.

Description

  • Update this document with the above instructions per @KyleAMathews
    • Why?
      • This document is doing a bit too many things, e.g. adding prettier
      • We should advocate simple set ups that work out of the box and scale as needed
  • (Longer term!) we should expose something like gatsby-config-eslint which will be an opinionated set of defaults that are currently internalized here
    • This requires changes to dumping our schema, so a quicker win is to first update the documentation and longer term externalize our config so it can be used by anyone

@lukebrobbs
Copy link
Contributor

Hi, sorry to sound dumb, but I'd like to dive into a bit of open source, and this seems like a good place to start. Is this replacing the current .eslintrc.js example with the config written by @KyleAMathews above? Thanks

@DSchau
Copy link
Contributor

DSchau commented Apr 1, 2019

@lukebrobbs not a dumb question, at all!

Yep, exactly. You'll want to edit this file and instructions to be a little simpler, and just install the necessary dependencies, e.g. eslint-config-react-app

Feel free to reach out if we can help with anything else!

@lukebrobbs
Copy link
Contributor

Great, thanks! The npm page for eslint-config-react-app recommends installing the following for projects not build with Create React App:

npm install --save-dev eslint-config-react-app babel-eslint@9.x eslint@5.x eslint-plugin-flowtype@2.x eslint-plugin-import@2.x eslint-plugin-jsx-a11y@6.x eslint-plugin-react@7.x

Will all of this need to be installed with Gatsby?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Issue that doesn't require previous experience with Gatsby help wanted Issue with a clear description that the community can help with. type: documentation An issue or pull request for improving or updating Gatsby's documentation
Projects
None yet
Development

No branches or pull requests

5 participants