codefactor-io / codefactor

Automated static analysis for C#, C++, Java, CSS, JS, Go, Python, Ruby, TypeScript, Scala, CoffeeScript, Groovy, C, SCSS, Less, PHP, Dockerfile, Bash, YAML and Swift.
https://www.codefactor.io
62 stars 31 forks source link

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

Closed Jxlle closed 8 months ago

Jxlle commented 8 months ago

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:

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?

cordis-dev commented 8 months ago

@Jxlle thank you, we'll investigate this.

cordis-dev commented 8 months ago

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

Jxlle commented 8 months ago

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

Jxlle commented 8 months ago

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

cordis-dev commented 8 months ago

Great, thank you!