Bijay Singh
Bijay Singh

Reputation: 849

WebStorm fixing all TSLint error is fixing all but one

In WebStorm my tslint.json of my Angular project contains following lines

"triple-equals": [
  true,
  "allow-null-check"
]

and whenever I give == comparison in my component.ts file, it shows the lint warning, along with other TSLint warnings and errors.

After clicking on "TSLint:Fix current File" it fix all issues but doesn't convert == to === and keeps displaying the warning that == should be ===.

Please advise how to fix this.

Upvotes: 0

Views: 1120

Answers (1)

lena
lena

Reputation: 93728

Not all TSLint rules are fixable, and, in particular, running tslint --fix doesn't fix "triple-equals" errors. This is done intentionally, I suppose, as, though using the strict equality operator is recommended in most cases, the abstract equality operator is sometimes handy due to its coercion capabilities (when a number comes as a string from ajax call, for example).

Anyway, it's not an issue with WebStorm; if you miss auto-fix for this rule, please feel free to file a request to https://github.com/palantir/tslint/issues

Upvotes: 1

Related Questions