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)

Commits related to this issue

Most upvoted comments

It looks like next lint (using the latest canary) installs an older eslint-config-next version that is missing the eslint-config-next\typescript.js file. Manually updating pnpm update eslint-config-next@v15.0.0-canary.130 brings the missing file in and resolves the Failed to load config "next/typescript" to extend from. error.

hello @LuckyT89 I also have this problem. Worst tho: running the command next lint now returns an error if you update your eslintrc to what is suggested on the documentation:

{
  "extends": ["next/core-web-vitals", "next/typescript"]
}

ERROR:

next lint
Failed to load config "next/typescript" to extend from.

hello @LuckyT89 I also have this problem. Worst tho: running the command next lint now returns an error if you update your eslintrc to what is suggested on the documentation:

{
  "extends": ["next/core-web-vitals", "next/typescript"]
}

ERROR:

next lint
Failed to load config "next/typescript" to extend from.

same issues

It looks like next lint (using the latest canary) installs an older eslint-config-next version that is missing the eslint-config-next\typescript.js file. Manually updating pnpm update eslint-config-next@v15.0.0-canary.130 brings the missing file in and resolves the Failed to load config "next/typescript" to extend from. error.

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:">:fixed:</picture> the issue will be backported to 14.2.7, which likely will be released later today! Afterwards, you should be able to npx create-next-app@latest and 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.

It looks like next lint (using the latest canary) installs an older eslint-config-next version that is missing the eslint-config-next\typescript.js file. Manually updating pnpm update eslint-config-next@v15.0.0-canary.130 brings the missing file in and resolves the Failed to load config "next/typescript" to extend from. error.

thanks

It appears that the next/typescript linter rules are supposed to be part of the eslint-config-next package. However, if you check the latest published version, you’ll notice that it only includes the core-web-vitals rules. This suggests that the next/typescript linter 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-imports rule but the missing next/typescript plugin 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.