question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Single Quote and trailing comma rules conflict with tslint

See original GitHub issue

Related to #206

Project settings:

  1. tslint config has rule defined to wrap strings in single quotes and trailing comma enabled.
  2. This is my vscode user settings
{
  "tslint.autoFixOnSave": true,
  "editor.formatOnSave": true
}
  1. This is my prettier config:
export default {
  useTabs: false,
  printWidth: 80,
  tabWidth: 2,
  singleQuote: true,
  trailingComma: "all"
};

Issue:

  1. Saving the files toggle between double quotes and single quotes.
  2. Same for trailing comma also, saving once adds trailing comma, saving again removes it.
  3. If I remove the prettier config file and set the below configs in vscode user setting, then it works fine.
{
  "tslint.autoFixOnSave": true,
  "editor.formatOnSave": true,
  "prettier.singleQuote": true,
  "prettier.trailingComma": "all"
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

9reactions
dbuezascommented, Oct 12, 2018

I had the same problem, it seems like tslint fails to find the .prettierrc file.

explicitly telling it where it is in tslint.json worked:

{
 [...]
 "rules": {
    "prettier": [true, ".prettierrc"]
  }
}
0reactions
github-actions[bot]commented, Apr 13, 2020

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

trailing-comma - Rule
Rule : trailing-comma​​ Requires or disallows trailing commas in array and object literals, destructuring assignments, function typings, named imports and exports ...
Read more >
Why does prettier put the trailing comma on its own and give ...
"trailingComma": "es5" says that the trailing comma is invalid after the last property. "airbnb-base" might contain a rule which conflicts with ...
Read more >
comma-dangle - ESLint - Pluggable JavaScript Linter
Trailing commas simplify adding and removing items to objects and arrays, since only the lines you are modifying must be touched. Another argument...
Read more >
How to Configure ESLint and Prettier in an Angular Application
In this last part, we will talk about how to migrate from TSLint to ... that disable some ESLint rules to avoid conflicts...
Read more >
How to configure Prettier and VSCode - Gleb Bahmutov
Single quotes, no semi-colons, trailing commas. ... and some of these rules are stylistic, and can conflict with Prettier's style.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found