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

Add notes on interop with eslint-plugin-import to docs #300

Open
kavsingh opened this issue Jan 13, 2024 · 2 comments
Open

Add notes on interop with eslint-plugin-import to docs #300

kavsingh opened this issue Jan 13, 2024 · 2 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@kavsingh
Copy link

kavsingh commented Jan 13, 2024

Description

One thing i always forget when setting up an astro project with eslint-plugin-astro + eslint-plugin-import, is how to resolve import/no-unresolved errors for astro:content.

My usual way of handling it is adding astro:content to core modules

"settings": {
  "import/core-modules": ["astro:content"]
}

Is that approach right, and would it be worth adding it (or the actual right thing to do) as a note in the configuration docs? Does it even belong in these docs?

@kavsingh kavsingh added the enhancement New feature or request label Jan 13, 2024
@ota-meshi
Copy link
Owner

Pull requests are welcome!
It would probably be good to include the following settings as well.

  "settings": {
    "import/parsers": {
      "astro-eslint-parser": [".astro"],
      "espree": [".js"],
      "...": [".ts", ...]
    }
  }

@ota-meshi ota-meshi added the help wanted Extra attention is needed label Jan 14, 2024
@martinburger
Copy link

After adding Astro View Transitions to my project, I encountered the following error:

error Unable to resolve path to module 'astro:transitions' import/no-unresolved

The above error is fixed by the following patch:

--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -66,8 +66,9 @@ module.exports = {
   settings: {
     'import/resolver': {
       typescript: {
         project: '.'
       }
-    }
+    },
+    'import/core-modules': ['astro:transitions']
   }
 }

Perhaps this will be of help to others.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants