3.15.12.0.3src/foo.ts and src/bar.ts and create a tsconfig.json which compiles src/.Creating a lint issue in both files (e.g., set semicolon rule to always then omit a semicolon, but this can be any lint issue).
Run tslint --project tsconfig.json src/foo.ts
src/foo.tstslint --project tsconfig.json --type-check src/foo.tstslint should only show issues in src/foo.ts, if that is what is specified
It appears from tslint-cli.ts that the files argument is ignored when --type-check is provided.
Based on the current code, I'd like to see a message saying that the files input is being ignored, or (ideally) it should filter the TypeScript program input to only compile the specified files.
I suspect this can be fixed by filtering parsed.fileNames from MultiLinter#createProgram to only include the specified files, if any are specified
Alternatively ts.getPreEmitDiagnostics() accepts an optional SourceFile parameter, which will keep the complexity limited to tslint-cli
This issue is important because --type-check requires --project to be set. I would like to be able to specify files to lint even while using type-checked lint rules.
I also noticed that --project seems to exclude .d.ts files from linting.
+1
I have to use --type-check --project for some rules. This causes my file options to be ignored, therefore my node_modules folder is being parsed. At the very least, indicate that the file option is ignored when using --type-check. This behavior is very annoying.
Recent versions of tslint no longer ignore the specified files and excludes when using --project --type-check. Only errors from type checking are not filtered, because the whole project need to be checked at once.
Since --type-check is no longer necessary to use rule that require type information, I think this issue can be closed.
Most helpful comment
Recent versions of tslint no longer ignore the specified files and excludes when using
--project --type-check. Only errors from type checking are not filtered, because the whole project need to be checked at once.Since
--type-checkis no longer necessary to use rule that require type information, I think this issue can be closed.