next lint wants to always add [distDir]/types/**/*.ts
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 142k
- Forks
- 32.4k
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 351
Description
Link to the code that reproduces this issue or a replay of the bug
https://github.com/ewah/nextjs-tsconfig-230911
To Reproduce
Add a dynamic distDir in next.config.js. (for me generateBuildId fetches an ENV git hash (unless i'm in dev)
distDir: `.next/build/${generateBuildId()}`,
Add include path to cover the the distDir in tsconfig.json
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
".next/build/**/*.ts"
],
run
next lint
Current vs. Expected behavior
Currently, next lint rewrites tsconfig.json. [here my generateBuildId() returns unknown]
The following suggested values were added to your tsconfig.json. These values can be changed to fit your project's needs:
- include was updated to add '.next/build/unknown/types/**/*.ts'
and the tsconfig.json is modified
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -56,8 +56,7 @@
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
+ ".next/build/**/*.ts",
+ ".next/build/unknown/types/**/*.ts"
- ".next/build/**/*.ts"
],
"exclude": [
"node_modules"
Expected
no change in tsconfig.json
Verify canary release
- I verified that the issue exists in the latest Next.js canary release
Provide environment information
Operating System:
Platform: linux
Arch: x64
Version: #1 SMP Mon Jul 12 21:54:23 UTC 2021
Binaries:
Node: 18.17.1
npm: 9.1.3
Yarn: 1.22.19
pnpm: N/A
Relevant Packages:
next: 13.4.20-canary.24
eslint-config-next: 13.4.9
react: 18.2.0
react-dom: 18.2.0
typescript: 5.1.6
Next.js Config:
output: N/A
Which area(s) are affected? (Select all that apply)
TypeScript (plugin, built-in types)
Additional context
(edit for diff clarity)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked reproduction repository: configure the dynamic distDir and the shown tsconfig.json include entries, then run next lint. Trace the tsconfig include-update handling and verify that an already-covered dynamic distDir does not add another pattern; done means tsconfig.json remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- eslint, javascript, nextjs, typescript
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 57/100