Repository navigation
feat(stylistic): move prettier/prettier into an opt-in stylistic/prettier config - #212
Merged
Merged
Conversation
…ttier config Running Prettier as a lint rule formats every file again inside ESLint; in webpack it was ~26% of a cold run. The recommended configs no longer include it. The README explains running Prettier on its own with the shared options, and stylistic/prettier restores the old behavior. This repository now checks its own formatting with `prettier --check`.
🦋 Changeset detectedLatest commit: d7e85f5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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.
Summary
Every recommended preset runs Prettier as a lint rule (
prettier/prettierfromstylistic/recommended), so ESLint formats every file again. It is the most expensive rule we have; on a cold ESLint run over the webpack repo (TIMING=all):prettier/prettierProjects that also run
prettier --checkpay for it twice. Prettier's own docs recommend running it separately and formatting on save in the editor.This PR:
prettier/prettierfromstylistic/recommended, so from every recommended preset;stylistic/prettierconfig, which restores the old behavior;prettier-config.js;prettier --check(fmt:check, now part oflint).stylistic/recommendedspreadeslint-plugin-prettier/recommendedand then replaced itsrules, so only the plugin andprettier/prettierwere ever active. Extendingconfigplusstylistic/prettiergives exactly the previous rule set.What kind of change does this PR introduce?
feat
Did you add tests for your changes?
Yes,
test/stylistic-prettier.test.js: no config in the default preset enablesprettier/prettier, andstylistic/prettierreports unformatted code. It fails without this change. I also checked the README setup (prettier.config.mjsre-exportingeslint-config-webpack/prettier-config.js) in a CommonJS project.Does this PR introduce a breaking change?
No. Released as a minor change, since this config is used internally by webpack projects. ESLint no longer reports formatting: run
prettier --check .in CI as the README shows, or extendconfigs["stylistic/prettier"]to keep the old behavior.If relevant, what needs to be documented once your changes are merged or what have you already documented?
Documented in the README's new "Prettier" section.
Use of AI
Claude Code measured the rule cost on webpack, split the config, wrote the docs and the test, and checked the documented setup. The author reviewed and directed the work.
🤖 Generated with Claude Code
https://claude.ai/code/session_01KRwzDhXwa4BrshnUFHE711