-
Notifications
You must be signed in to change notification settings - Fork 1
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
style: apply unicorn/recommended
rules
#127
Conversation
♻️ PR Preview 2455a9b has been successfully destroyed since this PR has been closed. 🤖 By surge-preview |
}; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
overlaysVisibilityButton.addEventListener('click', _ev => { | ||
overlaysVisibilityButton.addEventListener('click', _event => { |
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.
suggestion:
overlaysVisibilityButton.addEventListener('click', _event => { | |
overlaysVisibilityButton.addEventListener('click', event => { |
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.
thought: This remark applies to all suggestions done on this topic.
Prefixing by _
is the convention used in TypeScript for unused parameters. We have done this in bpmn-visualization
to fix SonarCloud code smells in the past.
I use the prefix here because we enforce noUnusedParameters
(demo) or strict
(addons, include all noXXX options).
Implementing the suggestion then generates a tsc error: TS6133: event is declared but its value is never read.
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
htmlElement.onmouseenter = _ev => { | ||
htmlElement.addEventListener('mouseenter', _event => { |
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.
suggestion:
htmlElement.addEventListener('mouseenter', _event => { | |
htmlElement.addEventListener('mouseenter', event => { |
} | ||
}; | ||
|
||
const setupControlEventHandlers = (): void => { | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
document.querySelector('#btn-compute-path')?.addEventListener('click', _ev => { | ||
document.querySelector('#btn-compute-path')?.addEventListener('click', _event => { |
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.
suggestion:
document.querySelector('#btn-compute-path')?.addEventListener('click', _event => { | |
document.querySelector('#btn-compute-path')?.addEventListener('click', event => { |
computePath(); | ||
}); | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
document.querySelector('#bt-clear')?.addEventListener('click', _ev => { | ||
document.querySelector('#bt-clear')?.addEventListener('click', _event => { |
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.
suggestion:
document.querySelector('#bt-clear')?.addEventListener('click', _event => { | |
document.querySelector('#bt-clear')?.addEventListener('click', event => { |
Kudos, SonarCloud Quality Gate passed!
|
Notes
Apply these rules as they are already applied in the bonita-day-2023 demo and will be soon apply in bpmn-visualization