-
-
Notifications
You must be signed in to change notification settings - Fork 35
fix: make data property stricter
#327
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
base: main
Are you sure you want to change the base?
Conversation
| * The data to insert into the message. | ||
| */ | ||
| data?: Record<string, unknown> | undefined; | ||
| data?: |
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 think rather than the note, we should use a type alias to make sure they are in sync:
type MessagePlaceholderData = Record<string, string | number | boolean | bigint | null | undefined> and then reference them for the root and suggestions.
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.
Yes — this approach makes sense to me as well.
I also checked eslint’s types, and it looks like there are two other places this type could be reused:
- https://github.com/eslint/eslint/blob/main/lib/types/index.d.ts#L1378
- https://github.com/eslint/eslint/blob/main/lib/types/index.d.ts#L1390
So maybe define a reusable type like the following, export it, and apply it in eslint once a new version of @eslint/core is released?
export type MessagePlaceholderData = Record<string, string | number | boolean | bigint | null | undefined> | undefined;Any further thoughts on this @eslint/eslint-team ?
If this approach and the type name look reasonable, I can go ahead and open a PR in eslint for this change.
Prerequisites checklist
What is the purpose of this pull request?
In this PR, I've resolved the issue metioned in #310.
I've updated the
dataproperty to acceptstring | number | boolean | bigint | null | undefinedand added test cases to ensure it works.What changes did you make? (Give an overview)
In this PR, I've resolved the issue metioned in #310.
Related Issues
Closes: #310
Is there anything you'd like reviewers to focus on?
N/A