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

Improve eslint switch statement handling #2228

Merged
merged 2 commits into from
Mar 21, 2019
Merged

Conversation

magicznyleszek
Copy link
Member

Description

The problem was that case statements without {} are "bad": https://stackoverflow.com/a/35746467/2311247

I've added two new eslint rules to avoid this problem in the future :)

Related issues

Fixes #2227

const choice = choices.find(x => x.list_name == q.select_from_list_name && x.name === submissionValue);
if (choice && choice.label && choice.label[translationIndex])
return choice.label[translationIndex];
else
return submissionValue;
break;
case 'select_multiple':
}
case 'select_multiple': {
var responses = submissionValue.split(' ');
var list = responses.map((r)=> {
Copy link
Contributor

Choose a reason for hiding this comment

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

According to the rules, you've described? Should this one be const list instead var list too?

@noliveleger noliveleger merged commit 01bde28 into master Mar 21, 2019
@noliveleger noliveleger deleted the 2227-eslint-error branch March 21, 2019 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants