-
Notifications
You must be signed in to change notification settings - Fork 23
no-unnecessary-type-assertion
always errors
#200
Comments
Does it occur when you have "use local TSLint" turned on (assuming you have TSLint installed locally)? Or, what version of TSLint are you using on the command line? |
I have
(installed via |
The version of TSLint shipped with linter-tslint is currently 5.5.0 if i recall correctly. Could you downgrade to that and run again in command line? |
The command line don't complain with I removed a semicolon too to make sure that the file was linted properly, and it was. I'm invoking tslint as where
|
I've done some more digging here. I've verified that:
I've written a small testscript to lint my files with the library rather than the cli: "use strict";
var { Linter, Configuration } = require("tslint");
const program = Linter.createProgram("tsconfig.json");
const files = Linter.getFileNames(program);
const results = files.map(file => {
console.log("Linting", file);
const fileContents = program.getSourceFile(file).getFullText();
const configuration = Configuration.findConfiguration("tslint.json", "./src").results;
var options = {
fix: false,
formatter: "json"
};
const linter = new Linter(options, program);
linter.lint(file, fileContents, configuration);
return linter.getResult();
});
console.log(results.filter(r => r.errorCount > 0)); Which works correctly (it does not complain about the type assertion, but do complain if I put in a legitimate lint error; a missing semicolon). Any idea on how I can continue debug this? |
Are you saying that the bug does reproduce with the script you posted?
What steps did you take to verify this? |
Sorry for being unclear. My script does not give the I can see lintResult includes the error. Another thing I noticed is that I get the following error once for each Atom window: I have |
Fixed by #202 (see #202 (comment)). |
It seems like this rule (when enabled) always errors for any type assertion. Unnecessary or not:
This is not a problem when running
tslint
from terminal - which is odd because I can't see that anything special is med on a per-rule basis in this package.The text was updated successfully, but these errors were encountered: