Linting should include type checking
See original GitHub issueCurrent Behavior
const wrong = parseInt(8);
npm run lint
reports no problem with this (which is strange, usually should require a second radix param, but this is not important right now)
Desired Behavior
Linting should run tsc --noEmit
to catch that Argument of type '8' is not assignable to parameter of type 'string'
error
Suggested Solution
Run tsc --noEmit
followed by eslint
Who does this impact? Who is this for?
VS Code users (maybe others as well). If file is not open there is no way to get an error report from it, except building
Issue Analytics
- State:
- Created 4 years ago
- Reactions:7
- Comments:8
Top Results From Across the Web
Linting should include type checking · Issue #352
Normally you get type checking in the files open in an editor and then have either a tsc watch process or run it...
Read more >Linting with Type Information | typescript-eslint
We strongly recommend you do use type-aware linting, but the above information is included so that you can make your own, informed decision....
Read more >Linting and Type Checking
We provide a typecheck script in our starters that you can run to check both your stacks and backend code. This just runs...
Read more >Type Checking
Some TSLint rules go further than linting code syntax. Semantic rules use the compiler's program APIs to inspect static types and validate code...
Read more >JavaScript Type Linting
There are three ways to have Visual Studio Code type lint JavaScript: ... This will enable type checking for any JavaScript file you...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@gburnett First, upvote https://github.com/microsoft/TypeScript/issues/27379 to show interest in an official solution from the TypeScript maintainers.
So, yes, there’s a workaround. I started to write it: https://github.com/gustavopch/tsc-files. But, as I mentioned in the “Edit” section of my comment above, type-checking the files that were changed is not enough — we should also type-check all files that depend on the changed ones.
Currently,
tsc-files
won’t do that, so I’m not even using it in my projects (I’m just type-checking the whole project withtsc --noEmit
). I’ve opened an issue describing the problem and proposing a possible solution: https://github.com/gustavopch/tsc-files/issues/6. A PR would be welcome.@gustavopch Is there a workaround for this at the moment?