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.
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 :-
"
"
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
}
}
]
}
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 (sincemaster
).