-
-
Notifications
You must be signed in to change notification settings - Fork 87
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
Integrate prettier #336
Comments
@Undistraction wrote: @char0n WIth prettier you have to just accept that there are very few config options. That is actually the best thing about it, but if you are used to finessing how you like things to look it will be a hard at first. I honestly think it is the single biggest time-saver you can use in writing JS. So much less distraction from silly little decisions about formatting. It's very fast too. |
@Undistraction what is the workflow ? Do I understand correctly that you don't need linting if you use it ? I've also seen using eslint + prettier working together in some projects. |
It's not a linter, it's a code formatter. It works by turning the code into an AST, then rendering it. This means its really consistent - it isn't trying to change elements of the code, but always runs a full transform on everything. ESlint is actually both a linter and a formatter (if you use its autofix). So you want to use Prettier for formatting and ESlint for linting. You can do this just by disabling the autofixing for Eslint. I use VSCode and have it setup to run prettier every time I save a file. My
You might need to tweak a few eslint rules to get them to play nicely (So prettier isn't doing things that eslint doesn't like. Here is my
They are rock solid and work great together. You can confidently drop semi-colons with prettier and it will add them in only when needed. I have also found switching to using backticks for all strings is a huge timesaver so I don't need to change the delimiter if I need to insert a value or use single quotes. I'd be happy to get this setup, but it's probably worth you having a run at it yourself just to get your head round it. |
Feel free to issue a PR and I'll play with it in the PR. I am planning to give it a go on Oracle project I'm currently working on to bring consistency into codebase. Regarding using template literals all the time, I had a debate on it with some guys in the past, I still prefer to visually distinguish between strings and dynamic template literals but I guess that only matter of subjective taste. |
I think it's just one of those things that feels wrong until you do it and after a day you don't give it another thought. For me the time saving alone is a big win. It really adds up. |
Very nice job! Added 2 codeclime issues as exceptions. |
https://github.com/prettier/prettier
The text was updated successfully, but these errors were encountered: