-
Notifications
You must be signed in to change notification settings - Fork 889
[quotemark: backtick] Incorrectly flags string literals that must use single/double quotes #4514
Comments
There may be some other situations I missed, but these are the ones I've noticed. |
Thanks for filing this @ericbf! It should be a small change to the quotemark rule to not check a |
Bug Report
TypeScript code being linted
with
Actual behaviorThe string literal in the import is flagged (and changed to backticks on save). The string in the title prop on SEO component is changed to double quotes. Typescript defaults to double quotes in JSX possibly. Expected behaviorAll instances of single or double quotes should be changed to backticks, with the exception of import statements. Source Code |
Some additional cases: // Obviously use strict can't use backticks
'use strict'
// Enum values can't have backticks around them
enum Sides {
'<- Left',
'Right ->'
}
// Octals are not allowed in template strings and
// Typescript will turn them into invalid hex escapes
const octal = '\117\103\124\101\114' |
@jpidelatorre please file a new issue (use the template) for additional bugs, thanks |
@jpidelatorre @adidahiya created #4692 for those cases and another I found (lookup types). |
@ericbf Thanks a lot. I had forgotten about that. |
Bug Report
TypeScript code being linted
with
tslint.json
configuration:Actual behavior
The string literal in the import is flagged (and changed to backticks if --fix is enabled). The string in the object key is flagged (and changed to backticks if --fix is enabled). These changes break the syntax as typescript requires that those strings be strictly string literals (double or single quoted strings, according to the grammar), not no-template literals.
Expected behavior
As the instances of double quotes are all required by the language, there should be no flags by tslint in the above excerpt.
The text was updated successfully, but these errors were encountered: