-
Notifications
You must be signed in to change notification settings - Fork 9
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
fix/add-error-message-for-other-module-not-found #8
fix/add-error-message-for-other-module-not-found #8
Conversation
… a module other than 'eslint-local-rules'
Great find & fix! I simplified the code a little -- let me know if it's still good and I'll get it merged, thanks! |
Looks great! |
Merged and released v1.1.1, thanks for the fix! |
Guys, I think this PR is causing the issue pointed in #7 since i never encountered it before with 1.1.0
Noteworthy, i don't have any Can you please look at fixing this at your earliest convenience? Thanks in advance! |
@diegocr Sorry about that!! I was literally just thinking how bad it is this thing doesn't have a single test. Reverted this changed and published as v1.1.2. I'll try again more carefully -- if you have a simplified version of your setup that errors in v1.1.1 that I can test against that would be great, thanks. |
@@ -24,20 +24,20 @@ module.exports = { | |||
// Similar to native `require` behavior, but doesn't check in `node_modules` folders | |||
// Based on https://github.com/js-cli/node-findup-sync | |||
function requireUp(filename, cwd) { | |||
var filepath = path.resolve(cwd, filename); | |||
var filepath = path.resolve(cwd, filename) + exts[i]; |
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.
@cletusw I missed this earlier, but filepath
needs to be defined within the scope of the for loop so that it can access i
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.
In v1.1.1
, the filepath
variable evaluates to /path/to/eslint-local-rulesundefined
.
This will cause MODULE_NOT_FOUND errors, an example might look like:
Error: Cannot find module '/path/to/eslint-local-rulesundefined'
Since this error message matches the pattern Cannot find module '${filepath}'
that we check for, an error is not thrown, and this results in the standard 'Failed to load plugin' error being logged
See #8 Also: * Set up tests with Vitest * Add prettier
If there is a
require
statement in the 'eslint-local-rules' file, which results in aMODULE_NOT_FOUND
error, its not immediately obvious with the current error messaging.Will result in the following error:
This PR will make it so that the
Cannot find module 'bad-import-which-will-not-resolve'
error will be thrown