Skip to content

fix: try/catch enumerator.iterateFiles gracefully#360

Merged
JounQin merged 2 commits intomasterfrom
fix/no-unused-modules
May 31, 2025
Merged

fix: try/catch enumerator.iterateFiles gracefully#360
JounQin merged 2 commits intomasterfrom
fix/no-unused-modules

Conversation

@JounQin
Copy link
Copy Markdown
Member

@JounQin JounQin commented May 30, 2025

Important

Improve error handling for enumerator.iterateFiles in no-unused-modules.ts with try/catch and update documentation for flat config compatibility.

  • Error Handling:
    • Add try/catch block in listFilesUsingFileEnumerator() in no-unused-modules.ts to handle errors from enumerator.iterateFiles.
    • Throws specific error if using flat config without .eslintrc.
  • Documentation:
    • Update no-unused-modules.md to clarify rule compatibility with flat config.
  • Dependencies:
    • Add @types/tmp and tmp to package.json.
  • Testing:
    • Add tests in no-unused-modules.spec.ts to verify error handling with ESLint v9.

This description was created by Ellipsis for 1e09f8b. You can customize this summary. It will automatically update as commits are pushed.


Summary by CodeRabbit

  • Bug Fixes
    • Enhanced error handling during file processing to prevent crashes and deliver clearer messages when ESLint flat config is detected.
  • Documentation
    • Clarified compatibility notes for the no-unused-modules rule regarding legacy and flat ESLint configurations.
  • Chores
    • Added new test fixtures and configurations to support ESLint version 9 testing scenarios.
    • Updated development dependencies and test utilities to improve ESLint version detection and testing reliability.

@JounQin JounQin requested a review from Copilot May 30, 2025 23:36
@JounQin JounQin self-assigned this May 30, 2025
@JounQin JounQin added the bug Something isn't working label May 30, 2025
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented May 30, 2025

🦋 Changeset detected

Latest commit: 1e09f8b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
eslint-plugin-import-x Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented May 30, 2025

Walkthrough

A new changeset was added documenting a patch for the "eslint-plugin-import-x" package. In the code, the function for listing files was renamed and enhanced to detect ESLint's flat config mode, improving error handling during file enumeration. Calls to the old function were updated to use the new implementation. Additionally, the comprehensive ESLint configuration file was removed and replaced with an empty config. New test fixtures and tests for ESLint v9 compatibility were added, along with updated documentation and dev dependencies.

Changes

File(s) Change Summary
.changeset/curvy-swans-ring.md Added a changeset documenting a patch for improved error handling in file iteration for "eslint-plugin-import-x".
src/rules/no-unused-modules.ts Renamed and enhanced file listing function to detect flat config, added robust error handling, and updated function usage accordingly.
.eslintrc.cjs Removed detailed ESLint configuration, replaced with an empty export object.
docs/rules/no-unused-modules.md Updated rule documentation to clarify compatibility with flat config and allowance of empty legacy config.
package.json Added "tmp" package and its type definitions to devDependencies.
test/fixtures/eslint-v9/* Added new ESLint v9 test fixture files including config, package.json, source files, .gitignore, and .npmrc.
test/rules/no-unused-modules.spec.ts Added ESLint v9 conditional test verifying error thrown when no .eslintrc is present with the rule enabled.
test/utils.ts Added exported constant isESLint9 to detect ESLint version 9 or higher.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Rule as no-unused-modules Rule
    participant Enumerator as FileEnumerator
    participant ESLint

    User->>Rule: Invoke rule (resolveFiles)
    Rule->>Rule: listFilesUsingFileEnumerator(src, extensions)
    Rule->>ESLint: Check flat config (env var/API)
    Rule->>Enumerator: Iterate files (try/catch)
    alt Success
        Enumerator-->>Rule: Return files
    else Error (flat config detected)
        Rule-->>User: Throw detailed flat config error
    else Other error
        Rule-->>User: Rethrow original error
    end
Loading

Possibly related PRs

Poem

In the warren of code, a patch hops in,
With careful paws, it guards where errors begin.
Flat configs detected, exceptions now tamed,
Files enumerated, no more rules blamed!
A rabbit’s delight in code that won’t fall,
Hopping ahead, outsmarting them all! 🐇

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

test/fixtures/eslint-v9/src/depth-zero.js

Oops! Something went wrong! :(

ESLint: 9.28.0

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/lib/index.js' imported from /eslint.config.js
at finalizeResolution (node:internal/modules/esm/resolve:274:11)
at moduleResolve (node:internal/modules/esm/resolve:859:10)
at defaultResolve (node:internal/modules/esm/resolve:983:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:799:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:723:25)
at ModuleLoader.resolve (node:internal/modules/esm/loader:706:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:307:38)
at #link (node:internal/modules/esm/module_job:170:49)

.eslintrc.cjs

Oops! Something went wrong! :(

ESLint: 9.28.0

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/lib/index.js' imported from /eslint.config.js
at finalizeResolution (node:internal/modules/esm/resolve:274:11)
at moduleResolve (node:internal/modules/esm/resolve:859:10)
at defaultResolve (node:internal/modules/esm/resolve:983:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:799:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:723:25)
at ModuleLoader.resolve (node:internal/modules/esm/loader:706:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:307:38)
at #link (node:internal/modules/esm/module_job:170:49)

src/rules/no-unused-modules.ts

Oops! Something went wrong! :(

ESLint: 9.28.0

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/lib/index.js' imported from /eslint.config.js
at finalizeResolution (node:internal/modules/esm/resolve:274:11)
at moduleResolve (node:internal/modules/esm/resolve:859:10)
at defaultResolve (node:internal/modules/esm/resolve:983:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:799:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:723:25)
at ModuleLoader.resolve (node:internal/modules/esm/loader:706:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:307:38)
at #link (node:internal/modules/esm/module_job:170:49)

  • 4 others

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 666a0ab and 1e09f8b.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (12)
  • .eslintrc.cjs (1 hunks)
  • docs/rules/no-unused-modules.md (1 hunks)
  • package.json (2 hunks)
  • src/rules/no-unused-modules.ts (2 hunks)
  • test/fixtures/eslint-v9/.gitignore (1 hunks)
  • test/fixtures/eslint-v9/.npmrc (1 hunks)
  • test/fixtures/eslint-v9/eslint.config.mjs (1 hunks)
  • test/fixtures/eslint-v9/package.json (1 hunks)
  • test/fixtures/eslint-v9/src/depth-zero.js (1 hunks)
  • test/fixtures/eslint-v9/src/exports.js (1 hunks)
  • test/rules/no-unused-modules.spec.ts (3 hunks)
  • test/utils.ts (2 hunks)
✅ Files skipped from review due to trivial changes (8)
  • test/fixtures/eslint-v9/.npmrc
  • package.json
  • test/fixtures/eslint-v9/.gitignore
  • test/fixtures/eslint-v9/src/depth-zero.js
  • test/utils.ts
  • test/fixtures/eslint-v9/src/exports.js
  • test/fixtures/eslint-v9/package.json
  • test/fixtures/eslint-v9/eslint.config.mjs
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/rules/no-unused-modules.ts
🧰 Additional context used
🧬 Code Graph Analysis (1)
test/rules/no-unused-modules.spec.ts (1)
test/utils.ts (2)
  • isESLint9 (26-26)
  • testFilePath (42-44)
⏰ Context from checks skipped due to timeout of 90000ms (21)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 9 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 8 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 9 on windows-latest
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8.56 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 9 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 9 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 9 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8.56 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 9 on macos-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 9 on macos-latest
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 9 on macos-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 9 on macos-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8 on macos-latest
🔇 Additional comments (4)
.eslintrc.cjs (1)

1-3: LGTM! The empty config aligns with the PR objectives.

This change correctly provides a minimal .eslintrc file to satisfy the no-unused-modules rule requirement when testing with flat config, as documented in the updated rule documentation.

docs/rules/no-unused-modules.md (1)

12-12: Documentation accurately reflects the implementation.

The clarification that the legacy eslintrc config can be empty is helpful and consistent with the error message in the code implementation.

test/rules/no-unused-modules.spec.ts (2)

1-2: Imports are appropriate for the new test functionality.

The added imports for execSync, ChildProcess, and dirSync are necessary for the new ESLint 9+ test suite that creates temporary directories and executes npm commands.

Also applies to: 12-12


1572-1607: Well-structured test for the new error handling functionality.

The test effectively verifies that the no-unused-modules rule produces a meaningful error message when used with ESLint flat config without an .eslintrc file. The implementation is clean with proper:

  • Conditional execution for ESLint 9+
  • Temporary directory handling with cleanup
  • Error message verification
  • Reasonable timeout for npm operations
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@petercat-assistant
Copy link
Copy Markdown

Walkthrough

This pull request introduces a try/catch mechanism around the enumerator.iterateFiles function to handle errors gracefully, especially when using ESLint's flat config. It modifies the logic to detect the use of flat config and throws a specific error message if the configuration is missing.

Changes

File Summary
.changeset/curvy-swans-ring.md Added a changeset file for the patch fix.
src/rules/no-unused-modules.ts Refactored the file processing function to include error handling for missing ESLint configuration when using flat config.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the file enumeration logic in the no-unused-modules rule to handle errors from FileEnumerator.iterateFiles more gracefully under ESLint flat config.

  • Added detection for flat config via shouldUseFlatConfig and ESLINT_USE_FLAT_CONFIG
  • Wrapped iterateFiles calls in try/catch to rethrow a clearer error when no configuration is found
  • Renamed listFilesToProcess to listFilesUsingFileEnumerator for clarity

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/rules/no-unused-modules.ts Enhanced file enumeration with flat config detection and improved error handling
.changeset/curvy-swans-ring.md Added changelog entry for the new graceful error handling
Comments suppressed due to low confidence (1)

src/rules/no-unused-modules.ts:55

  • This new try/catch branch for iterateFiles should have accompanying unit tests covering both the flat-config error path and the normal path to ensure correct behavior.
  try {

@codesandbox-ci
Copy link
Copy Markdown

codesandbox-ci bot commented May 30, 2025

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@codacy-production
Copy link
Copy Markdown

codacy-production bot commented May 30, 2025

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
-0.10% (target: -1.00%) 75.00%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (dfcbe2c) 3669 3510 95.67%
Head commit (1e09f8b) 3676 (+7) 3513 (+3) 95.57% (-0.10%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#360) 16 12 75.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

@codecov
Copy link
Copy Markdown

codecov bot commented May 30, 2025

Codecov Report

Attention: Patch coverage is 66.66667% with 7 lines in your changes missing coverage. Please review.

Project coverage is 96.02%. Comparing base (dfcbe2c) to head (1e09f8b).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/rules/no-unused-modules.ts 63.15% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #360      +/-   ##
==========================================
- Coverage   96.16%   96.02%   -0.14%     
==========================================
  Files          93       93              
  Lines        4879     4884       +5     
  Branches     1814     1834      +20     
==========================================
- Hits         4692     4690       -2     
- Misses        186      193       +7     
  Partials        1        1              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented May 30, 2025

Open in StackBlitz

npm i https://pkg.pr.new/eslint-plugin-import-x@360

commit: 1e09f8b

Copy link
Copy Markdown

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

Looks good to me! 👍

Reviewed everything up to 666a0ab in 1 minute and 47 seconds. Click for details.
  • Reviewed 103 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 4 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. .changeset/curvy-swans-ring.md:5
  • Draft comment:
    Changeset message is clear and concise.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
2. src/rules/no-unused-modules.ts:26
  • Draft comment:
    Destructure 'shouldUseFlatConfig' along with 'FileEnumerator'. Ensure its API is used correctly—if it's a function in ESLint v9, consider invoking it (e.g. shouldUseFlatConfig()) rather than using it directly.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% The code already destructures shouldUseFlatConfig correctly. The comment suggests using it as a function call, but looking at lines 43-45, it's clear the code intentionally uses it as a boolean check with a ts-expect-error comment indicating this is the correct usage for ESLint v9. The comment seems to misunderstand the intended usage. Could there be documentation or ESLint v9 API specs that show shouldUseFlatConfig should be used as a function? Could the ts-expect-error be masking a real type issue? The code's usage matches the comments around it explaining ESLint v9 compatibility. The ts-expect-error is explicitly explained as handling the v9-only API. The boolean usage appears intentional and correct. The comment should be deleted as it incorrectly suggests changing working code that is already handling the API correctly for both v8 and v9 compatibility.
3. src/rules/no-unused-modules.ts:42
  • Draft comment:
    The try/catch block initializing 'isUsingFlatConfig' safely handles potential issues. Verify whether 'shouldUseFlatConfig' should be invoked as a function (e.g. shouldUseFlatConfig()) in ESLint v9 rather than accessed directly.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 0% vs. threshold = 50% The code is specifically handling ESLint v9 compatibility. The comment suggests a potential bug where shouldUseFlatConfig might be a function rather than a property in v9. However, without being able to verify the ESLint v9 API directly, I can't be 100% certain if shouldUseFlatConfig is meant to be a function or property. The code has a @ts-expect-error suggesting some uncertainty about the types. I don't have direct access to ESLint v9's API documentation or source code to verify if shouldUseFlatConfig is definitely a function. The existing code may already be correct. While the comment raises a valid question about the API usage, without clear evidence that shouldUseFlatConfig is definitely a function in v9, we can't be certain the current code is wrong. Since we don't have strong evidence that the current code is incorrect, and the comment is speculative about how the API should be used, we should remove this comment.
4. src/rules/no-unused-modules.ts:68
  • Draft comment:
    The multi-line error message template includes a leading newline. Consider trimming it to avoid unintended formatting in the error output.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% The leading newline is likely intentional to ensure the error message displays cleanly in the terminal. Error messages often benefit from starting on a new line for readability. The current format makes the message more readable and easier to distinguish from the stack trace. Removing the newline could make the error harder to read. The comment could be right that the newline is unintended. Maybe there are ESLint error message formatting conventions I'm not aware of. Even if there are conventions, the readability benefit of the newline likely outweighs strict adherence to a format. The current format serves a clear purpose in making the error more readable. The comment should be deleted. The leading newline appears intentional and beneficial for error message readability. This is a matter of style preference rather than a clear improvement.

Workflow ID: wflow_FwQtzr8LVeg163Jo

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dfcbe2c and 666a0ab.

📒 Files selected for processing (2)
  • .changeset/curvy-swans-ring.md (1 hunks)
  • src/rules/no-unused-modules.ts (2 hunks)
🧰 Additional context used
🪛 GitHub Check: codecov/patch
src/rules/no-unused-modules.ts

[warning] 49-49: src/rules/no-unused-modules.ts#L49
Added line #L49 was not covered by tests


[warning] 66-66: src/rules/no-unused-modules.ts#L66
Added line #L66 was not covered by tests


[warning] 68-68: src/rules/no-unused-modules.ts#L68
Added line #L68 was not covered by tests


[warning] 80-80: src/rules/no-unused-modules.ts#L80
Added line #L80 was not covered by tests

⏰ Context from checks skipped due to timeout of 90000ms (172)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 9 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8 on ubuntu-latest
  • GitHub Check: autofix
  • GitHub Check: Analyze (actions)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 9 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 9 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 9 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8.56 on ubuntu-latest
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 9 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8 on ubuntu-latest
  • GitHub Check: autofix
  • GitHub Check: Analyze (actions)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 9 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 9 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 9 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8.56 on ubuntu-latest
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 9 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8 on ubuntu-latest
  • GitHub Check: autofix
  • GitHub Check: Analyze (actions)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 9 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 9 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 9 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8.56 on ubuntu-latest
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 9 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8 on ubuntu-latest
  • GitHub Check: autofix
  • GitHub Check: Analyze (actions)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 9 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 9 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 9 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 9 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8.56 on ubuntu-latest
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 9 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8 on ubuntu-latest
  • GitHub Check: autofix
  • GitHub Check: Analyze (actions)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 9 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 9 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 9 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 9 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8.56 on ubuntu-latest
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 9 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8 on ubuntu-latest
  • GitHub Check: Analyze (actions)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 9 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 9 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 9 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 9 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8.56 on ubuntu-latest
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 9 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8 on ubuntu-latest
  • GitHub Check: Analyze (actions)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 9 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 9 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 9 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 9 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8.56 on ubuntu-latest
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 9 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8 on ubuntu-latest
  • GitHub Check: Analyze (actions)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 9 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 9 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 9 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 9 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8.56 on ubuntu-latest
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 9 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8 on ubuntu-latest
  • GitHub Check: Analyze (actions)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 9 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 9 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 9 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 9 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8.56 on ubuntu-latest
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 9 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8 on ubuntu-latest
  • GitHub Check: Analyze (actions)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 9 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 9 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 9 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 9 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8.56 on ubuntu-latest
🔇 Additional comments (5)
src/rules/no-unused-modules.ts (4)

26-26: LGTM - Good addition of shouldUseFlatConfig import.

The destructuring of shouldUseFlatConfig from eslintUnsupportedApi is correctly added to support the flat config detection logic.


28-31: Clear function naming and parameter documentation.

The function renaming from listFilesToProcess to listFilesUsingFileEnumerator is more descriptive and accurately reflects its implementation using FileEnumerator.


189-189: Function call correctly updated.

The call to listFilesUsingFileEnumerator correctly replaces the old function name for source files enumeration.


192-195: Function call correctly updated for ignored files.

The call to listFilesUsingFileEnumerator correctly replaces the old function name for ignored files enumeration, maintaining the same parameter structure.

.changeset/curvy-swans-ring.md (1)

1-6: Well-documented changeset for the error handling improvement.

The changeset correctly documents this as a patch-level change and accurately describes the fix for graceful error handling around enumerator.iterateFiles. The title aligns with the PR objective and the implementation changes.

@socket-security
Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​types/​tmp@​0.2.61001007076100

View full report

Copy link
Copy Markdown

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

Looks good to me! 👍

Reviewed 1e09f8b in 1 minute and 27 seconds. Click for details.
  • Reviewed 378 lines of code in 12 files
  • Skipped 1 files when reviewing.
  • Skipped posting 5 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. test/utils.ts:63
  • Draft comment:
    The default parserOptions set ecmaVersion to 9 which may be outdated for modern syntax. Consider updating it to a more recent ECMAScript version (e.g. 2018+) to support newer language features.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
2. test/utils.ts:152
  • Draft comment:
    Avoid using the 'as never' cast when merging test case options. Using such a cast can mask type errors; prefer a more precise type assertion to maintain type safety.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
3. test/utils.ts:32
  • Draft comment:
    Consider caching the result of requiring '@typescript-eslint/parser/package.json' to avoid repeated file system accesses if this function is called multiple times.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
4. test/utils.ts:28
  • Draft comment:
    Consider adding explicit return types for exported functions (e.g. tsVersionSatisfies) to improve readability and maintainability.
  • Reason this comment was not posted:
    Comment was on unchanged code.
5. package.json:126
  • Draft comment:
    There appears to be a typographical error in the dependency name on line 126. It is written as "@unts/patch-package"; please double-check if this should be "@un-ts/patch-package" or the intended name.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.

Workflow ID: wflow_Oqhgh3TBFMRUGaiC

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@JounQin JounQin merged commit 3a3f5f8 into master May 31, 2025
90 of 92 checks passed
@JounQin JounQin deleted the fix/no-unused-modules branch May 31, 2025 00:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants