-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
feat: support JSRuleDefinition
type
#19604
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
feat: support JSRuleDefinition
type
#19604
Conversation
✅ Deploy Preview for docs-eslint ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
….com/lumirlumir/fork-eslint into feat-support-js-rule-definition-type
lib/types/index.d.ts
Outdated
type JSRuleDefinitionTypeOptions = { | ||
RuleOptions: unknown[]; | ||
MessageIds: string; | ||
ExtRuleDocs: Record<string, unknown>; | ||
}; |
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.
We keep defining this structure in every plugin. Maybe we should make a generic RuleDefinitionTypeOptions
in @eslint/core
instead of copying this everywhere? @fasttime what do you think?
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.
We are already exporting an interface with that name (https://github.com/eslint/rewrite/blob/core-v0.13.0/packages/core/src/types.ts#L545-L556), but we could export a new type just for those options that should be customizable for a language-specific RuleDefinition
generic type.
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.
I opened an issue in the rewrite repo: eslint/rewrite#177
I've moved |
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.
LGTM, thanks! Leaving open for @nzakas to review.
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.
LGTM. Thanks!
Prerequisites checklist
What is the purpose of this pull request? (put an "X" next to an item)
[ ] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofix to a rule
[ ] Add a CLI option
[X] Add something to the core
[ ] Other, please explain:
What changes did you make? (Give an overview)
Hello,
This PR addresses #19521.
I've implemented tests for
JSRuleDefinition
by referencing the existing test in@eslint/markdown
.The most notable change in this PR is the addition of the
JSRuleDefinition
type to theRule
namespace, in order to follow the existing convention.Is there anything you'd like reviewers to focus on?
Fixes: #19521