-
Notifications
You must be signed in to change notification settings - Fork 7
Add Prettier to keep things consistent #115
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
Conversation
|
|
The check seems to work on CI 👍 I'll rebase this and commit the result of running |
90dd405 to
8dac805
Compare
shirakaba
left a comment
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.
Looks good, just some suggestions!
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.
This seems to do the trick. I've tried entering various gitignored folders with "format on save" enabled and it successfully ignores them. It seems node_modules is implicitly ignored as well. 👍
I'm hoping to get permission to opensource a tool I made at work that flattens all .gitignores under a tree into a single one – I made it specifically to support Prettier, which has spent years neglecting monorepo support. But let's not wait on that.
| - run: npm run lint | ||
| - run: npm run prettier:check |
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.
| - run: npm run lint | |
| - run: npm run prettier:check | |
| - run: node --run lint | |
| - run: node --run prettier:check |
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 plan to do a separate PR to update npm run across the repo 👍 Especially when calling other scripts within scripts.
package.json
Outdated
| "eslint": "^9.19.0", | ||
| "eslint-config-prettier": "^10.1.5", | ||
| "globals": "^16.0.0", | ||
| "prettier": "3.5.3", |
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.
Let's upgrade this to Prettier 3.6 (see blog post).
package.json
Outdated
| "prettier:check": "prettier --check .", | ||
| "prettier:write": "prettier --write .", |
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.
From Prettier 3.6, we can use the performance-improved CLI.
| "prettier:check": "prettier --check .", | |
| "prettier:write": "prettier --write .", | |
| "prettier:check": "prettier --experimental-cli --check .", | |
| "prettier:write": "prettier --experimental-cli --write .", |
.prettierrc
Outdated
| @@ -0,0 +1 @@ | |||
| {} | |||
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'd suggest renaming to prettier.config.mjs for some Intellisense and adding @prettier/plugin-oxc for mad speed, which was announced alongside Prettier 3.6.
After running:
npm add -D prettier@latest @prettier/plugin-oxc| {} | |
| /** | |
| * @satisfies {import("prettier").Config} | |
| * @see https://prettier.io/docs/en/configuration.html | |
| */ | |
| const config = { | |
| plugins: ["@prettier/plugin-oxc"], | |
| }; | |
| export default config; |
Merging this PR will:
prettierCLI and two package scripts for the root package, one to check and one to write (/ fix).