Repository navigation
ci: make Prettier the only formatter and check formatting in CI - #220
Merged
Merged
Conversation
Member
Author
|
Review notes before merging:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Formatting had two owners.
.prettierrcandpnpm formatdescribe Prettier, while ESLint's stylistic rules, tuned to approximate Prettier, enforced a different layout in CI. They disagreed on Vue templates, quoted object keys, and long lines, so runningpnpm formatproduced code thatpnpm lintrejected, and six files had drifted from Prettier.Prettier now owns formatting and ESLint checks everything else:
eslint.config.mjsturns off Nuxt'sstylisticfeature, drops the overrides that imitated Prettier, and appendseslint-config-prettierto switch off the remaining formatting rules (vue/html-self-closing,vue/html-end-tags,unicorn/number-literal-case). Thenuxt.configkey order rule, which came withstylistic, is enabled explicitly so it keeps applying.no-unexpected-multilinestays enabled even thougheslint-config-prettierturns it off: this codebase omits semicolons, and the rule catches a new line that silently continues the previous statement, which Prettier would otherwise join into one plausible line. Theeslint-config-prettierCLI reports no conflicting rules for Vue, TypeScript, and JavaScript files.pnpm format:checkafter linting, so the requiredbuildchecks now cover formatting.pnpm-lock.yamlis in.prettierignorebecause pnpm writes it in its own format..eslintrcand.eslintrc.prettier.js, which ESLint 10 no longer reads, are removed along with.eslintprettier.config.js. Thelint:prettierscript that used it failed witheslintConfig is not iterable, soeslint-plugin-prettieris removed too.README.mdanddocs/CONTRIBUTING.mdlistpnpm format:checkwith the local checks.Comparing the enabled rules before and after, the only removals are formatting rules: 62
@stylisticrules, the Vue template layout rules,import/newline-after-import,jsdoc/check-alignment,jsdoc/multiline-blocks, andunicorn/number-literal-case. Without the stylistic preset, Nuxt's Vue config also enablesvue/one-component-per-fileandvue/require-default-prop, which pass.Validation: actionlint with shellcheck,
pnpm format:check,pnpm lint --max-warnings 0,pnpm test:types,pnpm dev:build,pnpm test(81 tests),pnpm test:package, the workspace playground build, andpnpm test:compatibilitypass.