-
-
Notifications
You must be signed in to change notification settings - Fork 4
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: Use updated types from @eslint/core #66
base: main
Are you sure you want to change the base?
Conversation
|
||
json satisfies ESLint.Plugin; | ||
// json satisfies ESLint.Plugin; |
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.
RuleModule
is eslint
is not compatible with RuleDefinition
, so need to comment this out for now. I'll work on updating the types in eslint
next.
It looks like the type tests are failing because the json/tests/types/tsconfig.json Line 6 in a6c0bc9
We could remove that option for the moment since it's only used in the tests. In the long term I think it would be good to make sure that the |
Can you explain what the compatibility issue is? And why does running |
The issue is in the definition of export interface RuleVisitor {
/**
* Called for each node in the AST or at specific times during the traversal.
*/
[key: string]: (...args: any[]) => void;
} When the TypeScript For example: let ruleVisitor: RuleVisitor = {};
ruleVisitor.foo = undefined; // Error with strictNullChecks, else OK
interface Bar extends RuleVisitor {
bar?(): void; // Error with strictNullChecks, else OK
} The Lines 58 to 84 in fdde59d
It's possible that there are more incompatibilities in the core types but in this is the only one that's causing troubles with this PR. I tried manually changing the export type RuleVisitor = {
/**
* Called for each node in the AST or at specific times during the traversal.
*/
- [key: string]: (...args: any[]) => void;
+ [key in string]?: (...args: any[]) => void;
};
Because the |
Ah! That is very helpful, thank you. I think we should change |
Prerequisites checklist
What is the purpose of this pull request?
Update the plugin to use the latest types from
@eslint/core
.What changes did you make? (Give an overview)
types.ts
files to define types.RuleDefinition
typeJSONLanguage
to useIJSONLanguage
typeJSONSourceCode
to useIJSONSourceCode
typeRelated Issues
Is there anything you'd like reviewers to focus on?
The types test fails with this, and I don't understand why. The project builds just fine. Maybe @fasttime can take a look?