-
feat(devkit): add NX_SKIP_FORMAT environment variable to skip Prettier formatting (#34336)
发布于
2026-02-18 14:56:43 +00:00 Current Behavior
When running generators or migrations, Nx automatically skips Prettier
formatting if no root Prettier config is detected (added in #30426).
However, there's no way to explicitly skip Prettier formatting when a
config IS present but the user wants to bypass it for specific
operations.This can be needed when:
- When running something like Oxfmt that may treat prettier slightly
differently, even with the same config (this is the main thing I ran
into) - Running migrations where Prettier reformatting causes unintended side
effects (e.g., breakingeslint-disablecomments) - Temporarily disabling formatting for debugging purposes
- Using a formatter that coexists with Prettier in the workspace but
should take precedence for certain files
Expected Behavior
Users can set
NX_SKIP_FORMAT=trueto explicitly skip Prettier
formatting in generators and migrations, regardless of whether Prettier
is configured. TSConfig path sorting (controlled by
sortRootTsconfigPathsorNX_FORMAT_SORT_TSCONFIG_PATHS) continues to
work independently.NX_SKIP_FORMAT=true nx migrate --run-migrations NX_SKIP_FORMAT=true nx g @nx/react:app my-appRelated Issue(s)
Related to #30403 and #30426. This enhancement adds explicit user
control for cases where auto-detection of Prettier configuration isn't
sufficient.下载附件
- When running something like Oxfmt that may treat prettier slightly