-
Notifications
You must be signed in to change notification settings - Fork 22
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
Add prettier to autoformat source, docs, and config #207
Conversation
.vscode/extensions.json
Outdated
@@ -4,6 +4,6 @@ | |||
"csstools.postcss", | |||
"bradlc.vscode-tailwindcss", | |||
"svelte.svelte-vscode", | |||
"silvenon.mdx" | |||
"unifiedjs.vscode-mdx" |
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.
Ah, I assume silvenon.mdx
is now deprecated?
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.
Yup, this is the new one
@@ -35,3 +35,41 @@ More detailed docs exist on [the storybook](https://www.viam.com/prime). | |||
Linked below are some articles that provide knowledge for how to best build reusable, generic web components. | |||
|
|||
- [Custom Elements Best Practices](https://web.dev/custom-elements-best-practices/) | |||
|
|||
## Development tasks |
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.
🎉
</script> | ||
|
||
<div class='relative w-full'> | ||
<div class="relative w-full"> |
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.
Suggestion: Since we're interspersing JS + HTML here could we have prettier using single quotes for everything? I'd rather not have to mentally switch between the two in the same file.
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.
Definitely agree, and attempted to do so by setting jsxSingleQuote
to true
, but ran right into sveltejs/prettier-plugin-svelte#253.
Options, depending on how much we care about this:
- Live with it until issue is resolved
- Don't format
.svelte
files until issue is resolved - Ditch the PR 😭
In my personal experience working in projects that used '
in JS and "
in JSX, I stopped thinking about it quite quickly once "format on save" was turned on, but YMMV
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 cool with 1., my only rec would be to link sveltejs/prettier-plugin-svelte#271 somewhere in the eslint config so that we don't forget to track
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.
Cool! Are you planning on replicating in APP and RDK next?
Overview
After a very scientific poll in Slack with four 👍's and no 👎's, this PR adds prettier to this repository. I attempted to follow the config found in the
eslint
settings, the source itself, and viamrobotics/viam-typescript-sdk.I also added some brief usage instructions for development tasks/scripts to
CONTRIBUTING.md
.Change log
This PR is split into
threevarious commits to aid reviewing:npm run format
If helpful, I can split these changes into multiple PRs.
Test plan
Given automated tests in place (though they're a bit flaky on my machine; requiring increased timeouts for the code editor tests), I think giving Storybook a quick visual comparison to prod should be pretty good here.
You may notice that the browser table in the README is broken in Storybook. This an existing issue on the site due to Storybook v7 dropping GFM by default, and not caused by this PR.