-
-
Notifications
You must be signed in to change notification settings - Fork 788
feat(linter): Add eslint/no-unresolved rule #18044
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
base: main
Are you sure you want to change the base?
feat(linter): Add eslint/no-unresolved rule #18044
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements a basic version of the eslint-plugin-import no-unresolved rule to detect unresolved module imports. The rule checks that all imported modules can be resolved, with support for CommonJS, AMD, and ES modules.
Changes:
- Adds a new
no_unresolvedrule with configuration options for CommonJS, AMD, ignore patterns, and case sensitivity - Implements module resolution checking for import statements and require/define calls
- Adds test fixtures and snapshot tests for various import scenarios
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| crates/oxc_linter/src/rules/import/no_unresolved.rs | Core rule implementation with import checking logic and configuration |
| crates/oxc_linter/src/rules.rs | Registers the new rule in the linter module system |
| crates/oxc_linter/src/snapshots/*.snap | Test snapshots for basic and node-protocol test scenarios |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
0da24c8 to
d937238
Compare
...and using nodejs-built-in-modules from oxc_resolver 11.16.3
Co-authored-by: Copilot <[email protected]> Signed-off-by: Wes Morgan <[email protected]>
Co-authored-by: Copilot <[email protected]> Signed-off-by: Wes Morgan <[email protected]>
93abd2d to
811400d
Compare
|
It should be noted that we had this rule at one point in the past, but it was deemed too difficult to make accurate, and so marked as an unsupported rule:
I am unsure if that has really changed enough to warrant implementing support for the rule. But I'll defer to the other maintainers' opinions. Also, you should use the rulegen tool ( |
This adds a basic version of the eslint
no-unresolvedrule: https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-unresolved.md