ContextInstitute / bfcom

http://bfn.context.org
GNU General Public License v3.0
4 stars 1 forks source link

Use editorconfig for tabs versus spaces, etc. #25

Closed iangilman closed 5 years ago

iangilman commented 5 years ago

https://editorconfig.org/

Of course we'll have to agree on what settings to use. Looks like WordPress uses tab indents that are four spaces wide. Looks like Foundation uses space indents that are two spaces wide. We can actually support that if we want like so:

# EditorConfig: http://editorconfig.org

root = true

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

[*.{css,scss}]
indent_style = space
indent_size = 2

But we can also standardize on tab/4 all the way across (and just reformat the existing CSS to match). That might be better so we don't get confused as we go from file to file.

rgilman commented 5 years ago

It might be helpful to look at the sample WP .editorconfig files available from here:

# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org

# WordPress Coding Standards
# https://make.wordpress.org/core/handbook/coding-standards/

root = true

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

[{.jshintrc,*.json,*.yml}]
indent_style = space
indent_size = 2

[{*.txt,wp-config-sample.php}]
end_of_line = crlf

and here:

# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org

# WordPress Coding Standards
# https://make.wordpress.org/core/handbook/coding-standards/

root = true

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

[*.yml]
indent_style = space
indent_size = 2

[*.md]
trim_trailing_whitespace = false

Looks like others also have some 4-space and some 2-space - but of course we can do as we like.

rgilman commented 5 years ago

I just looked at buddypress.css (/wp-content/plugins/buddypress/bp-templates/bp-nouveau/css/buddypress.css) and it uses:

indent_style = tab
indent_size = 4

I expect we will be working a lot more with the bp-nouveau files than with the foundation files so I lean toward sticking with tab/4 for css and scss.

BTW, the files in /wp-content/plugins/buddypress/bp-templates/bp-nouveau/common-styles are all scss.

iangilman commented 5 years ago

Sticking with tab/4 throughout is probably the least confusing, so I'm in favor of that.

BTW, I'm seeing trim_trailing_whitespace = true in the ones you shared… I generally use that, but I'm seeing a lot of trailing white space in the existing code, which means at least our first pull requests in each file will have a lot of extra noise due to the trimming. The least messy would be to just leave that feature off for now.

rgilman commented 5 years ago

@iangilman, please take the raw material from this issue and create an editorconfig for us to use