-
Notifications
You must be signed in to change notification settings - Fork 73
fix!: move certain types to import them from @eslint/markdown/types
#446
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
fix!: move certain types to import them from @eslint/markdown/types
#446
Conversation
src/index.js
Outdated
*/ | ||
/** @typedef {MarkdownRuleDefinition} RuleModule */ | ||
/** @typedef {import("./types.ts").MarkdownRuleVisitor} MarkdownRuleVisitor */ | ||
/** @typedef {import("./types.ts").MarkdownRuleDefinition} RuleModule */ |
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.
/** @typedef {import("./types.ts").MarkdownRuleDefinition} RuleModule */ | |
/** @typedef {import("./types.ts").MarkdownRuleDefinition} RuleModule */ |
I'm not sure whether we should remove the RuleModule
type or not.
This RuleModule
type was originally introduced in #333 to align with the current Rule.RuleModule
implementation in eslint
:
However, a notable point is that the RuleModule
type does not exist in the JSON or CSS plugins.
So, I think a decision from @eslint/eslint-tsc is needed on whether we should retain the RuleModule
type in @eslint/markdown
or not.
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
RuleModule
type was originally introduced in #333 to align with the currentRule.RuleModule
implementation ineslint
It looks like that type was already exported before #333. I can trace it back to @eslint/markdown
v6.0.0:
https://github.com/eslint/markdown/blob/v6.0.0/src/index.js#L22
It was later changed to match the definition of MarkdownRuleDefinition
in #324.
However, a notable point is that the
RuleModule
type does not exist in the JSON or CSS plugins.So, I think a decision from @eslint/eslint-tsc is needed on whether we should retain the
RuleModule
type in@eslint/markdown
or not.
Since we are going to have a major release, I think it's the right time to remove RuleModule
👍
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.
Sounds good to me 👍
I'll remove the RuleModule
type and the related test cases once #367 is merged.
tests/types/types.test.ts
Outdated
@@ -1,11 +1,14 @@ | |||
import markdown, { | |||
MarkdownSourceCode, | |||
MarkdownRuleDefinition, | |||
MarkdownRuleVisitor, | |||
type RuleModule, |
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.
type RuleModule, | |
type RuleModule, |
Same with #446 (comment)
I've removed the |
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. Would like @fasttime to review before merging.
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?
Hello.
The purpose of this PR is to align the type import path with the JSON and CSS plugins.
This is a breaking change, and it was discussed in #367 (comment) Also, it serves as a prerequisite for #367.
Currently, we import
*RuleDefinition
and*RuleVisitor
types directly from the main entry point, like@eslint/markdown
.This PR moves those types under
@eslint/markdown/types
.Here are some references:
Looking at the
dist
folders of the JSON and CSS plugins, they do not export*RuleDefinition
and*RuleVisitor
types from their main entries (e.g.,@eslint/json
,@eslint/css
).Instead, they export those types from
@eslint/json/types
and@eslint/css/types
, respectively.One thing I'm unsure about is how we should handle the
RuleModule
type in the Markdown plugin.I've left a detailed comment regarding this concern.
What changes did you make? (Give an overview)
Related Issues
Ref: #367 (comment)
Is there anything you'd like reviewers to focus on?