Closed axelson closed 8 months ago
Interesting. The only thing that changed between 1.31.0 and 1.31.1 is this pull https://github.com/smeijer/unimported/pull/194, which restores relative path output for unimported
files, which was a regression of https://github.com/smeijer/unimported/pull/184
How are the files stored in your .unimportedrc.json
? Absolute or relative? Can you quote an example?
A reproduction (the smaller the better) would be most helpful as well.
I am also having this issue
.unimportedrc.json
{
"extensions": [".tsx", ".ts", ".jsx", ".js"],
"rootDir": "./src",
"ignoreUnimported": [
"src/middleware.ts",
"src/util/auth0-edge.ts",
"src/scripts/*",
"src/hooks/general/use-interval.ts",
"*.css"
],
"ignoreUnused": ["@hookform/devtools"],
"ignoreUnresolved": ["scripts/api"],
"aliases": {
"./*": ["./", "./*"],
"components/*": ["./components", "./components/*"],
"hooks/*": ["./hooks", "./hooks/*"],
"context/*": ["./context", "./context/*"],
"pages/*": ["./pages", "./pages/*"],
"scripts/*": ["./scripts", "./scripts/*"],
"styles/*": ["./styles", "./styles/*"],
"types/*": ["./types", "./types/*"],
"util/*": ["./util", "./util/*"]
}
}
│ 2 unresolved imports
─────┼──────────────────────────────────────────────────────────────────────────
1 │ scripts/api at src/pages/reviewer/tasks/index.tsx, src/components/foundation/task/bulk/bulk-task-context.tsx, src/components/foundation/form-builder/create-form/input-list.tsx, src/components/foundation/form-builder/create-form/create-form-store.tsx, src/components/foundation/form-builder/create-form/elements/builder/file-download.tsx, src/components/foundation/crm/nonprofit/file-icon.tsx, src/types/file/file.ts, src/hooks/req/use-file.ts, src/components/general/rich-text-editor/rich-editor.tsx, src/components/file/preview-image.tsx, src/hooks/general/use-file-download.ts, src/components/foundation/form-builder/create-form/elements/form/file-upload-input.tsx, src/components/foundation/form-builder/create-form/elements/builder/table-creator.tsx, src/components/foundation/form-builder/create-form/elements/builder/use-table-cell-input-utils.ts, src/components/reviewer/reviewer-response-modal.tsx, src/hooks/req/reviewer.ts, src/components/reviewer/reviewer-task-modal.tsx, src/hooks/req/user/use-user-profile.ts, src/components/foundation/form-builder/create-form/form-item-completer.tsx, src/components/foundation/proposals/multiform/submission-tabbed-view.tsx, src/components/foundation/raw/raw-form-responses.tsx, src/components/foundation/general/pipeline-selector.tsx, src/components/form/referee/referee-display-button.tsx, src/hooks/general/use-bulk-referee-task-download.tsx, src/hooks/req/foundation-grants/use-foundation-grant-submission.ts, src/hooks/req/foundation-tasks/use-foundation-task-search.ts, src/hooks/req/foundation/use-foundation-proposals.ts, src/hooks/req/use-filters.ts, src/hooks/req/foundation/use-foundation-nonprofit-grant-summary.ts, src/hooks/req/foundation/use-foundation-nonprofit-submissions.tsx, src/components/form/referee/referee-download-button.tsx, src/components/foundation/raw/submission-raw-response.tsx, src/hooks/general/use-submission-download.ts, src/components/foundation/proposals/attached-submission-files-modal.tsx, src/components/foundation/proposals/bulk/bulk-custom-submission-download-modal.tsx, src/hooks/general/use-custom-bulk-submission-download.tsx, src/components/foundation/proposals/submission-proposal-pdf-preview.tsx, src/hooks/req/foundation-tasks/use-foundation-task.ts, src/hooks/req/foundation-grantee-reports/use-foundation-grantee-reports.ts, src/hooks/req/foundation-tasks/use-foundation-task-submission.ts, src/hooks/req/foundation-tasks/user-foundation-task-comment.ts, src/hooks/req/foundation-notification/use-foundation-notification.ts
2 │ ./api at src/scripts/form-util.tsx, src/scripts/util.tsx, src/scripts/response-util.tsx, src/scripts/proposals-util.tsx, src/scripts/metadata-util.tsx
─────┴──────────────────────────────────────────────────────────────────────────
The scripts/api
is also in my gitignore
as well.
~Also weirdly enough this only happens in CI, but doesn't happen locally.~
Locally the files aren't unresolved, but they're ignored from version control so obviously they're not resolved in CI, which is why it errors in CI (although it should not). Issue still stands but the environment is irrelevant.
How are the files stored in your .unimportedrc.json ? Absolute or relative? Can you quote an example?
Here's an abridged form of the configuration I'm using:
{
"entry": [
"js/pages/onboarding.tsx",
"js/scripts/admin.ts",
"js/scripts/app_home.ts",
"js/**/*.stories.tsx"
...
],
"ignoreUnresolved": [
"@mapbox/mapbox-sdk/services/directions",
"geojson",
"~/components/ui/comments_cursor.svg?url",
"~/components/ui/small_loop.svg?url",
"~/components/ui/small_play.svg?url"
...
],
"ignoreUnused": ["@types/d3-format", "phoenix_live_view", "topbar", "cmdk"],
"ignorePatterns": [
"**/node_modules/**",
"**/*.tests.{js,jsx,ts,tsx}",
"**/*.test.{js,jsx,ts,tsx}",
"**/*.spec.{js,jsx,ts,tsx}",
"**/tests/**",
"**/__tests__/**",
"**/*.d.ts",
"coverage/**"
],
"ignoreUnimported": [
"delete-sourcemaps-webpack-plugin.js",
"e2e/assertions.ts",
"e2e/globalSetup.ts",
"e2e/utils.ts",
"jest.config.js",
"js/hooks/useWhyDidYouUpdate.ts",
"js/lib/perf/timePerFrame.ts",
"webpack.config.js"
...
]
}
And here's the errors I get from npx unimported
:
─────┬──────────────────────────────────────────────────────────────────────────
│ 9 unresolved imports
─────┼──────────────────────────────────────────────────────────────────────────
1 │ geojson at js/file1.ts, js/file2.ts
2 │ @mapbox/mapbox-sdk/services/directions at js/lib/routing.ts
3 │ ~/components/ui/small_play.svg?url at js/Element/Link/drawPlayButton.ts, js/Element/Path/drawPath.ts
4 │ ~/components/ui/small_loop.svg?url at js/Element/Path/drawPath.ts
5 │ ~/components/ui/small_square.svg?url at js/Element/Path/drawPath.ts
...
─────┴──────────────────────────────────────────────────────────────────────────
I get errors in both CI and locally
We have the same problem. The error came up when upgrading from v1.30.0
to v1.31.1
(skipping the v1.31.0
). So I guess the issue was introduced with #191, because it deals with the ignoreUnresolved
config option?
Moving my version back to 1.30.0 fixes my issue for now
Happens to me as well. v1.30.1 works fine
On unimported@1.31.1
I have the following issue defining ignoreUnresolved
:
"ignoreUnresolved": ["encoding"]
Running npx unimported
it returns the following output:
─────┬──────────────────────────────
│ 1 unresolved imports
─────┼──────────────────────────────
1 │ encoding at node_modules/node-fetch/lib/index.js
─────┴──────────────────────────────
Moving back to 1.30.0 works as expected.
I'm having the same issue.
this is my .unimportedrc.json
configuration:
{
"ignoreUnresolved": ["packages/selenium/atoms.js"],
"ignoreUnimported": ["src/_test/**/*"]
}
Some file is importing this packages/selenium/atoms.js
like this:
import Atoms from 'packages/selenium/atoms.js';
Version 1.30.0
didn't trigger any error and version 1.31.1
is triggering this:
summary unimported v1.31.1 (node)
───────────────────
entry file 1 : src/index.js
entry file 2 : src/main.tsx
unresolved imports : 1
unused dependencies : 0
unimported files : 0
─────┬─────────────
│ 1 unresolved imports
─────┼─────────────
1 │ packages/selenium/atoms.js at src/misc/selenium/index.js
I fixed it updating my .unimportedrc.json
file to:
{
"ignoreUnresolved": [["packages/selenium/atoms.js", ["src/misc/selenium/index.js"]]],
"ignoreUnimported": ["src/_test/**/*"]
}
I don't know the reason of this change, old configuration looked easier.
Does someone have a reproduction available? A github repo where this issue shows? I'm happy to take a look at it, but having a test case would be nice.
Hey @smeijer I created a simple repo where you can see the issue.
Just run the commands in the Readme file and you will see unimported complaining in the terminal.
Thanks
This project is being archived. Please check the readme for more info.
Hi, I noticed that in my project on 1.31.0 and 1.31.1 I'm getting some unresolved import warnings for imports that use
import type
. These warnings include entries that I have in.unimportedrc.json
underignoreUnresolved
. For example I have"geojson"
as an entry but I'm still getting an error for it.