-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
tools: Added .editorconfig file for basic encoding/indentation enforcement #2993
Conversation
@@ -0,0 +1,22 @@ | |||
# See: http://EditorConfig.org |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd remove that comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 on removing that
I'd add |
Why leave trailing whitespace in markdown files? |
That is an absolutely horrible syntax. But sure. |
ae3071b
to
13215f4
Compare
@@ -0,0 +1,24 @@ | |||
root = true | |||
|
|||
[*] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm personally confused as to when to use *
and **
. In the hello world style example on http://editorconfig.org they show [*]
as a sort of default setting for all files, but they also explain how * does not include slashes. So wouldn't that mean that this rule will match only files in the root dir? That would be a very odd default, so I must be mistaken. I just can't find an explanation for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's the thing that confuses me too about editorconfig. I think *
is fine for a catch-all, but you should double check if the correct files match with the CLI tool.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ronkorving this works because patterns without a slash are equivalent to **/pattern
(essentially matching in the root directory and all child directories). If you need to match something specifically in the root, add an initial slash like /*
(which will only match top-level files). We modeled this after the way globs work in .gitignore
.
does atom editor care about that file? |
@reqshark if you install the plugin for it, it will |
cool |
@reqshark I'm using Atom too, and that's the primary reason for wanting to see a .editorconfig file included in the project (since it doesn't have "project settings" or anything, which in a way is actually great). |
|
||
[test/*.py] | ||
indent_style = space | ||
indent_size = 4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.py files have two space indent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might as well put the 2-space indent into *
and use sections for files that differ.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1. Can we match configure here as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jbergstroem configure's indentation is all over the place tbh, but I don't mind adding it.
2 space indent?
Another addition: |
indent_style = space | ||
indent_size = 4 | ||
|
||
[Makefile] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you end up moving indent_size = 2 to *, can you add 8 here? (Ok, call me a unix beard but it's at least relatively default in make-land)
ping @ronkorving |
@silverwind perhaps *.bat should be CRLF? I've added that, but let me know if inappropriate or incomplete. |
1905416
to
3a7bc86
Compare
Hmm, not sure about that or if there even is a specific reason for CRLF in bat files, but we're somewhat inconsistent here thought most of these are in deps:
|
Looks like we'd want to exclude |
Looks Would a line-ending conversion mess up git history? |
3a7bc86
to
e6c421d
Compare
I've changed *.bat to vcbuild.bat |
end_of_line = crlf | ||
|
||
[*.{md,markdown}] | ||
trim_trailing_whitespace = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not trimming this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Someone mentioned before that end of line spaces can be used to enforce white lines iirc. I'm not a fan of the practice, but I think the only alternative to that is introducing <br>
tags into the content.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If that is the case, I am okay with that. @silverwind
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, trailing space to force a line break in markdown. Not a fan of it either, but we should leave that option available to collaborators.
Is it possible to exclude |
e6c421d
to
73d8b68
Compare
@silverwind I'm not aware of any way to do this, especially in .editorconfig |
|
This helps editors (see http://editorconfig.org/#download) to apply the right indentation and encoding rules to files by default.
45704ac
to
838b9cf
Compare
Prepended "tools: " ;) |
@ronkorving all lowercase in commit title please (unless you reference acronyms, variables, classes, etc). Also, keep it shorter than 51 characters. There's a commit style-guide here. |
We also usually write in the imperative form ("add" instead of "added") but it's not in the guide so I don't know if it's really a rule |
@targos its in the extended guide we link to. |
This helps editors (see http://editorconfig.org/#download) to apply the right indentation and encoding rules to files by default. PR-URL: #2993 Reviewed-By: Roman Reiss <[email protected]> Reviewed-By: Saúl Ibarra Corretgé <[email protected]>
Thanks! Landed in d63ccee with a conforming commit message. Please make sure to honor our commit message guidlines in the future. 😉 |
This helps editors (see http://editorconfig.org/#download) to apply the right indentation and encoding rules to files by default. PR-URL: #2993 Reviewed-By: Roman Reiss <[email protected]> Reviewed-By: Saúl Ibarra Corretgé <[email protected]>
This helps editors (see http://editorconfig.org/#download) to apply the right indentation and encoding rules to files by default. PR-URL: #2993 Reviewed-By: Roman Reiss <[email protected]> Reviewed-By: Saúl Ibarra Corretgé <[email protected]>
This helps editors (see http://editorconfig.org/#download) to apply the right indentation and encoding rules to files by default. PR-URL: #2993 Reviewed-By: Roman Reiss <[email protected]> Reviewed-By: Saúl Ibarra Corretgé <[email protected]>
This helps editors (see http://editorconfig.org/#download) to apply the right indentation and encoding rules to files by default. PR-URL: nodejs#2993 Reviewed-By: Roman Reiss <[email protected]> Reviewed-By: Saúl Ibarra Corretgé <[email protected]>
This helps editors (see http://editorconfig.org/#download) to apply the right indentation, end-of-line characters, and encoding rules to files of any type (extension) directly and without going through linters, etc. I can imagine some of the contents of this PR may need tweaking, so feedback is most appreciated.