Skip to content

[WIP] Fix ignore patterns for files in node_modules paths#242

Draft
Copilot wants to merge 1 commit into
mainfrom
copilot/fix-ignore-patterns-issue
Draft

[WIP] Fix ignore patterns for files in node_modules paths#242
Copilot wants to merge 1 commit into
mainfrom
copilot/fix-ignore-patterns-issue

Conversation

Copilot AI commented Jan 22, 2026

Copy link
Copy Markdown
Contributor

Thanks for assigning this issue to me. I'm starting to work on it and will keep this PR's description up to date as I form a plan and make progress.

Original prompt

This section details on the original issue you should resolve

<issue_title>Ignore patterns fail for files containing node_modules in git submodule paths</issue_title>
<issue_description>## Bug Description

When ignoring a git submodule directory (e.g., TypeScript/**), files that contain node_modules, nodeModules, or NodeModulesSearch in their path are incorrectly included in the output despite matching the ignore pattern.

Environment

  • yek version: 0.25.0
  • OS: macOS

Reproduction Steps

# Clone a repo with TypeScript as a submodule
git clone --recurse-submodules <your-repo-with-typescript-submodule>

# Run yek with ignore pattern
yek --ignore-patterns "TypeScript/**" --tokens=100k 2>&1 | grep "^>>>> TypeScript"

Expected Behavior

All files under TypeScript/ should be ignored.

Actual Behavior

While 74,742 TypeScript submodule files are correctly skipped, 45 files leak through. All 45 files contain node_modules, nodeModules, or NodeModulesSearch in their path:

TypeScript/tests/baselines/reference/project/nodeModulesImportHigher/amd/importHigher/root.js
TypeScript/tests/baselines/reference/project/nodeModulesImportHigher/amd/nodeModulesImportHigher.errors.txt
TypeScript/tests/baselines/reference/project/nodeModulesMaxDepthExceeded/amd/maxDepthExceeded/built/node_modules/m1/index.js
TypeScript/tests/cases/projects/NodeModulesSearch/importHigher/node_modules/m1/index.js
... (45 files total)

Debug Evidence

Running with --debug shows inconsistent behavior for similar paths:

File correctly skipped:

DEBUG Skipping ignored file: TypeScript/tests/baselines/reference/project/maprootUrlSingleFileNoOutdir/amd/test.js

File incorrectly included:

DEBUG File: TypeScript/tests/baselines/reference/project/nodeModulesImportHigher/amd/importHigher/root.js | Category: test | Rule priority: 0

Both paths match TypeScript/** pattern identically, but one is skipped and one is not. The only difference is the presence of nodeModules in the directory name.

Analysis

There appears to be special handling for node_modules paths that is incorrectly un-ignoring these files even when they match explicit ignore patterns. This may be related to:

  1. Default node_modules/** ignore pattern interaction with user patterns
  2. Pattern matching order or priority
  3. Some allowlist/unignore logic being triggered by node_modules substring

Full List of Leaked Files

All 45 files incorrectly included (click to expand)
TypeScript/tests/baselines/reference/project/nodeModulesImportHigher/amd/importHigher/root.js
TypeScript/tests/baselines/reference/project/nodeModulesImportHigher/amd/nodeModulesImportHigher.errors.txt
TypeScript/tests/baselines/reference/project/nodeModulesImportHigher/amd/nodeModulesImportHigher.json
TypeScript/tests/baselines/reference/project/nodeModulesImportHigher/node/importHigher/root.js
TypeScript/tests/baselines/reference/project/nodeModulesImportHigher/node/nodeModulesImportHigher.errors.txt
TypeScript/tests/baselines/reference/project/nodeModulesImportHigher/node/nodeModulesImportHigher.json
TypeScript/tests/baselines/reference/project/nodeModulesMaxDepthExceeded/amd/maxDepthExceeded/built/node_modules/m1/index.js
TypeScript/tests/baselines/reference/project/nodeModulesMaxDepthExceeded/amd/maxDepthExceeded/built/node_modules/m1/relative.js
TypeScript/tests/baselines/reference/project/nodeModulesMaxDepthExceeded/amd/maxDepthExceeded/built/root.js
TypeScript/tests/baselines/reference/project/nodeModulesMaxDepthExceeded/amd/nodeModulesMaxDepthExceeded.errors.txt
TypeScript/tests/baselines/reference/project/nodeModulesMaxDepthExceeded/amd/nodeModulesMaxDepthExceeded.json
TypeScript/tests/baselines/reference/project/nodeModulesMaxDepthExceeded/node/maxDepthExceeded/built/node_modules/m1/index.js
TypeScript/tests/baselines/reference/project/nodeModulesMaxDepthExceeded/node/maxDepthExceeded/built/node_modules/m1/relative.js
TypeScript/tests/baselines/reference/project/nodeModulesMaxDepthExceeded/node/maxDepthExceeded/built/root.js
TypeScript/tests/baselines/reference/project/nodeModulesMaxDepthExceeded/node/nodeModulesMaxDepthExceeded.errors.txt
TypeScript/tests/baselines/reference/project/nodeModulesMaxDepthExceeded/node/nodeModulesMaxDepthExceeded.json
TypeScript/tests/baselines/reference/project/nodeModulesMaxDepthIncreased/amd/maxDepthIncreased/root.js
TypeScript/tests/baselines/reference/project/nodeModulesMaxDepthIncreased/amd/nodeModulesMaxDepthIncreased.errors.txt
TypeScript/tests/baselines/reference/project/nodeModulesMaxDepthIncreased/amd/nodeModulesMaxDepthIncreased.json
TypeScript/tests/baselines/reference/project/nodeModulesMaxDepthIncreased/node/maxDepthIncreased/root.js
TypeScript/tests/baselines/reference/project/nodeModulesMaxDepthIncreased/node/nodeModulesMaxDepthIncreased.errors.txt
TypeScript/tests/baselines/reference/project/nodeModulesMaxDepthIncrease...

</details>



<!-- START COPILOT CODING AGENT SUFFIX -->

- Fixes mohsen1/yek#241

<!-- START COPILOT CODING AGENT TIPS -->
---

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants