question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Linting should include type checking

See original GitHub issue

Current 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:open
  • Created 4 years ago
  • Reactions:7
  • Comments:8

github_iconTop GitHub Comments

1reaction
gustavopchcommented, May 1, 2020

@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 with tsc --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.

0reactions
gburnettcommented, May 1, 2020

The biggest issue here is that tsdx lint should continue to be able to receive the specific files as arguments so that it works with lint-staged

@gustavopch Is there a workaround for this at the moment?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found