Nx: NrWl: nx format:write not doing any format

Created on 10 Sep 2019  路  3Comments  路  Source: nrwl/nx

I have simple nrwl project with few libs , using NrWl 8.
in package.json file I have script.
"format": "nx format:write"

I am running npm run format and getting below response - project file is not formatting at all.

nx format:write
NX NOTE Affected criteria defaulted to --base=master --head=HEAD
README.md 69ms

Please help do I need to configure something for this.

question / discussion

Most helpful comment

Hi @SWGeekPD, you can use nx format:write --all if you need to format all files. By default we only format changed files (since master).

All 3 comments

Hi @SWGeekPD, you can use nx format:write --all if you need to format all files. By default we only format changed files (since master).

Please let us know if you have any more problems.

@jaysoo it is working and I can format all the files.
Only one issue is html files are not formatting properly.

Example :-
" fxLayout="colomn"
fxLayoutAlign="start center"
fxFlex="30"
fxFlex.lt.sm="20"

"
Closing tags (>) are coming in the new line.
Another thing is I added below configuration in the .prettierrc file.

{
"overrides": [
{
"files": ".prettierrc",
"options": {
"parser": "json",
"useTabs": true,
"trailingComma": "none"
}
},
{
"files": ".ts",
"options": {
"parser": "typescript",
"tabWidth": 4,
"printWidth": 120,
"trailingComma": "es5",
"bracketSpacing": true,
"jsxBracketSameLine": true
}
},
{
"files": "
.md",
"options": {
"parser": "markdown",
"tabWidth": 2,
"proseWrap": "preserve"
}
},
{
"files": ".json",
"options": {
"parser": "json",
"useTabs": true,
"trailingComma": "none"
}
},
{
"files": "
.scss",
"options": {
"parser": "scss",
"tabWidth": 4
}
}
]
}

Was this page helpful?
0 / 5 - 0 ratings