next.js: Docs: Creating new Next.js project with TypeScript does not add TypeScript lint rules
What is the documentation issue?
On the ESLint page of the documentation there is a section named TypeScript. It says that when creating a new project set up to use TypeScript, it should add TypeScript-specific lint rules and the content of the .eslintrc.json file should look like this:
{
"extends": ["next/core-web-vitals", "next/typescript"]
}
However, when I create a new Next.js project by running npx create-next-app@latest and select the option to use TypeScript in the prompts that follow, it does not add the TypeScript lint rules and the .eslintrc.json file looks like this:
{
"extends": "next/core-web-vitals"
}
Is there any context that might help us understand?
It seems these lint rules are not being added when creating a new project with TypeScript. I am not sure if this is the intended behavior and it is an issue with the documentation that needs to be updated, or it is a bug that needs to be fixed.
Does the docs page already exist? Please link to it.
https://nextjs.org/docs/pages/building-your-application/configuring/eslint
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 10
- Comments: 18 (5 by maintainers)
It looks like
next lint(using the latest canary) installs an oldereslint-config-nextversion that is missing theeslint-config-next\typescript.jsfile. Manually updatingpnpm update eslint-config-next@v15.0.0-canary.130brings the missing file in and resolves theFailed to load config "next/typescript" to extend from.error.hello @LuckyT89 I also have this problem. Worst tho: running the command
next lintnow returns an error if you update your eslintrc to what is suggested on the documentation:ERROR:
same issues
it works for me, thank😊, the latest version of eslint-config-next is “15.0.0-canary.134”
@apomortsev Thank you for the clarification.
The PR that <picture data-single-emoji=":fixed:" title=":fixed:">
</picture> the issue will be backported to
14.2.7, which likely will be released later today! Afterwards, you should be able tonpx create-next-app@latestand have the correct linting rules.In the meantime, I will be closing this issue! Please be on the look for the new minor release → https://github.com/vercel/next.js/releases.
thanks
It appears that the
next/typescriptlinter rules are supposed to be part of theeslint-config-nextpackage. However, if you check the latest published version, you’ll notice that it only includes thecore-web-vitalsrules. This suggests that thenext/typescriptlinter rules simply haven’t been published yet.It would be great to get this working as documented. I’m trying to enable the
@typescript-eslint/consistent-type-importsrule but the missingnext/typescriptplugin is stopping it from working.@samcx Whoops my bad- I saw in the thread above there was a commit made that referenced this issue, I didn’t realize it was not actually for this repo.
Thanks for the update, I will look out for this change in the future.
@apomortsev this worked for me, thank you.