nx
nx copied to clipboard
nx format:write triggers eslint vs prettier battle
Current Behavior
When nx format:write is triggered, nx.json and typescript.base.json get reformatted. Mainly it seems to be an issue on who decides how arrays are formatted.

Expected Behavior
nx.json and typescript.base.json should not get reformatted.
Steps to Reproduce
create a nx workspace with eslint and prettier run nx format:write
Failure Logs
Environment
Node : 16.14.2 OS : win32 x64 yarn : 1.22.4
nx : 14.6.4 @nrwl/angular : Not Found @nrwl/cypress : 14.6.4 @nrwl/detox : Not Found @nrwl/devkit : 14.6.4 @nrwl/eslint-plugin-nx : 14.6.4 @nrwl/express : Not Found @nrwl/jest : 14.6.4 @nrwl/js : 14.6.4 @nrwl/linter : 14.6.4 @nrwl/nest : 14.6.4 @nrwl/next : Not Found @nrwl/node : 14.6.4 @nrwl/nx-cloud : Not Found @nrwl/nx-plugin : Not Found @nrwl/react : Not Found @nrwl/react-native : Not Found @nrwl/schematics : Not Found @nrwl/storybook : Not Found @nrwl/web : Not Found @nrwl/workspace : 14.6.4 typescript : 4.7.4
Local workspace plugins:
Community plugins: @nx-plus/vue: 14.1.0
nx format uses prettier under the hood. Does running prettier manually do the same thing? If so, the behavior isn't something that we determine.
In my case, the same two files mentioned here are output by the CLI, but it doesn't actually change them:
% nx format:check
% npx prettier . --check
Checking formatting...
All matched files use Prettier code style!
% nx format:write
nx.json
tsconfig.base.json
% npx prettier . --check
Checking formatting...
All matched files use Prettier code style!
% git status
On branch main
Your branch is up to date with 'origin/main'.
nothing to commit, working tree clean
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.