jonasmerlin / astro-seo

Makes it easy to add information that is relevant for SEO to your Astro app.
MIT License
933 stars 50 forks source link

Standard Formatting #29

Closed justinnoel closed 1 year ago

justinnoel commented 2 years ago

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.

jonasmerlin commented 2 years ago

@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?

justinnoel commented 2 years ago

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

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

jonasmerlin commented 2 years ago

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

jonasmerlin commented 1 year ago

@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.