azz / prettier-tslint

Code ➡️ prettier ➡️ tslint --fix ➡️ Formatted Code ✨
https://npm.im/prettier-tslint
MIT License
225 stars 13 forks source link

Usage of `.prettierrc` breaks the tslint rules like single quote #28

Open rambabusaravanan opened 5 years ago

rambabusaravanan commented 5 years ago

What happens if I use ".prettierrc" file

PROBLEM Some of the rules configured bytslint.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

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

aleclarson commented 5 years ago

Have you tried using tslint-config-prettier?

rambabusaravanan commented 5 years ago

Not yet .. Thanks and will try this ..