Add Prettier to keep things consistent#115
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.
Looks good, just some suggestions!
There was a problem hiding this comment.
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.
| - 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.
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.
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.
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.
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).