forked from palantir/tslint
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add "backtick" option for quotemark (palantir#4029)
This lets users enforce only backtick "`" strings for everywhere that it's permissible. This also simplifies some logic in the preferred quote determination, combining some disparate logic into the nice self-packaged functions. > See palantir#539 > The corresponding option in eslint is called "backtick": http://eslint.org/docs/rules/quotes > See https://ponyfoo.com/articles/template-literals-strictly-better-strings
- Loading branch information
1 parent
3cb1691
commit 559d880
Showing
4 changed files
with
120 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
var single = `single`; | ||
var double = `married`; | ||
var singleWithinDouble = `'singleWithinDouble'`; | ||
var doubleWithinSingle = `"doubleWithinSingle"`; | ||
var tabNewlineWithinSingle = `tab\tNewline\nWithinSingle`; | ||
`escaped'quotemark`; | ||
|
||
// "avoid-template" option is not set. | ||
`foo`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
var single = 'single'; | ||
~~~~~~~~ [' should be `] | ||
var double = "married"; | ||
~~~~~~~~~ [" should be `] | ||
var singleWithinDouble = "'singleWithinDouble'"; | ||
~~~~~~~~~~~~~~~~~~~~~~ [" should be `] | ||
var doubleWithinSingle = '"doubleWithinSingle"'; | ||
~~~~~~~~~~~~~~~~~~~~~~ [' should be `] | ||
var tabNewlineWithinSingle = 'tab\tNewline\nWithinSingle'; | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [' should be `] | ||
'escaped\'quotemark'; | ||
~~~~~~~~~~~~~~~~~~~~ [' should be `] | ||
|
||
// "avoid-template" option is not set. | ||
`foo`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"rules": { | ||
"quotemark": [true, "backtick"] | ||
} | ||
} |