Skip to content
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

Add eslint info #4

Open
IonicaBizau opened this issue Oct 18, 2015 · 4 comments
Open

Add eslint info #4

IonicaBizau opened this issue Oct 18, 2015 · 4 comments

Comments

@IonicaBizau
Copy link
Owner

IonicaBizau/last-char#4 (comment)

@mitogh
Copy link

mitogh commented Jan 2, 2016

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.

@IonicaBizau
Copy link
Owner Author

@mitogh That's amazing! ✨

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. 😄

@clouless
Copy link

clouless commented Mar 2, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@IonicaBizau @mitogh @clouless and others