Js-beautify: Integrating editor config

Created on 3 Oct 2014  ·  12Comments  ·  Source: beautify-web/js-beautify

What do you guys think about taking into account editorconfig files when beautifying. I'm not sure how many people use this in a package/plugin/build proccess way, but when JSBeautify is used to beautify a file, some settings that editorconfig sets up are disregarded and overriden like trailing newlines. Do you guys think it would be a good idea to allow people to pass in a .editorconfig file programmatically and for the CLI look for one in the cwd and take these settings into account to avoid that code being duplicated everywhere else?

enhancement

Most helpful comment

Has anyone create a PR for this? I am happy to create one if no-body has done it yet.

All 12 comments

Yeah I saw that @sindresorhus has a plugin. Do you think it makes sense to integrate editorconfig in any way into this plugin?

I think it should check for a .editorconfig file in the current project and obey the indent_* settings.

This tool has no concept of "project". It could probably search the users home directory and the current directory. Maybe search up the tree as well.

As noted int #550 where this was first mentioned, It's not the top of my list of concerns. We've treated this as a library that clients can pass values to, but we have a .jsbeautifyrc file so it could make sense to read a ".editorconfig file. Anyone is welcome to file a PR that implements it. :smile:

@bitwiseman I agree !
I think that .jsbeautifyrc config file for now it's enough :+1:
So It's not bad idea to read an .editorconfig file settings like enhancement for js-beautify (Maybe, in near future :smile:)
Regards !

What about passing in the JSON of editorconfig to js beautify?

editorconfig support would be very very nice

Please help! Submit a pull request!

this is would be really useful to contribute to open source projects. Make it pls! ლ ( ◕ ᗜ ◕ ) ლ

Has anyone create a PR for this? I am happy to create one if no-body has done it yet.

I am starting to implement the editorconfig functionality. Anybody who wants to review my code?

I have implemented the feature. Please feel free to try it out and comment on it.

Was this page helpful?
0 / 5 - 0 ratings