Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Jxlle opened this issue Feb 28, 2024 · 5 comments
Closed

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

Jxlle opened this issue Feb 28, 2024 · 5 comments

Comments

@Jxlle
Copy link

Jxlle commented Feb 28, 2024

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?

@cordis-dev
Copy link
Contributor

@Jxlle thank you, we'll investigate this.

@cordis-dev
Copy link
Contributor

@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
Copy link
Author

Jxlle commented Feb 29, 2024

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

@Jxlle
Copy link
Author

Jxlle commented Feb 29, 2024

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

@cordis-dev
Copy link
Contributor

Great, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants