Tip
this bug is fixed in eslint-import-resolver-typescript 3.8.5
when eslint-import-resolver-typescript > 3.7.0 linting fails
this us due to a breaking change got introduced in 3.8.0 that prevents aliases to be resolved to a module on the local filesystem
Note
the problem only occurs when linting MDX files and using aliases
first make sure you followed the development steps
then start the linting process using a custom eslint.config.ts:
npm run lint
you will get the following error on line 1 in the app/page.mdx file:
error Unable to resolve path to module '@/components/ExampleComponent' import/no-unresolved
if you downgrade eslint-import-resolver-typescript:
npm i [email protected] --save-exact --save-dev
and then start the linting process again then you will NOT get any linting error
clone this project in your IDE
then install the dependencies:
npm i
installation commands used to create this project
install next.js (15.2.1) using create-next-app:
npx create-next-app@latest .
questions answered like this:
√ Would you like to use TypeScript? ... Yes
√ Would you like to use ESLint? ... Yes
√ Would you like to use Tailwind CSS? ... No
√ Would you like your code inside a `src/` directory? ... No
√ Would you like to use App Router? (recommended) ... Yes
√ Would you like to use Turbopack for `next dev`? ... No
√ Would you like to customize the import alias (`@/*` by default)? ... Yes
√ What import alias would you like configured? ... @/*
add MDX support and types:
npm i @next/mdx @mdx-js/loader --save-exact
npm i @types/mdx --save-exact --save-dev
install eslint plugins:
npm i typescript-eslint eslint-plugin-mdx eslint-plugin-import eslint-import-resolver-typescript jiti --save-exact --save-dev