Closed elijahcarrel closed 1 year ago
Hey! Thanks for reporting. We'll take a closer look into this. I'll keep you posted!
Hey!
I just had a deeper look into this. It seems like you don't have the plugin eslint-import-resolver-typescript
which is required that Eslint knows how to resolve this module.
I saw that you have installed eslint-config-next
but not using it (which uses this resolver plugin). You did import "plugin:@next/next/recommended"
instead.
If you change the eslint config to include following, it should work (be sure to use the latest version of eslint-config-next
. (The Next.js config includes the eslint plugin you'll need)
extends: [
"airbnb-typescript-prettier",
"next",
],
Else you can just install the required plugin: https://github.com/import-js/eslint-import-resolver-typescript
Let me know if it works! :)
@tobiaslins Would this be the same process in a non-typescript project?
@Hearmstrong It might not be required. There is a JavaScript version as well: https://www.npmjs.com/package/eslint-plugin-import
Note that I haven't tested this out.
Will close this for now. Let us know if you still have problems!
I have the next
configuration for eslint, but I am still seeing this issue.
extends: [
'next/core-web-vitals',
'plugin:@typescript-eslint/recommended',
'airbnb-base',
'airbnb-typescript',
'next',
'prettier',
],
Admittedly a lot of this config is old and haven't audited it in a while. Nor sure if there are any conflicts happening.
Thank you so much @tobiaslins! That was exactly my problem and your solution worked. I'm surprised I managed to get this far in my app without actually using eslint-import-resolver-typescript
until now 😅.
Steps to reproduce:
npm install @vercel/analytics
_app.jsx
(or_app.tsx
if relevant), addimport { Analytics } from "@vercel/analytics/react";
.vercel
Expected behavior:
Actual behavior:
Workaround:
// eslint-disable-next-line import/no-unresolved
beforeimport { Analytics } from "@vercel/analytics/react";
.Version: 0.1.5
This is also as described in https://stackoverflow.com/a/74453475/2736037.