Reputation: 9253
I'm working on a medium sized Angular 4 project which uses TSLint.
Every time I run the lint command with npm run lint
(which uses ng lint
) I see a warning in the command line:
Warning: The 'no-use-before-declare' rule requires type checking
I've tried to enable type-checking by adding the --type-check
and --project path/to/the/tsconfig.json
file which is apparently "all you need to do"™, but whatever I do, the warning is still shown in the console (as if the flags are not having any effect).
There are no lint issues in the project, regardless of whether I use the --type-check
and --project
flags or not.
Is type-checking being enabled? Should the warning go away?
The problem is with passing the flags from the command-line to the ng lint
command:
If I run the command on the command line like this:
npm run lint --type-check --project tsconfig.json
Then I still see the warning on the command line. If I update the command in the package.json to this:
"lint": "ng lint --type-check --project tsconfig.json",
Then the warning message is not shown in the console, and I get a couple of extra lints.
Upvotes: 4
Views: 3283
Reputation: 1088
A quick update to this answer:
TSlint outputs now
--type-check is deprecated. You only need --project to enable rules which need type information.
when using --type-check.
Upvotes: 2
Reputation: 9253
The problem was only with passing flags from command line to the ng lint
command. I fixed it using this command from the command line:
npm run lint -- --type-check
Just needed the extra --
to pass the flag through correctly
Upvotes: 5