feat(packages/sui-lint): fix RepositoryLinter node_modules ignore for pnpm#1991
Merged
Conversation
… pnpm Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…positoryLinter Cypress creates screenshot directories named like .js files (e.g. cypress/screenshots/PTA/CategoryPicker.js). Match.create only checked isDirectory when path had no extension, causing EISDIR crash on readFileSync. Now checks isDirectory regardless of extension and returns an empty string for raw content so rules that access match.raw don't crash. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
kikoruiz
approved these changes
Jun 18, 2026
…ory handling Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
fast-globignore pattern inRepositoryLinter/Runner.jsto properly excludenode_modulesin pnpm-managed reposEISDIRcrash inMatch.jswhen directories have file-like extensions (e.g. Cypress screenshot dirs named*.js)Problem
OOM crash (Runner.js)
sui-lint repositoryOOMs (crashes at 2GB heap) when running in repositories that use pnpm as package manager.Root cause:
fast-glob@3treats the pattern'node_modules'as matching only the literal top-level entry. It does NOT recursively prevent traversal intonode_modules/.pnpm/— pnpm's store directory that contains thousands of symlinked packages. The glob**/*.(j|t)s(x)?then matches files deep inside.pnpm/, reading all of them into memory until the process runs out of heap.With the corrected pattern
'**/node_modules/**', fast-glob skips any directory namednode_modulesat any depth.EISDIR crash (Match.js)
Cypress creates screenshot directories named like
.jsfiles (e.g.cypress/screenshots/PTA/CategoryPicker.js).Match.createonly checkedisDirectory()when the path had no file extension, so these directories fell through tofs.readFileSync()which throwsEISDIR.Fix: Always check
isDirectory()regardless of extension. Directory matches getraw = ''(empty string) instead ofundefined, so rules that accessmatch.raw.match(...)don't crash with a TypeError.Results
Tested on
frontend-ma--web-app(pnpm 11, shamefully-hoist=true, ~10k source files).Test plan
sui-lint repositoryon a pnpm monorepo — completes without OOMsui-lint repositoryon a repo with Cypress screenshot directories — no EISDIR crashsui-lint repositoryon an npm monorepo — verify same behavior as before (no regression)🤖 Generated with Claude Code