-
-
Notifications
You must be signed in to change notification settings - Fork 222
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
Running against .ts files fails with error: 'TypeError: p is not iterable' #688
Comments
Can you try with |
@rumpl thanks, yeah I can see now I misunderstood the syntax for the argument. I definitely get better results when running that, but I'm still seeing errors:
|
I think the problem is that this is not a valid plugin configuration: depcheck/src/parser/typescript.js Line 34 in 180e05a
|
@hedgepigdaniel thanks, i did try your fix but I get the same error. |
@hedgepigdaniel actually, I noticed a tread outlining an issue with running with I'm still seeing the error
|
I can confirm, I get the same error messages. It's a
|
I can confirm, I modified my |
and then run |
Installing latest version of babel core in eslint config had a side-effect of deduping and hoisting this version for every package in the monorepo, which in turn broke depcheck package because of depcheck/depcheck#688 As the issue is not resolved yet on the depcheck side, our best way of handling this is to make sure that we are not using this version of babel yet, but as soon as fix is released, we should do a depcheck update in the monorepo
…rser configs (#2815) * fix(eslint-config-compass): Fix babel version at 7.14 Installing latest version of babel core in eslint config had a side-effect of deduping and hoisting this version for every package in the monorepo, which in turn broke depcheck package because of depcheck/depcheck#688 As the issue is not resolved yet on the depcheck side, our best way of handling this is to make sure that we are not using this version of babel yet, but as soon as fix is released, we should do a depcheck update in the monorepo * fix(eslint-config-compass): Separate js and ts parser configs Having babel as default and overriding it with typescript leads to weird parsing issues when running lint for packages in the monorepo * test(compass-aggregations): Skip tests that fail in evergreen
Two fixes are necessary to the depcheck configuration so that it does not report errors around TypeScript files: * Don't report anything around `@types/*` packages, as those are implicitly imported by TypeScript * Pin the version of `@babel/parser` that depcheck uses as the one it's currently using breaks the TypeScript parsing code, causing depcheck to complain about anything imported in TypeScript files. Related GH issue: <depcheck/depcheck#688>
Two fixes are necessary to the depcheck configuration so that it does not report errors around TypeScript files: * Don't report anything around `@types/*` packages, as those are implicitly imported by TypeScript * Pin the version of `@babel/parser` that depcheck uses as the one it's currently using breaks the TypeScript parsing code, causing depcheck to complain about anything imported in TypeScript files. Related GH issue: <depcheck/depcheck#688>
Two fixes are necessary to the depcheck configuration so that it does not report errors around TypeScript files: * Don't report anything around `@types/*` packages, as those are implicitly imported by TypeScript * Pin the version of `@babel/parser` that depcheck uses as the one it's currently using breaks the TypeScript parsing code, causing depcheck to complain about anything imported in TypeScript files. Related GH issue: <depcheck/depcheck#688>
Two fixes are necessary to the depcheck configuration so that it does not report errors around TypeScript files: * Don't report anything around `@types/*` packages, as those are implicitly imported by TypeScript * Pin the version of `@babel/parser` that depcheck uses as the one it's currently using breaks the TypeScript parsing code, causing depcheck to complain about anything imported in TypeScript files. Related GH issue: <depcheck/depcheck#688>
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
When support for TypeScript was added, I noticed that `depcheck` was failing to properly detect dependencies in TypeScript files (running `DEBUG=depcheck:* yarn depcheck` revealed that `depcheck` produced a "p is not iterable" error whenever encountering these files). According to [this GitHub issue], this error seems to be caused by some change in `@babel/parser`. The solution suggested there was to pin `@babel/parser` to 7.16.4, so I added a resolution to `package.json` to achieve this. However, since then we've discovered that `yarn-deduplicate` will undo changes to `yarn.lock` that `yarn install` makes, meaning any developer will need to run `yarn-deduplicate` if they want to update dependencies locally or else CI will fail. The aforementioned resolution for `@babel/parser` seems to be the culprit. `@babel/parser` is used by a lot of packages, but the resolution only targeted the version that `depcheck` used. This meant that multiple versions of `@babel/parser` were valid depending on the version resolution logic being used, leading to indeterminate behavior. To fix this problem, this commit updates the resolution such it is more global, i.e., any time `@babel/parser` is referenced, only *one* version will be used. This does lead to a warning when `yarn install` is run, so maybe there is a better way to do this, but the alternative is to add unnecessary exceptions to `.depcheckrc.yml` which seemed undesirable. [1]: depcheck/depcheck#688 (comment)
When support for TypeScript was added, I noticed that `depcheck` was failing to properly detect dependencies in TypeScript files (running `DEBUG=depcheck:* yarn depcheck` revealed that `depcheck` produced a "p is not iterable" error whenever encountering these files). According to [this GitHub issue][1], this error seems to be caused by some change in `@babel/parser`. The solution suggested there was to pin `@babel/parser` to 7.16.4, so I added a resolution to `package.json` to achieve this. However, since then we've discovered that `yarn-deduplicate` will undo changes to `yarn.lock` that `yarn install` makes, meaning any developer will need to run `yarn-deduplicate` if they want to update dependencies locally or else CI will fail. The aforementioned resolution for `@babel/parser` seems to be the culprit. `@babel/parser` is used by a lot of packages, but the resolution only targeted the version that `depcheck` used. This meant that multiple versions of `@babel/parser` were valid depending on the version resolution logic being used, leading to indeterminate behavior. To fix this problem, this commit updates the resolution such it is more global, i.e., any time `@babel/parser` is referenced, only *one* version will be used. This does lead to a warning when `yarn install` is run, so maybe there is a better way to do this, but the alternative is to add unnecessary exceptions to `.depcheckrc.yml` which seemed undesirable. [1]: depcheck/depcheck#688 (comment)
When support for TypeScript was added, I noticed that `depcheck` was failing to properly detect dependencies in TypeScript files (running `DEBUG=depcheck:* yarn depcheck` revealed that `depcheck` produced a "p is not iterable" error whenever encountering these files). According to [this GitHub issue][1], this error seems to be caused by some change in `@babel/parser`. The solution suggested there was to pin `@babel/parser` to 7.16.4, so I added a resolution to `package.json` to achieve this. However, since then we've discovered that `yarn-deduplicate` will undo changes to `yarn.lock` that `yarn install` makes, meaning any developer will need to run `yarn-deduplicate` if they want to update dependencies locally or else CI will fail. The aforementioned resolution for `@babel/parser` seems to be the culprit. `@babel/parser` is used by a lot of packages, but the resolution only targeted the version that `depcheck` used. This meant that multiple versions of `@babel/parser` were valid depending on the version resolution logic being used, leading to indeterminate behavior. To fix this problem, this commit updates the resolution such it is more global, i.e., any time `@babel/parser` is referenced, only *one* version will be used. This does lead to a warning when `yarn install` is run, so maybe there is a better way to do this, but the alternative is to add unnecessary exceptions to `.depcheckrc.yml` which seemed undesirable. [1]: depcheck/depcheck#688 (comment)
Bug Description
I'm trying to run depcheck against TypeScript code but it's failing with the error:
TypeError: p is not iterable
. I've tried installing withnpm i -g depcheck
and alsonpm i -g depcheck typescript
.The error was generated after running:
I have tried:
However, when I run this (^) command I get the error:
Cannot read property 'split' of undefined
. It does seem to be working as expected for .js files though.Here's the stack trace for the error in the issue title.
Versions
node -v
: v14.18.2npm -v
: 6.14.15depcheck --version
: 1.4.2The text was updated successfully, but these errors were encountered: