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.
[eslint-miner] Require try/catch around fs.realpathSync calls #56612
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
[eslint-miner] Require try/catch around fs.realpathSync calls #56612
Changes from all commits
a691d74f476e40File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[/tdd] The README explicitly documents "no autofix for
VariableDeclaration" as a known limitation, but there is no test case covering that path — the rule could silently regress forconst resolved = fs.realpathSync(path);without any test catching it.💡 Suggested test case
Add an
itblock that asserts the call is still flagged but produces zero suggestions:This pins the documented behaviour and prevents a silent regression.
@copilot please address this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eslint-factory/src/rules/require-realpathsync-try-catch.ts:8: yagni: one-off realpathSync rule added as a bespoke 69-line wrapper. Replace it with a generic fs-sync rule generator so mkdirSync/mkdtempSync/rmSync/realpathSync all share one implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This rule inherits
allowUnboundFsIdentifier: true, so it will flag any barefs.realpathSync(...)call even when the file does not import or require Node'sfsmodule, which creates false positives against projects that happen to have a different global or ambientfsobject.💡 Why this is a real correctness bug
createFsSyncMethodResolver(..., { allowUnboundFsIdentifier: true })explicitly treats an unbound identifier namedfsas the Nodefsmodule. That means code like this will now be warned on incorrectly:This is not just a theoretical lint nit: once the rule ships as part of the shared config, consumers get noise on code the rule cannot prove is Node
fs, which erodes trust in the whole ruleset.Please either disable
allowUnboundFsIdentifierfor this rule or add coverage proving that unboundfs.realpathSync(...)is intentionally safe to treat as Nodefsin this codebase.Uh oh!
There was an error while loading. Please reload this page.