astro-seo icon indicating copy to clipboard operation
astro-seo copied to clipboard

Standard Formatting

Open justinnoel opened this issue 3 years ago • 3 comments

Would you be willing to accept a PR for adding either a Prettier configuration or editorconfig for this project?

Either would make it much easier for others to contribute without constantly making changes to the spaces, tabs, etc.

I'd be happy to submit a PR using either based on your preferences. I personally prefer prettier, but it does require more tooling on the developer side. Most IDEs are already 100% aware and compliant with editorconfig.

May I suggest these configurations based on your existing code:

Prettier

{
	"printWidth": 80,
	"semi": true,
	"singleQuote": false,
	"trailingComma": "all",
	"useTabs": true
}

editorconfig

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

root = true

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

[*.{astro,js,jsx,ts,tsx}]
quote_type = double

NOTE: In each, I have use tabs as the indentation vs spaces. Tabs have some significant accessibility benefits over spaces. Also, I used double quotes as your code already seems to have them.

P.S. editorconfig does not officially recognizequote_type but many IDEs respect this setting.

justinnoel avatar Nov 17 '21 12:11 justinnoel

@justinnoel Sorry I didn't see this sooner, there really seems to something wrong with my GitHub notification settings as I didn't get a notification for this. I would be very happy to accept a PR for this! Would it make sense to have both configs?

jonasmerlin avatar Nov 29 '21 09:11 jonasmerlin

@jonasmerlin Ugh.... I took forever to get back to this.

It's really best to only choose .editorconfig OR Prettier.

justinnoel avatar Dec 06 '21 12:12 justinnoel

@justinnoel Alright, then let's go with Prettier I'd say!

jonasmerlin avatar Dec 06 '21 12:12 jonasmerlin

@justinnoel Runnign npm run format formats files according to the astro rules by now. So I'll close this issue. If you're missing something, feel free to reopen.

jonasmerlin avatar Jan 16 '23 12:01 jonasmerlin