Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

no-invalid-template-strings should ignore backslash-prefixed template expressions #2738

Closed
RevanProdigalKnight opened this issue May 11, 2017 · 1 comment

Comments

@RevanProdigalKnight
Copy link

Bug Report

  • TSLint version: 5.1.0
  • TypeScript version: 2.2.2
  • Running TSLint via: grunt-tslint

TypeScript code being linted

new (Tab.mixins.Controlled('MemberComments',Tab.mixins.Templated('<div mbr-comment-tab=\${which}></div>',Tab.mixins.AlwaysHasData())))

with tslint.json configuration:

{
	"extends": "tslint:recommended",
	"rules": {
		// TSLint Options
		// Typescript-specific Rules
		"adjacent-overload-signatures": true,
		"no-internal-module": true,
		"no-magic-numbers": [true, -1, 0, 1, 2],
		"no-namespace": [true, "allow-declarations"],
		"only-arrow-functions": [true, "allow-declarations", "allow-named-functions"],
		"typedef-whitespace": [true, { "call-signature": "nospace", "index-signature": "nospace", "parameter": "nospace", "property-declaration": "nospace", "variable-declaration": "nospace" },{ "call-signature": "onespace", "index-signature": "onespace", "parameter": "onespace", "property-declaration": "onespace", "variable-declaration": "onespace" }],
		"unified-signatures": true,
		// Functionality Rules
		"curly": true,
		"forin": true,
		"label-position": true,
		"no-arg": true,
		"no-bitwise": false,
		"no-conditional-assignment": false,
		"no-console": true,
		"no-construct": true,
		"no-debugger": true,
		"no-duplicate-super": true,
		"no-duplicate-variable": true,
		"no-empty": true,
		"no-eval": true,
		"no-for-in-array": true,
		"no-invalid-template-strings": true,
		"no-invalid-this": true,
		"no-misused-new": true,
		"no-string-throw": true,
		"no-switch-case-fall-through": true,
		"no-unsafe-finally": true,
		"no-unused-expression": [true, "allow-fast-null-checks"],
		"no-unused-variable": [true],
		"no-shadowed-variable": false,
		"no-use-before-declare": true,
		"no-var-keyword": true,
		"radix": true,
		"restrict-plus-operands": true,
		"strict-type-predicates": true,
		"triple-equals": true,
		"typeof-compare": true,
		"use-isnan": true,
		// Maintainability Rules
		"cyclomatic-complexity": 20,
		"eofline": true,
		"indent": [true, "tabs"],
		"linebreak-style": [true, "LF"],
		"no-require-imports": true,
		"no-trailing-whitespace": true,
		"object-literal-sort-keys": true,
		"prefer-const": [true, { "destructuring": "all" }],
		"trailing-comma": false,
		// Style Rules
		"arrow-parens": [true, "ban-single-arg-parens"],
		"array-type": [true, "array"],
		"arrow-return-shorthand": true,
		"callable-types": true,
		"class-name": true,
		"comment-format": [true, "check-space"],
		"import-spacing": true,
		"interface-name": true,
		"interface-over-type-literal": true,
		"newline-before-return": true,
		"new-parens": true,
		"no-angle-bracket-type-assertion": false,
		"no-unnecessary-callback-wrapper": true,
		"no-unnecessary-qualifier": true,
		"object-literal-key-quotes": [true, "as-needed"],
		"object-literal-shorthand": true,
		"one-line": [true, "check-catch", "check-finally", "check-else", "check-open-brace"],
		"one-variable-per-declaration": false,
		"prefer-method-signature": true,
		"quotemark": [true, "single", "avoid-escape"],
		"semicolon": true,
		"variable-name": [true, "check-format", "allow-leading-underscore", "allow-pascal-case", "ban-keywords"],
		"whitespace": false
	}
}

Actual behavior

>> ERROR: src/main/ts/padss-main/tabs.ts[423, 90]: Interpolation will only work for template strings.

Expected behavior

The rule should ignore the template replacement expression because the developer has already acknowledged that they realize this is not a template string by adding the preceding \.

Even if it were a template string, adding the preceding \ causes the template expression to be ignored in the template string anyways.

@aervin
Copy link
Contributor

aervin commented Aug 10, 2017

Haven't been able to find an open PR for this one so I'll give it a try.

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

No branches or pull requests

3 participants