besteadfast / carbon

Steadfast's starter project - Craft CMS, Vite, and DDEV
3 stars 2 forks source link

Add editorconfig #19

Closed jalendport closed 2 years ago

jalendport commented 2 years ago

An .editorconfig file is the first in a series of steps we need to make in the next couple months to ensure we maintain consistent coding styles regardless of what settings we each use in our code editors. It only has a couple config options, with tabs vs spaces probably being the most controversial.

After considering the pros and cons of both, my opinion is we should use tabs for indentation. The biggest reason for this is that tab width can be customized per team member, unlike spaces. If we decide to indent with 4 spaces, it will show up as 4 spaces for everyone. If we decide to indent with tabs, I can decide I like my tabs to be 4 spaces wide, but you can customize them to be 2 spaces wide in your editor if you prefer less indentation - at the end of the day it's just a tab character in the file...

Customizing your tab width

I've purposely not set the indent_size/tab_width in the .editorconfig so we're able to adjust this according to our personal preference.

Vscode:

Text EditorTab Size

image

GitHub:

SettingsAppearanceTab size preference

image
jakedohm commented 2 years ago

LGTM