-
Notifications
You must be signed in to change notification settings - Fork 200
refactor(type)!: use explicit parameters in all functions #616
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
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
|
||
| // Invokes the function on the editor using the args | ||
| action.apply(this, args); | ||
| action(this, cell, evt); |
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.
question: check if removing the binding to this may not introduce regression.
We probably should revert this change as it is out of the scope of this PR.
| return (<Editor>this.editor).graph.cloneCell(ptype); | ||
| } | ||
| return null; | ||
| return (<Editor>this.editor).graph.cloneCell(ptype); |
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.
question: check if this simplification doesn't introduce regression.
We should revert it, as it is out of the scope of this PR
ab8db8d to
f8c0ee5
Compare
f8c0ee5 to
fbc885b
Compare
|
| */ | ||
| send( | ||
| // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type -- require a generic function type | ||
| onload: Function | null = null, |
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.
"Onload" specific signature can be inferred because it is used in this method .
This applies to onLoad parameters of all methods and functions of this file.
… for parameters Editor.ts: fix unprecised function usage
… of the API) Used as parameter of Editor.addAction
|
|
|
||
| // Invokes the function on the editor using the args | ||
| action.apply(this, args); | ||
| action(this, cell, evt); |
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 may have changes the behavior here by removing the binding to this.
To be reviewed.
Otherwise keep the former implementation
| import type { AbstractGraph } from '../view/AbstractGraph'; | ||
| import EventObject from '../view/event/EventObject'; | ||
| import type { DropHandler } from '../view/other/DragSource'; | ||
| import { EventListenerFunction } from '../types'; |
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.
Use "type" import
| ): MarkerFunction | null; | ||
| } | ||
|
|
||
| // TODO rename to EventListener? |
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.
Keep the name and remove todo
| eventObject: EventObject | ||
| ) => void; | ||
|
|
||
| // TODO rename to EditorAction? |
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.
Keep the name and remove todo
| import { applyGraphMixins } from './mixins/_graph-mixins-apply'; | ||
| import { isNullish } from '../internal/utils'; | ||
| import { isI18nEnabled } from '../internal/i18n-utils'; | ||
| import AbstractCanvas2D from './canvas/AbstractCanvas2D'; |
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.
Use type import
|
|
||
| import GraphHierarchyNode from '../datatypes/GraphHierarchyNode'; | ||
| import GraphHierarchyEdge from '../datatypes/GraphHierarchyEdge'; | ||
| import GraphAbstractHierarchyCell from '../datatypes/GraphAbstractHierarchyCell'; |
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.
Use type import



DISCLAIMER: this is a work in progress and subject to force push
This mainly implies using specific signature for functions instead of using the generic "Function" type.
BREAKING CHANGES: TODO
Tasks
This PR initially tried to bump all eslint plugins and to fix all eslint errors/warnings. As this was a too large task, it has been split: