I am using Atom as my code editor of choice and am finding it hard to implement functionality to beautify code. I am relying quite heavily on eslint package and just got beautify to clean up my code on save. issue is that once code is beautified it results in some minor eslint errors and I am looking for a way to either set up beautify plugin in a way that respects eslint rules or use something else that does the job.
I am using Atom as my code editor of choice and am finding it hard to implement functionality to beautify code. I am relying quite heavily on eslint package and just got beautify to clean up my code on save. issue is that once code is beautified it results in some minor eslint errors and I am looking for a way to either set up beautify plugin in a way that respects eslint rules or use something else that does the job.
Share Improve this question edited May 6, 2016 at 17:11 Brett DeWoody 62.9k31 gold badges144 silver badges192 bronze badges asked Mar 29, 2016 at 11:11 IljaIlja 46.5k103 gold badges289 silver badges527 bronze badges 2- 1 Can you be more specific about which eslint errors you're getting on save? – Brett DeWoody Commented May 6, 2016 at 17:11
- so which package are you use for that ? – Santosh Shinde Commented Sep 14, 2016 at 6:15
2 Answers
Reset to default 7You may want to use an Atom plugin called Prettier Eslint that formats code according to eslint
config file (.eslintrc
). It uses eslint's --fix
flag to fix issues.
Edit: Looks like its Prettier-atom now. Thanks, @dube.
It sounds like your beautify
settings aren't matched up with your eslint
rules. For example, the eslint
indent
rule might be set to 4
while beautify
indent
is set to 2
.
The beautify
plugin has some settings to customize how it beautifies your code. You can read about those settings in the docs. Unfortunately there's only 17 settings so it might not be possible to sync the 2 packages.
If you find you need more control over the auto-formatting in Atom you might want to check out the ESFormatter package. It has more than 250 options, which might suit your needs better if you have some non-standard ESLint rules.