-
Notifications
You must be signed in to change notification settings - Fork 91
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
support presets (google, nodeguide, idiomatic) #2
Comments
The google styleguide is supposed to be the default. They don't provide that many details on code formatting, so we'd probably have to actually run some of their code through the default preset to see what changes. Once obvious difference is the indent: They use two spaces, while the default currently is four spaces. idiomatic.js seems to overlap a lot with the jQuery Style Guide. Looking around for a bit I didn't spot much differences. It doesn't have the top-level block exception. The guide itself doesn't seem to enforce indentation, but the examples all use two spaces. nodeguide has even less detail on actual code formatting. Overall it looks very similar to the Google guide, including the two space indentation. Seems to me like we should change the default for indent.value to two spaces, make other adjustments to match the Google guide and sample code and finish #19 to provide an alternative (jQuery/idiomatic). If you're okay with changing the indent default, I can make a PR for that and adjust all the tests. |
Hi, I wrote an extremely simple tool that formats your files (of course without changing them) and tells you how close they are to the formatted version. It doesn't try to infer any configuration option, but at least it can be used to tweak it. The project is called esformatter-diff and can be used like this
|
just a FYI that the preset logic is already in place, just need to create the JSON files with the settings and update the code = esformatter.format(code, {"preset": "idiomatic"}); and later we need to add an option to the cli as well like: esformatter -p idiomatic foo.js |
the latest 3 commits added support for presets and also for preset inheritance - so user can say his config is based on // use all the jQuery settings and overwrite the "indent.value"
{
"preset": "jquery",
"indent": {
"value": " "
}
} now we need to finish the settings and start implementing the actual config files for different style guides (after we finish pending tasks). jQuery style guide will be the first one to be added since a lot of people is asking for it but feel free to provide pull requests for different style guides (as long as they are popular). |
the preset logic is in place, so I'm going to close this issue (and will handle each preset as a separate issue). |
* No longer kills empty lines fixes millermedeiros#2
I think we should have presets for the most common styles:
also do it in a way that user can store their settings on the project folder or as a global file.
The text was updated successfully, but these errors were encountered: