Repository navigation
CLI: Keep main and eslint config edits to the lines they change - #36546
Closed
valentinpalkovic wants to merge 3 commits into
Closed
valentinpalkovic wants to merge 3 commits into
valentinpalkovic wants to merge 3 commits into
Conversation
setupAddonInConfig wrote recast's output as is, so adding an addon printed the new addons entry with recast's default indentation, for example 8 spaces in a tab-indented file. Run the project's formatter before writing, as the automigrations do. (cherry picked from commit f0f6ae3)
configureFlatConfig reprinted the whole config with recast, so adding the plugin re-indented every object in grommet's eslint.config.mjs (219 changed lines) and wrote a double-quoted import into a single-quoted file. Insert the import after the existing imports and the spread after the last array or argument item as text, in the file's quote style and layout, and run the project's formatter on the result. (cherry picked from commit fa9cf6d)
storybook add's edit of vue-dsfr's main.ts (no Prettier config, only an .editorconfig) rewrote 79 lines with Prettier's default quotes and semicolons, and gutenberg's lost wp-prettier's paren spacing on 66 lines. (cherry picked from commit d6f2573)
Contributor
1 of 9 tasks
valentinpalkovic
marked this pull request as ready for review
October 1, 2026 14:19
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.
Closes #
What I did
storybook addand the eslint plugin setup restyle whole config files when they only add one entry.This PR keeps each edit to the lines it changes.
storybook addwrote recast's output as is, which collapsed grommet's multi-lineaddonsarray into one line and indented spartan's tab-indentedmain.tswith 8 spaces. It now formats its edit withformatExistingFile, which uses the Prettier the project installed and the project's Prettier config, and leaves the edit as printed when the project has none.formatFileContentis not used here, because its fallback to Prettier's defaults for an.editorconfigrestyled vue-dsfr'smain.ts(79 lines, with default quotes and semicolons) and gutenberg's (66 lines lost wp-prettier's paren spacing).eslint.config.mjschanges by 3 lines instead of 219.Split out of #36476, which collected the bugs that running
storybook upgradeagainst ten open-source Storybook 10 monorepos turned up onnext.Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
Caution
This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!
npx storybook@<canary> upgrade --yes --config-dir storybook.eslint.config.mjsgains only the plugin import and one spread.storybook/main.jskeeps its multi-lineaddonsarray.npx storybook@<canary> add @storybook/addon-a11yand confirmgit diffonmain.tsshows only the added addon.Documentation
MIGRATION.MD
Checklist for Maintainers
When this PR is ready for testing, make sure to add
ci:normal,ci:mergedorci:dailyGH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found incode/lib/cli-storybook/src/sandbox-templates.tsDeclare whether manual QA will be needed for this PR during the next release, through
qa:neededorqa:skipMake sure this PR contains one of the labels below:
Available labels
bug: Internal changes that fixes incorrect behavior.maintenance: User-facing maintenance tasks.dependencies: Upgrading (sometimes downgrading) dependencies.build: Internal-facing build tooling & test updates. Will not show up in release changelog.cleanup: Minor cleanup style change. Will not show up in release changelog.documentation: Documentation only changes. Will not show up in release changelog.feature request: Introducing a new feature.BREAKING CHANGE: Changes that break compatibility in some way with current major version.other: Changes that don't fit in the above categories.🤖 Generated with Claude Code