Open IonicaBizau opened 8 years ago
Hey @IonicaBizau editorconfig file should be a good idea since is supported in most new editors and in other has support to install an extension to detect the style guide for each project for example this is an .editorconfig
file from a one of my .php projects.
root=true
[*]
charset=utf-8
end_of_line=lf
insert_final_newline=true
trim_trailing_whitespace=true
[*.php]
indent_style=tab
indent_size=4
[{*.css, *.scss, *.js, *.html, package.json, *.yml}]
indent_style=space
indent_size=2
[*.md]
trim_trailing_whitespace = false
As you can see we remove all trailing whitespace for all files except markdown, since the rules are from top to bottom and are overwritten similar as happens on a .gitignore
file. Rules are applied based on the extension file and you can group files with the same syntax rules for example:
[{*.css, *.scss, *.js, *.html, package.json, *.yml}]
Those rules will apply for all files with extensions like css, scss, js html yml and a package.json.
The rules for those files are pretty straightforward
indent_style=space
indent_size=2
And if we add the file into the repo every time some one else wants to contribute this rules will be applied by the editor like sublime, atom or any other editor, you can have more information about this on the editorconfig page.
@mitogh That's amazing! :sparkles:
Can the editorconfig file be used to beautify the code in the format I like? Also, is it possible to handle the commas in the beginning of the line?
I'm wondering how to convert this big document in editorconfig code. :smile:
As mentioned in the other issue Editorconfig is more about Encoding, Indentation, Line-Endings and Tabs. Everything else would have to be done by something like eslint
. So I would encourage you to put and .editorconfig
like the one above into all repos. That way PRs will not have strange conflicts about Line-Endings a.s.o
https://github.com/IonicaBizau/last-char/pull/4#discussion_r42322311