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

[lint] Remove no-case-declarations #1256

Merged
merged 1 commit into from
Sep 6, 2022
Merged

Conversation

dayo09
Copy link
Contributor

@dayo09 dayo09 commented Sep 6, 2022

This commit adds "no-case-declarations" rule to our lint configuration and
fixes the errors.

ONE-vscode-DCO-1.0-Signed-off-by: dayo09 [email protected]


For #1253

Remove no-case-declarations

https://eslint.org/docs/latest/rules/no-case-declarations

Why is this a problem?

The reason is that the lexical declaration is visible in the entire switch block but it only gets initialized when it is assigned, which will only happen if the case where it is defined is reached.

Sol

To ensure that the lexical declaration only applies to the current case clause wrap your clauses in blocks.

2 Errors

/home/dayo/git/ONE-vscode/src/CfgEditor/CfgEditorPanel.ts
  146:11  warning  Unexpected lexical declaration in case block  no-case-declarations
  152:11  warning  Unexpected lexical declaration in case block  no-case-declarations

✖ 2 problems (0 errors, 2 warnings)

This commit adds "no-case-declarations" rule to our lint configuration and
fixes the errors.

ONE-vscode-DCO-1.0-Signed-off-by: dayo09 <[email protected]>
@dayo09 dayo09 requested a review from a team September 6, 2022 04:28
Copy link
Collaborator

@jyoungyun jyoungyun left a comment

Choose a reason for hiding this comment

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

LGTM

@dayo09 dayo09 requested a review from a team September 6, 2022 04:38
@dayo09 dayo09 added the 2 approvals 2 approvals required to be merged label Sep 6, 2022
Copy link
Contributor

@llFreetimell llFreetimell left a comment

Choose a reason for hiding this comment

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

LGTM

@llFreetimell llFreetimell merged commit 8881946 into Samsung:main Sep 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 approvals 2 approvals required to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants