Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extends tsconfig.json can't resolve @tsconfig/ package #1306

Open
gutenye opened this issue Sep 8, 2023 · 4 comments
Open

extends tsconfig.json can't resolve @tsconfig/ package #1306

gutenye opened this issue Sep 8, 2023 · 4 comments
Labels
status: accepting prs Please, send a pull request to resolve this! 🙏 type: bug Something isn't working :( 🐛

Comments

@gutenye
Copy link

gutenye commented Sep 8, 2023

🐛 Bug Report

  • TypeStat version: 0.7.2
  • TypeScript version: 5.1.6
  • Node version: v16.18.0

Actual Behavior

Error: ENOENT: no such file or directory, stat 'node_modules/@tsconfig/node16/tsconfig.json/package.json'

The correct file should be node_modules/@tsconfig/node16/tsconfig.json

A temporary fix is updating the tsconfig.json with ./node_modules/@tsconfig/node16/tsconfig.json

Expected Behavior

Run without an error

Reproduction

vi tsconfig.json
{
  "extends": "@tsconfig/node16/tsconfig.json",
  "include": [
    "src/**/*"
  ]
}

npx typestat
npx typestat --config typestat.json
// typestat.json
{
    "files": {
        "renameExtensions": false
    },
    "fixes": {
        "incompleteTypes": true,
        "missingProperties": true,
        "noImplicitAny": true
    },
    "cleanups": {
        "suppressTypeErrors": true
    },
    "include": [
        "src/**/*.{js,jsx}"
    ],
    "project": "./tsconfig.json"
}
@JoshuaKGoldberg
Copy link
Owner

Hey thanks for trying out TypeStat and filing an issue! I can't reproduce locally with those two files though. Is there a standalone gist, repo, or other set-of-code-files you can share that does demonstrate the issue?

@JoshuaKGoldberg JoshuaKGoldberg added the status: needs reproduction The issue was filed with a missing or incomplete reproduction, and it can't be reproduced locally. label Sep 8, 2023
@gutenye
Copy link
Author

gutenye commented Sep 8, 2023

try this tsconfig.json

{
  "extends": "@tsconfig/node16/tsconfig.json",
  "include": [
    "src/**/*"
  ]
}

@JoshuaKGoldberg
Copy link
Owner

That did it, thanks!

@JoshuaKGoldberg JoshuaKGoldberg added type: bug Something isn't working :( 🐛 status: accepting prs Please, send a pull request to resolve this! 🙏 and removed status: needs reproduction The issue was filed with a missing or incomplete reproduction, and it can't be reproduced locally. labels Sep 8, 2023
@JoshuaKGoldberg
Copy link
Owner

JoshuaKGoldberg commented Sep 8, 2023

A more full stack locally:

Error: ENOTDIR: not a directory, stat '/Users/josh/repos/typestattemp/node_modules/@tsconfig/node16/tsconfig.json/package.json'
    at Object.statSync (node:fs:1620:3)
    at Object.<anonymous> (/Users/josh/repos/TypeStat/node_modules/graceful-fs/polyfills.js:319:16)
    at Object.fileExists (/Users/josh/repos/TypeStat/src/options/parseRawCompilerOptions.js:52:42)
    at getPackageJsonInfo (/Users/josh/repos/TypeStat/node_modules/typescript/lib/typescript.js:40354:33)
    at loadModuleFromSpecificNodeModulesDirectory (/Users/josh/repos/TypeStat/node_modules/typescript/lib/typescript.js:40997:23)
    at loadModuleFromImmediateNodeModulesDirectory (/Users/josh/repos/TypeStat/node_modules/typescript/lib/typescript.js:40974:29)
    at /Users/josh/repos/TypeStat/node_modules/typescript/lib/typescript.js:40962:33
    at forEachAncestorDirectory (/Users/josh/repos/TypeStat/node_modules/typescript/lib/typescript.js:6971:22)
    at lookup (/Users/josh/repos/TypeStat/node_modules/typescript/lib/typescript.js:40956:14)
    at loadModuleFromNearestNodeModulesDirectoryWorker (/Users/josh/repos/TypeStat/node_modules/typescript/lib/typescript.js:40953:14)
josh ~/repos/typestattemp $ 

@JoshuaKGoldberg JoshuaKGoldberg changed the title extends in tsconfig.json not working extends tsconfig.json can't resolve @tsconfig/ package Sep 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: accepting prs Please, send a pull request to resolve this! 🙏 type: bug Something isn't working :( 🐛
Projects
None yet
Development

No branches or pull requests

2 participants