Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
rambabusaravanan opened this issue Jan 8, 2019 · 2 comments
Open
Labels

Comments

@rambabusaravanan
Copy link

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

  • printWidth which is configured in .vscode/settings.json.
  • "max-line-length": [true, 120] which is configured in tslint.json

Hence as a workaround, we are using .prettierrc file as suggested in #15 (comment) but this breaks some of the tslint.json rules as explained

@aleclarson aleclarson added the bug label Jan 8, 2019
@aleclarson
Copy link
Collaborator

Have you tried using tslint-config-prettier?

@rambabusaravanan
Copy link
Author

Not yet ..
Thanks and will try this ..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants