Skip to content
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

Merged
merged 2 commits into from
Sep 25, 2023

Conversation

tbouffard
Copy link
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
Copy link

github-actions bot commented Sep 22, 2023

♻️ 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
Member

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
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
Member

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
Member

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

computePath();
});
// 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
Member

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

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