codefactor-io/codefactor

[ESLint] CodeFactor does not see issues with non-existing import

Jxlle opened this issue · 5 comments

We are currently running CodeFactor as well as a GitHub action linter on our repository PR's to be sure that none of the two have problems. A recent PR gave issues on our linter action, but not on CodeFactor.

One of the rulesets that we use is the @typescript-eslint strict ruleset. It does not allow unsafe assignments (assignments of an any value).

Consider the following example scenario based on our observations:

  • nonExistingObject did exist in the test file in a previous version, but was removed in the version that is now checked by CodeFactor. The import and usage of the object has not been removed.
import { nonExistingObject } from ./test;

const obj = nonExistingObject;

This code is wrong because it uses a non-existing import. However, there is a discrepancy between the result of the linter action and CodeFactor. CodeFactor sees no issues, but the linter gives the following error:

Unsafe assignment of an any value (@typescript-eslint/no-unsafe-assignment)

which seems to be a fitting error as the object does not exist anymore, so TypeScript cannot infer a type.

Can this be fixed?

@Jxlle thank you, we'll investigate this.

@Jxlle I've created sample repo to test this false negative - https://www.codefactor.io/repository/github/cordis-dev/cf-65-ts-import-issue/issues - and it seems that @typescript-eslint/no-unsafe-assignment issue being reported correctly.

If you have a private repo could you provide repo name and and PR number to https://www.codefactor.io/contact? Then we'll be able check this further.

Yes it's private. I'll send an email, thanks!

@cordis-dev I sent an email to your helpdesk with further information :)

Great, thank you!