-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Should the gatsby-default-started have a ESlint + Prettier config by default? #11778
Comments
IIRC Gatsby ships with a small (internal) ESLint file, and I thought it used to come with a Prettier dotfile. I may be wrong, though. I wrote the doc for using ESLint with Gatsby but I think I may need to revisit it at this point. I agree, including those dotfiles in the default starter would be beneficial. |
Gatsby ships an eslint config internally that uses the same ruleset as CRA. For Prettier, we used to have it but it was removed recently for reasons unclear to me. Perhaps we should add it back? |
👋 Yup - my doing on this one. See #11285 for more info on that. So, two things here:
On 2. we removed it to simplify the starters and because generally it's very easy to add it back yourself. That being said--I do see the value of baking in default packages here, so happy to have another PR addressing the removal and adding prettier back to the starters! |
@DSchau I may hop on this tonight. Should the prettier config from gatsby's project root be used for this? |
@josefaidt yeah - that seems reasonable. May want to pull back some of the more opinionated ones (e.g. |
I'd love to contribute on this one too if that's ok, it sounds like a good first issue for those who did not contributed to the codebase yet. :) |
That'd be great! Whoever does take it just make sure to make a comment here when you start so that we don't double up work here. Thanks! |
Sure. I'll wait for @josefaidt 's input on it cause he has the priority since he claimed it first. If he is ok with me taking it, I'll gladly do it. 😃 |
@thefrontendwizard by all means! I will work on updating the ESLint doc. Just keep the name |
to add on to the comment regarding the opinionated Prettier rules, I thought we could provide all the default rules. That way they're front and center to edit, as well as not show any bias |
Ok. I'm filling in the |
I do feel like we could start with the same config made by the project, even with opinionated ones, as long as we point that out on the docs. Specially the |
One point for this is the style already adopted in the few lines of code both in the |
That is a good point, I'll update the eslint doc to reflect that |
Ok. We can say something like: "Hey, this is how we like our codebase to be. If that's not your jam, tweak it out on |
I'm a big fan of lint-staged. I think it might make the setup a bit more difficult from a beginners point of view. Like yikes, I can't commit! 😠 (not all IDEs tell you why you can't commit). |
yup, that makes sense. It could be in the docs though, as a recommendation. |
There's a doc that goes over setting up Prettier + VSCode I think it would be beneficial to add another script to the default starter that runs Prettier, then in the ESLint doc I can reference that script saying "modify this script to use ESLint..." or something. |
something on the lines of
? |
Yes just use the prettier script, though. The ESLint doc integrates Prettier with ESLint so the user will be modifying that script. Something like this?
"scripts": {
"lint": "eslint src",
"lint:fix": "eslint --fix src"
} Do yall think the ESLint doc should have instructions for integrating with VSCode? Since there's a doc for Prettier about it and ESLint will replace Prettier... |
ESLint will replace Prettier? They are not mutually exclusive. Prettier deals with style and only that. The ideal setup would be to use both ESLint and Prettier. |
That's my bad not replace Prettier, integrate with it. It'll use Prettier for the formatting |
I'll add the |
As for the instructions to integrate ESLint with VSCode, I believe that we should indeed have the instructions on the docs. |
Cool, I'll update it once I get home this evening |
so cool 😎 that you guys are collaborating so well! ❤️ I don't have an immediate opinion on what to call the script ^^ |
It was previously called And echo'ing @wardpeet's comments above. Nice work thus far everyone! |
I like |
Ook. I'll name it format and add |
Just pushed an update on #11786 with the |
Cool, I'll be getting my updates in this evening :) |
Update to #11783 with scripts and VSCode integration |
I'll close this one due because #11786 solves this by adding a prettier config into all the starters. |
I'm starting out with GatsbyJS and the default started is pretty great, but I find myself having to setup the eslint everytime I start a new gatsby project. Should gatsby-default-started have a default config with the react and prettier plugins by default, since it is strongly recommended for everyone?
I do understand that the default started should be a no brainer and no opinion started for everyone and regarding the linter setup you do have some options, like airbnb vs standard style. Should I go and create a separate started with my own setup and start using?
The text was updated successfully, but these errors were encountered: