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 /.editorconfig #1564

Closed
wants to merge 1 commit into from
Closed

Conversation

jonathantneal
Copy link
Member

[*]
charset = utf-8
end_of_line = lf
indent_style = tab

This comment was marked as abuse.

This comment was marked as abuse.

@jonathantneal
Copy link
Member Author

Try it now, @alrra.

@alrra alrra mentioned this pull request Jul 18, 2014
@drublic
Copy link
Member

drublic commented Jul 18, 2014

I +1 on merging this since I am a big fan of consistency. EditorConfig adds this. For v6 this project could totally become a bit more of an extended template which integrates some more opinionated features which the community thinks are good and somewhat stable and established.

@alrra
Copy link
Member

alrra commented Jul 18, 2014

Try it now, @alrra.

@jonathantneal LGTM, however, we should also add a few lines in the docs about it (including a note about the disclosure issue).

I'm also ok with this addition, and now, since it works with quite a few editors, I think it can be useful.

@jonathantneal
Copy link
Member Author

What do you think of the following documentation?

EDIT: Removed

@alrra
Copy link
Member

alrra commented Jul 18, 2014

What do you think of the following documentation?

@jonathantneal can you add this to the commit, it is easier to review that way as comments can be added to specific lines. :)

```

* EditorConfig homepage: [http://editorconfig.org/](http://editorconfig.org/)
* Projects using EditorConfig: [//github.com/editorconfig/editorconfig/wiki/Projects-Using-EditorConfig](//github.com/editorconfig/editorconfig/wiki/Projects-Using-EditorConfig)

This comment was marked as abuse.

This comment was marked as abuse.

@alrra alrra self-assigned this Jul 18, 2014
@jonathantneal
Copy link
Member Author

@alrra, updated.

trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

This comment was marked as abuse.

@jonathantneal
Copy link
Member Author

@alrra, updated.

@alrra alrra changed the title Add .editorconfig #1561 Add /.editorconfig Jul 19, 2014
@alrra alrra removed their assignment Jul 19, 2014
@koistya
Copy link

koistya commented Jul 19, 2014

If there will be package.json, bower.json, .travis.yml and similar files, it would be nice to have ident_size=2 just for these files.

[{bower.json,package.json,.travis.yml}]
indent_style = space
indent_size = 2

@alrra
Copy link
Member

alrra commented Jul 19, 2014

If there will be package.json, bower.json, travis.yml and similar files,

@koistya if we ever provide those files, we will certainly add those properties, otherwise will just include the bare minimum and let users change and add new properties according to their needs.

updated.

Thank you @jonathantneal! 💜

I'll leave this open for a few more days so that people have the chance to state their opinion.

alrra pushed a commit that referenced this pull request Jul 19, 2014
The addition of the `/.editorconfig` file is made in order to
encourage and help developers and their teams define and maintain
consistent coding styles between their different editors and IDEs.

By default, the `/.editorconfig` file includes some default
properties that apply to the coding styles used by HTML5 Boilerplate,
but users can easily change them to better suit their needs.

Since users need to install a editor/IDE plugin in order for the
properties from the `/.editorconfig` to be applied, we were reluctant
to add this file in the past (see: #1124).
Nowadays however, the EditorConfig project provides plugins for most
of the popular editors/IDEs (see: http://editorconfig.org/#download),
plus, more and more developers are using it.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Ref: http://editorconfig.org/

Close: #1561
       #1564
alrra pushed a commit that referenced this pull request Jul 19, 2014
The addition of the `/.editorconfig` file is made in order to
encourage and help developers and their teams define and maintain
consistent coding styles between their different editors and IDEs.

By default, the `/.editorconfig` file includes some default
properties that apply to the coding styles used by HTML5 Boilerplate,
but users can easily change them to better suit their needs.

Since users need to install a editor/IDE plugin in order for the
properties from the `/.editorconfig` to be applied, we were reluctant
to add this file in the past (see: #1124).
Nowadays however, the EditorConfig project provides plugins for most
of the popular editors/IDEs (see: http://editorconfig.org/#download),
plus, more and more developers are using it.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Ref: http://editorconfig.org/

Close: #1561
       #1564
@alrra alrra self-assigned this Jul 19, 2014

[*]
charset = utf-8
end_of_line = lf

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

@sindresorhus
Copy link
Member

👍 I find editorconfig very useful. We have it included in our Yeoman generators and Web Starter Kit.

@thasmo
Copy link

thasmo commented Jul 19, 2014

+1 Even if people don't use editors supporting/using the .editorconfig file it's still a nice way of documenting how certain files should be formatted. Definitely include it! :)

@alrra
Copy link
Member

alrra commented Jul 19, 2014

I've asked people on Twitter what they think about this addition, and since some of them prefer to respond there, here is the link to the tweet: https://twitter.com/h5bp/status/490559737667149824.

@bezoerb
Copy link

bezoerb commented Jul 19, 2014

+1 for editorconfig

@MariusRumpf
Copy link

+1 for it. Using it in all my projects very helpful.

@arthurvr
Copy link
Member

+1 for adding it

@gabeidx
Copy link

gabeidx commented Jul 19, 2014

👍

@koistya
Copy link

koistya commented Jul 19, 2014

As a Windows user I don't personally see any problems with end_of_line = lf. There could be an issue leading to mixed LF / CR LF line endings within files if team members use different editors (some with EditorConfig support and some without). Maybe it's worth mentioning this in docs?

👍

@koistya
Copy link

koistya commented Jul 19, 2014

I personally sort these parameters by "importance" - the most important is space/tabs and how many spaces for indentation.

# EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs
# http://editorconfig.org

root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

@sindresorhus
Copy link
Member

I personally sort these parameters by "importance" - the most important is space/tabs and how many spaces for indentation.

👍

root = true

[*]
charset = utf-8

This comment was marked as abuse.

This comment was marked as abuse.

@mischah
Copy link
Member

mischah commented Jul 20, 2014

Enough »chit chat«. Merge that in. 👍

People who are already using a editor config plugin will be able to adapt the .editorconfig according to their needs.

People who don’t know editor config could ignore this file. But I guess it will spread the usage of editor config and will make the world a better place :octocat:

@dustinhorton
Copy link

What's the reason for insert_final_newline = true? I see it's a common default but don't know why.

I'd also question indent_size = 4 being the default. Probably the 2 most popular CSS frameworks, Bootstrap & Foundation, as well as the Google & Mozilla JS styleguides call for 2. Haven't looked beyond that.

@treyhunner
Copy link

Regarding insert_final_newline, here are some reasons that it's a good practice:

  • git complains when files do not end in a newline
  • Unix text processing utilities act strangely if a final newline is missing (wc miscounts the lines, read in bash doesn't read the last line, more fails to print a newline before the terminal prompt, etc.)
  • Vim (among other editors) ends files in newlines by default and this option is not possible to disable in Vim (though there is a plugin that seems to allow disabling the behavior)
  • I have heard that the C standard requires that files end in newlines. This seems largely historical.

@alrra
Copy link
Member

alrra commented Jul 21, 2014

sort these parameters by "importance"

@koistya Importance is kinda subjective, so let's just stick to alphabetical order.

indent_size = 4 being the default.

@dustinhorton We currently use 4 spaces throughout the code.

@jonathantneal Merged with some modifications in a99d856

Thanks everyone for the feedback, we sincerely appreciate it! :)

alrra pushed a commit that referenced this pull request Jul 21, 2014
The addition of the `/.editorconfig` file is made in order to
encourage and help developers and their teams define and maintain
consistent coding styles between their different editors and IDEs.

By default, `/.editorconfig` includes some basic properties that
reflect the coding styles from the files provided by default, but
users can easily change them to better suit their needs.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Since users need to install a editor/IDE plugin in order for the
properties from the `/.editorconfig` to be applied, we were reluctant
to add this file in the past (see: #1124).
Nowadays however, the EditorConfig project provides plugins for most
of the popular editors/IDEs (see: http://editorconfig.org/#download),
plus, more and more developers are using it.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Ref: http://editorconfig.org/

Close: #1561
       #1564
@alrra alrra closed this Jul 21, 2014
@alrra alrra removed their assignment Jul 21, 2014
@alrra alrra added this to the 5.0.0 milestone Jul 21, 2014
@alrra alrra removed the new feature label Jul 22, 2014
eleanor-byhook pushed a commit to eleanor-byhook/html5-boilerplate that referenced this pull request Feb 29, 2016
The addition of the `/.editorconfig` file is made in order to
encourage and help developers and their teams define and maintain
consistent coding styles between their different editors and IDEs.

By default, `/.editorconfig` includes some basic properties that
reflect the coding styles from the files provided by default, but
users can easily change them to better suit their needs.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Since users need to install a editor/IDE plugin in order for the
properties from the `/.editorconfig` to be applied, we were reluctant
to add this file in the past (see: h5bp/html5-boilerplate#1124).
Nowadays however, the EditorConfig project provides plugins for most
of the popular editors/IDEs (see: http://editorconfig.org/#download),
plus, more and more developers are using it.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Ref: http://editorconfig.org/

Close: h5bp/html5-boilerplate#1561
       h5bp/html5-boilerplate#1564
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

Successfully merging this pull request may close these issues.