Closed foucdeg closed 12 months ago
This seems to be reproductible for any import syntax; after adding another entrypoint that includes
import Layout from "@theme/Layout" // <- unresolved
this entry also gets added to the config file when using -u despite being already present. After three runs of npx unimported -u
I get:
"ignoreUnresolved": [
["../../../app/assets/locales/es/translation.json", ["app/scripts/i18n.tsx"]],
["../../../app/assets/locales/es/translation.json", ["app/scripts/i18n.tsx"]],
["../../../app/assets/locales/es/translation.json", ["app/scripts/i18n.tsx"]],
["@theme/Layout", ["docusaurus/src/pages/index.tsx"]],
["@theme/Layout", ["docusaurus/src/pages/index.tsx"]],
["@theme/Layout", ["docusaurus/src/pages/index.tsx"]]
],
and a non-zero exit status every time for npx unimported
.
It seems that the issue is when building the index of unresolvedImports
:
https://github.com/smeijer/unimported/blob/main/src/process.ts#L32
Since each entry is not a simple string, this index doesn't have the shape it should.
Opened #191 with a fix.
Hi @smeijer I see you've responded to more recent issues recently, have you read this one and the PR?
:tada: This issue has been resolved in version 1.31.0 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
Sorry about the delay @foucdeg , just slipped my mind. Also, appreciate the extensive explanation. Definitely simplified the review :)
In the file
app/scripts/i18n.tsx
I have the following code:unimported
correctly flags the first import as unresolved. (In this environment the target file is located at the 2nd path)Running
npx unimported -u
adds the following entry toignoreUnresolved
:but it adds it repetitively; each time I run the command, the entry is added again.
After running the command three times,
ignoreUnresolved
looks like this:No matter how many times this entry is present in
ignoreUnresolved
,npx unimported
returns a non-zero status and complains about this unresolved import.I've tried to ignore this error by adding into
ignorePatterns
:but neither of these fixed the issue.
Current workaround is using
npx unimported --show-unused-files --show-unused-deps
.