Tslint: --force should silently ignore files not part of the project

Created on 1 Aug 2018  ยท  5Comments  ยท  Source: palantir/tslint

Bug Report

  • __TSLint version__: 5.11.0
  • __TypeScript version__: 3.0.1
  • __Running TSLint via__: cli / pre-commit hook

TypeScript code being linted

There is no code in particular.

We invoke tslint as part of our pre-commit hook with the following options:

tslint --project . --format verbose --fix --force $FILES

Which then gives a non-0 return code with the following error:

'$FILE.ts' is not included in project.

The file in question is excluded via the tsconfig exclude option.

Actual behavior

The command returns a non-0 code, even though --force is specified

Expected behavior

--force should always succeed, no matter what.

Documentation Needs Proposal ๐ŸŒน R.I.P. ๐ŸŒน

Most helpful comment

Hm, I need --project to support typechecking-dependent rules. And since I integrated tslint with prettier, --fix is run as part of the pre-commit hook to also correctly format all the code.
The way the pre-commit hook works, I am not sure I can avoid passing in the list of changed files.

All 5 comments

@Swatinem you should not use --project . _and_ files. use one or the other. not surprised there's an error if you pass files not included in the project, as the project takes precedence.

Hm, I need --project to support typechecking-dependent rules. And since I integrated tslint with prettier, --fix is run as part of the pre-commit hook to also correctly format all the code.
The way the pre-commit hook works, I am not sure I can avoid passing in the list of changed files.

Perhaps we should have better documentation here.

๐Ÿ’€ _It's time!_ ๐Ÿ’€

TSLint is being deprecated and no longer accepting pull requests for major new changes or features. See #4534. ๐Ÿ˜ฑ

If you'd like to see this change implemented, you have two choices:

  • Recommended: Check if this is available in ESLint + typescript-eslint โœ…
  • _Not Recommended: Fork TSLint locally_ ๐Ÿคทโ€โ™‚๏ธ

๐Ÿ‘‹ It was a pleasure open sourcing with you!

_If you believe this message was posted here in error, please comment so we can re-open the issue!_

๐Ÿค– Beep boop! ๐Ÿ‘‰ TSLint is deprecated ๐Ÿ‘ˆ _(#4534)_ and you should switch to typescript-eslint! ๐Ÿค–

๐Ÿ”’ This issue is being locked to prevent further unnecessary discussions. Thank you! ๐Ÿ‘‹

Was this page helpful?
0 / 5 - 0 ratings