Tslint: Suggestion: running "tslint" should run "tslint --project tsconfig.json"

Created on 19 May 2017  路  5Comments  路  Source: palantir/tslint

Currently running tslint on the command line just prints the options and shows "Missing files".
I figure most people simply intend to run the linter on all files in their project. Wouldn't it make sense to have tslint do that by default?

Hard Accepting PRs Breaking Change Enhancement 馃尮 R.I.P. 馃尮

Most helpful comment

Do we also need the "continuing up the parent directory chain" part?

Yes, I think it's best to align with tsc as much as possible.

All 5 comments

This would also make it consistent with tsc, where the --project flag is optional:

The presence of a tsconfig.json file in a directory indicates that the directory is the root of a TypeScript project. [鈥 By invoking tsc with no input files, in which case the compiler searches for the tsconfig.json file [鈥 - https://www.typescriptlang.org/docs/handbook/tsconfig-json.html

Just to make sure I understand this correctly: We default to --project tsconfig.json only if there are not files specified.
Other options like --format, --config or --exclude don't affect this proposed behavior.

invoking tsc with no input files, in which case the compiler searches for the tsconfig.json file starting in the current directory and continuing up the parent directory chain.

Do we also need the "continuing up the parent directory chain" part?

We default to --project tsconfig.json only if there are not files specified.

Yes:

When input files are specified on the command line, tsconfig.json files are ignored.
- https://www.typescriptlang.org/docs/handbook/tsconfig-json.html

Do we also need the "continuing up the parent directory chain" part?

Yes, I think it's best to align with tsc as much as possible.

By now, this is out of scope. 馃樋 See #4534.

Was this page helpful?
0 / 5 - 0 ratings