Skip to content

style: apply unicorn/recommended rules#127

Merged
tbouffard merged 2 commits into
mainfrom
chore/add_eslint-plugin-unicorn
Sep 25, 2023
Merged

style: apply unicorn/recommended rules#127
tbouffard merged 2 commits into
mainfrom
chore/add_eslint-plugin-unicorn

Conversation

@tbouffard

Copy link
Copy Markdown
Member

Notes

Apply these rules as they are already applied in the bonita-day-2023 demo and will be soon apply in bpmn-visualization

@tbouffard tbouffard added the chore Build, CI/CD or repository tasks (issues/PR maintenance, environments, ...) label Sep 22, 2023
@tbouffard tbouffard requested a review from csouchet September 22, 2023 16:32
@github-actions

github-actions Bot commented Sep 22, 2023

Copy link
Copy Markdown

♻️ PR Preview 2455a9b has been successfully destroyed since this PR has been closed.

🤖 By surge-preview

@tbouffard tbouffard marked this pull request as ready for review September 22, 2023 16:53

// eslint-disable-next-line @typescript-eslint/no-unused-vars
overlaysVisibilityButton.addEventListener('click', _ev => {
overlaysVisibilityButton.addEventListener('click', _event => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion:

Suggested change
overlaysVisibilityButton.addEventListener('click', _event => {
overlaysVisibilityButton.addEventListener('click', event => {

Copy link
Copy Markdown
Member Author

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 => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion:

Suggested change
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 => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion:

Suggested change
document.querySelector('#btn-compute-path')?.addEventListener('click', _event => {
document.querySelector('#btn-compute-path')?.addEventListener('click', event => {

});
// eslint-disable-next-line @typescript-eslint/no-unused-vars
document.querySelector('#bt-clear')?.addEventListener('click', _ev => {
document.querySelector('#bt-clear')?.addEventListener('click', _event => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion:

Suggested change
document.querySelector('#bt-clear')?.addEventListener('click', _event => {
document.querySelector('#bt-clear')?.addEventListener('click', event => {

@sonarqubecloud

Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@tbouffard tbouffard merged commit e811652 into main Sep 25, 2023
@tbouffard tbouffard deleted the chore/add_eslint-plugin-unicorn branch September 25, 2023 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Build, CI/CD or repository tasks (issues/PR maintenance, environments, ...)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants