Skip to content

Optimize package.json loading for AmdModuleImportCheck - #334811

Merged
Dmitriy Vasyura (dmitrivMS) merged 5 commits into
microsoft:mainfrom
denizguney:patch-34
Sep 22, 2026
Merged

Dmitriy Vasyura (dmitrivMS) merged 5 commits into
microsoft:mainfrom
denizguney:patch-34

Conversation

@denizguney

Copy link
Copy Markdown
Contributor

Fixes #334810

Description

Moved package.json reading and parsing logic outside of the create() method to module scope in the AMD import ESLint rule.

Impact

Previously, readFileSync and JSON.parse were executed on every file scan. Caching this at the module level eliminates unnecessary disk I/O and speeds up lint runs across the repository.

Moved package.json reading outside of the rule module to reduce disk I/O and JSON parsing on each file scan.
Copilot AI balanced review requested due to automatic review settings September 6, 2026 15:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Note

This error may be related to your runner configuration. You can now configure runners for Copilot code review separately from Copilot cloud agent by creating a copilot-code-review.yml file with your setup steps. Read the docs for details.

Moved package.json reading and module list generation outside of the rule module to optimize performance.
Implement lazy initialization for cached modules and rethrow errors in catch block as suggested in review.
@dmitrivMS Dmitriy Vasyura (dmitrivMS) added engineering VS Code - Build / issue tracking / etc. vscode-build VS Code build process issues labels Sep 22, 2026
@dmitrivMS Dmitriy Vasyura (dmitrivMS) added this to the 1.140.0 milestone Sep 22, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

A failed initialization leaves an empty cache that silently disables subsequent checks.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
@dmitrivMS
Dmitriy Vasyura (dmitrivMS) merged commit 407c45e into microsoft:main Sep 22, 2026
53 of 54 checks passed

@christiaamichael-wq christiaamichael-wq left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@

@christiaamichael-wq christiaamichael-wq left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@denizguney

Copy link
Copy Markdown
Contributor Author

Hi team, thanks for reviewing and merging I noticed my name wasn't included in the contributors list for this release version, unlike my previous contributions. Could this be checked when you have a moment?

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

Labels

engineering VS Code - Build / issue tracking / etc. vscode-build VS Code build process issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

7 participants