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

2.0.1 with eslint give 'Unable to resolve path to module 'ably' import/no-unresolved' #1719

Open
Andrioden opened this issue Mar 30, 2024 · 2 comments
Labels
enhancement New feature or improved functionality.

Comments

@Andrioden
Copy link

Andrioden commented Mar 30, 2024

There is something wrong with your node_module export, because the plugin eslint-plugin-import complains.

I got this error after i upgraded to 2.0.0.

My application still works, so its just limited to the linter.

Here is a minimum that i think reproduce it

frontend/package.json

{
  "dependencies": {
    "ably": "2.0.1"
  },
  "devDependencies": {
    "eslint-plugin-import": "^2.29.0"
  },
  "eslintConfig": {
    "env": {
      "browser": true,
      "es2021": true
    },
    "extends": [
      "plugin:import/recommended"
    ]
  }
}

frontend/main.js

import * as Ably from "ably"

Then run something like .\frontend\node_modules\.bin\eslint ./frontend/
->

C:\Repos\untitledgame\frontend\static\game\js\event-subscriber.js
  1:23  error  Unable to resolve path to module 'ably'  import/no-unresolved

✖ 1 problem (1 error, 0 warnings)
@Andrioden
Copy link
Author

Andrioden commented Mar 30, 2024

Workaround:

import * as Ably from "ably" // eslint-disable-line import/no-unresolved

@owenpearson
Copy link
Member

Hey @Andrioden, thanks for the report and repro! It seems like this is just a manifestation of import-js/eslint-plugin-import#2703, which is an issue with eslint-plugin-import not being able to parse the package.json exports field. We will look into the impact of adding a "main" field to our package.json or if there are any other ways for us to mitigate this but for now, simply disabling the plugin (as you are doing in the workaround) is probably the best way to go.

@VeskeR VeskeR added the enhancement New feature or improved functionality. label Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or improved functionality.
Development

No branches or pull requests

3 participants