prettier-tslint
prettier-tslint copied to clipboard
Usage of `.prettierrc` breaks the tslint rules like single quote
What happens if I use ".prettierrc" file
PROBLEM
Some of the rules configured by tslint.json are not working. One such example is below
/* tslint.json */
"rules": {
"quotemark": [true, "single", "jsx-double"]
},
PARTIAL WORKAROUND
As a workaround, we are using the below in .prettierrc and hence we cannot utilize 😭 more option like "jsx-double" which is best suited for react configured in tslint
/* .prettierrc */
{
"printWidth": 120, // workaround as 'printWidth' in settings.json / 'max-line-length' in tslint.json not working
"singleQuote": true // partial workaround as usage of '.prettierrc' breaks tslint.json
}
Why do I use ".prettierrc" file
Since I use prettier, tslint as vscode plugins, I prefer maintaining configuration in .vscode/settings.json
/* .vscode/settings.json */
{
"editor.formatOnSave": true,
"eslint.autoFixOnSave": true,
"prettier.eslintIntegration": true,
"prettier.printWidth": 120, // not working
"prettier.tslintIntegration": true, // enabled
"tslint.autoFixOnSave": true
}
All the rules working as per the configuration in tslint.json and .vscode/settings.json except
printWidthwhich is configured in.vscode/settings.json."max-line-length": [true, 120]which is configured intslint.json
Hence as a workaround, we are using .prettierrc file as suggested in https://github.com/azz/prettier-tslint/issues/15#issuecomment-445638360 but this breaks some of the tslint.json rules as explained
Have you tried using tslint-config-prettier?
Not yet .. Thanks and will try this ..