Skip to content

perf(eslint): cache package.json read in AMD module import rule #334810

Closed

Description

  • VS Code Version: Main branch (Dev)
  • OS Version: N/A

Problem Description

In the ESLint rule responsible for checking AMD module imports (vscode-eslint-plugin-local), readFileSync and JSON.parse are executed inside the create(context) method.

Because create(context) runs for every evaluated file during linting, package.json is repeatedly read from the file system and parsed into memory hundreds or thousands of times.

Proposed Solution / Steps

Move package.json reading logic outside of the create() method (to module scope) so it only runs once per linting session, eliminating unnecessary disk I/O.

I have a fix ready and would be happy to submit a PR for this!

Activity

  1. added
    stale
    on Sep 13, 2026
  2. removed
    stale
    on Sep 22, 2026
  3. added
    unreleased
    on Sep 22, 2026
  4. added this to the 1.140.0 milestone on Sep 22, 2026
  5. added
    insiders-released
    and removed
    unreleased
    on Sep 23, 2026
  6. added
    bug
    on Sep 26, 2026
  7. added
    verified
    on Sep 28, 2026
  8. bhavyaus commented on Sep 28, 2026

    @bhavyaus
    Collaborator

    Verified by linting two virtual files in one ESLint process and confirming package.json was read only once while the rule still reported both violations.

  9. locked and limited conversation to collaborators on Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

buginsiders-releasedverified

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions