madge
madge copied to clipboard
Madge is not detecting the right version of Typescript and incorrect warning
My root package.json
`"typescript": "5.2.2",
No other file has "typescript" in it. My global npm
`"typescript": "5.2.2",
I checked the node_modules/typescript/package.json
I also used qnm
qnm typescipt
qnm typescript
typescript 5.4.5 ↰ 1 week ago
├── 5.2.2 ⇡ 7 months ago
└─┬ config-file-ts
└── 4.9.5 ⇡ 1 year ago
5.2.2 is installed. I ripgrep for 5.4.5 and nothing. I can't determine how madge thinks I have 5.4.5.
I still get
⠋ Finding files=============
WARNING: You are currently running a version of TypeScript which is not officially supported by @typescript-eslint/typescript-estree.
You may find that it works just fine, or you may not.
SUPPORTED TYPESCRIPT VERSIONS: >=3.3.1 <5.2.0
YOUR TYPESCRIPT VERSION: 5.4.5
Please only submit bug reports when using the officially supported version.
=============
Processed 45 files (674ms) (2 warnings)
If you run npm ls typescript @typescript-eslint/typescript-estree you should be able to find the dependencies tree related to your problem.
Lately, I run into a similar issues and forces those packages version package.json overrides mechanism:
{
...
"overrides": {
...
"@typescript-eslint/eslint-plugin": "7.7.0",
"@typescript-eslint/utils": "7.7.0",
"@typescript-eslint/parser": "7.7.0",
...
"typescript": "5.4.5",
...
},
...
}
The issue you mentioned disappeared and my project was still operational 😎
@tetedacier thanks, I cannot use overrides, but I tested and it didn't eliminate the warning from madge.
❯ npm ls typescript @typescript-eslint/typescript-estree
[email protected] D:\something
+-- @something/[email protected] -> .\apps\electron
| `-- [email protected]
| `-- [email protected]
| `-- [email protected]
| `-- [email protected]
+-- @typescript-eslint/[email protected]
| +-- @typescript-eslint/[email protected]
| | `-- @typescript-eslint/[email protected] deduped
| +-- @typescript-eslint/[email protected]
| | `-- @typescript-eslint/[email protected] deduped
| `-- [email protected]
| `-- [email protected] deduped
+-- @typescript-eslint/[email protected]
| `-- @typescript-eslint/[email protected]
`-- [email protected]
I downgraded to 5.1.6. It is not identifying typescript version correctly.
I ran npm ls typescript @typescript-eslint/typescript-estree and it looks like the wrong version comes from precinct which is a dependency of madge itself
├─┬ [email protected]
│ ├─┬ [email protected]
│ │ ├─┬ [email protected]
│ │ │ └── [email protected] deduped
│ │ └── [email protected] deduped
│ ├─┬ [email protected]
│ │ └─┬ [email protected]
│ │ ├── @typescript-eslint/[email protected]
│ │ └── [email protected]
│ └── [email protected] deduped
After overriding in package.json as tetedacier suggested the warning disappeared
"overrides": {
...
"typescript": "5.0.4"
}
├─┬ [email protected]
│ ├─┬ [email protected]
│ │ ├─┬ [email protected]
│ │ │ └── [email protected] deduped
│ │ └── [email protected] deduped
│ ├─┬ [email protected]
│ │ └─┬ [email protected]
│ │ ├── @typescript-eslint/[email protected]
│ │ └── [email protected] deduped
│ └── [email protected] deduped