Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@jaymarvelz
Copy link
Contributor

@jaymarvelz jaymarvelz commented Oct 8, 2025

Prerequisites checklist

What is the purpose of this pull request? (put an "X" next to an item)

[ ] Documentation update
[x] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofix to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:

What changes did you make? (Give an overview)

  • Added onUnreachableCodePathSegmentStart and onUnreachableCodePathSegmentEnd to Rule.RuleListener to match emitted code-path events.
  • Updated typing to use RuleListener as the visitor:
    • Rule.RuleModule’s Visitor is now RuleListener, and create() returns RuleListener.
    • JSRuleDefinition’s Visitor is also set to Rule.RuleListener.

Is there anything you'd like reviewers to focus on?

@github-project-automation github-project-automation bot moved this to Needs Triage in Triage Oct 8, 2025
@netlify
Copy link

netlify bot commented Oct 8, 2025

Deploy Preview for docs-eslint canceled.

Name Link
🔨 Latest commit dac56d9
🔍 Latest deploy log https://app.netlify.com/projects/docs-eslint/deploys/68f9a0307de9d20008403b54

@eslint-github-bot eslint-github-bot bot added the bug ESLint is working incorrectly label Oct 8, 2025
Copy link
Contributor

@DMartens DMartens left a comment

Choose a reason for hiding this comment

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

Changes LGTM, thanks for finding the inconsistencies.
Is there any reason this is marked as a draft?

@DMartens DMartens moved this from Needs Triage to Triaging in Triage Oct 9, 2025
@aladdin-add aladdin-add moved this from Triaging to Implementing in Triage Oct 11, 2025
@aladdin-add aladdin-add added the accepted There is consensus among the team that this change meets the criteria for inclusion label Oct 11, 2025
@jaymarvelz
Copy link
Contributor Author

@DMartens I pushed some more typing improvements. I believe eslint/rewrite#298 should fix the CI. Let me know your thoughts!


interface ReportDescriptorOptionsBase {
data?: { [key: string]: string };
data?: Record<string, unknown> | undefined;
Copy link
Contributor

@DMartens DMartens Oct 17, 2025

Choose a reason for hiding this comment

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

Why explicitly allow undefined? This property should either be unset or an object as the context.report method ignores any falsy value for the data.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This mirrors the data type from the core package, which is what context.report uses. Since data can be explicitly set to undefined without ESLint throwing, I don’t see this as a bug. Removing undefined might even be a breaking change.

Copy link
Contributor

Choose a reason for hiding this comment

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

My point is that data can be explicitly set to null, false or any other falsy value without throwing. But the point of the types in this case is to guide to rule developers and not expose implementation details.
Further eslint also does not throw for passing additional properties to context.report but I do not think we should add an index signature to explicitly allow it.
To put in other words, why should a rule developer explicitly set data: undefined?
(Side note: I think the undefined is included because many use optional properties together with undefined to not differentiate between missing property and setting it explicitly to undefined)

Copy link
Contributor Author

@jaymarvelz jaymarvelz Oct 21, 2025

Choose a reason for hiding this comment

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

What I'm saying is that the data in context.report is typed as Record<string, unknown> | undefined. This change simply mirrors the data type from the core package. If we want to omit undefined, that would need to be addressed in the core package first, which I believe would be a breaking change. Unless, of course, you're suggesting we diverge the data type here from the core one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The next version of @eslint/core will export types that we can use here. I’ve reverted my last commit and opened a separate PR to refactor this: #20235

@DMartens
Copy link
Contributor

Thanks for finding additional inconsistencies.
I agree that the other PR should fix the CI failure.

@jaymarvelz jaymarvelz marked this pull request as ready for review October 22, 2025 03:57
@jaymarvelz jaymarvelz requested a review from a team as a code owner October 22, 2025 03:57
@fasttime fasttime added types Related to TypeScript types contributor pool labels Oct 22, 2025
Copy link
Member

@fasttime fasttime left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@fasttime fasttime merged commit b165d47 into eslint:main Oct 23, 2025
32 checks passed
@github-project-automation github-project-automation bot moved this from Implementing to Complete in Triage Oct 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

accepted There is consensus among the team that this change meets the criteria for inclusion bug ESLint is working incorrectly contributor pool types Related to TypeScript types

Projects

Status: Complete

Development

Successfully merging this pull request may close these issues.

4 participants