nx icon indicating copy to clipboard operation
nx copied to clipboard

nx format:write triggers eslint vs prettier battle

Open sschneider-ihre-pvs opened this issue 3 years ago • 2 comments

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. image

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

> NX Report complete - copy this into the issue template

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

sschneider-ihre-pvs avatar Sep 06 '22 08:09 sschneider-ihre-pvs

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.

AgentEnder avatar Sep 11 '22 18:09 AgentEnder

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

curthipster avatar Sep 21 '22 14:09 curthipster

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.

github-actions[bot] avatar Mar 21 '23 17:03 github-actions[bot]