Skip to content

custom_lint throws PathNotFoundException in pnpm workspace #289

Open
@BuyMyBeard

Description

@BuyMyBeard

Describe the bug
I have a monorepo with a bunch of packages written in TS. At the root is the Flutter front-end project and a node_modules for pnpm dependencies. It is oddly specific, but if I have the npm firebase package installed through pnpm, and I run dart run custom_lint, the following exception is thrown:

Exception
W:\DevXpress\custom_lint_issue_repro> dart run custom_lint
Building package executable... 
Built custom_lint:custom_lint.
PathNotFoundException: Directory listing failed, path = 'W:\DevXpress\custom_lint_issue_repro\node_modules\.pnpm\@[email protected]_@[email protected]_@[email protected]_@[email protected]\node_modules\@firebase\firestore\dist\firestore\test\unit\remote\bloom_filter_golden_test_data\*' (OS Error: The system cannot find the path specified.
, errno = 3)
#0      _Directory._fillWithDirectoryListing (dart:io-patch/directory_patch.dart:42:24)
#1      _Directory.listSync (dart:io/directory_impl.dart:228:5)
#2      _findRoots (package:custom_lint/src/workspace.dart:411:20)
#3      _SyncStarIterator.moveNext (dart:async-patch/async_patch.dart:560:14)
#4      ExpandIterator.moveNext (dart:_internal/iterable.dart:487:32)
#5      SetBase.addAll (dart:collection/set.dart:58:23)
#6      _Set.addAll (dart:collection-patch/compact_hash.dart:986:11)
#7      new LinkedHashSet.of (dart:collection/linked_hash_set.dart:192:27)
#8      Iterable.toSet (dart:core/iterable.dart:513:21)
#9      CustomLintWorkspace.fromPaths (package:custom_lint/src/workspace.dart:440:10)
#10     _runServer.<anonymous closure> (package:custom_lint/custom_lint.dart:90:51)
#11     CustomLintServer.runZoned.<anonymous closure> (package:custom_lint/src/v2/custom_lint_analyzer_plugin.dart:80:17)
#12     new Future.<anonymous closure> (dart:async/future.dart:258:40)
#13     _rootRun (dart:async/zone.dart:1391:47)
#14     _CustomZone.run (dart:async/zone.dart:1301:19)
#15     _CustomZone.runGuarded (dart:async/zone.dart:1209:7)
#16     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1249:23)
#17     _rootRun (dart:async/zone.dart:1399:13)
#18     _CustomZone.run (dart:async/zone.dart:1301:19)
#19     _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:1233:23)
#20     Timer._createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:18:15)
#21     _Timer._runTimers (dart:isolate-patch/timer_impl.dart:398:19)
#22     _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:429:5)
#23     _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)

I find this oddly specific, because I couldn't reproduce the issue by installing the same dependency through npm install instead, or installing a different package through pnpm.

I have tried to exclude node_modules from analysis_options.yaml, but to no avail. It feels nonsensical for custom_lint to try and go lint node_modules.

I am also under the impression this causes some slowdowns to static analysis, but I have not tested it.

To Reproduce

I set up a minimal reproductible example at the following link. Steps for setup are in the readme.

Expected behavior
Able to run dart run custom_lint in pnpm workspace

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions