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

allowShortCircuit and allowTernary in no-unused-expressions #963

Closed
taion opened this issue Jul 25, 2016 · 4 comments
Closed

allowShortCircuit and allowTernary in no-unused-expressions #963

taion opened this issue Jul 25, 2016 · 4 comments

Comments

@taion
Copy link
Contributor

taion commented Jul 25, 2016

It's pretty common to write e.g.

a && a();

Currently this fails the no-unused-expressions validation. However, using allowShortCircuit would allow this usage.

@ljharb
Copy link
Collaborator

ljharb commented Jul 25, 2016

This is definitely not a pattern we'd encourage. Abusing value selection operators for control flow is awful for readability - if (a) { a(); } is much preferred.

As always, feel free to override whatever linter rules you like in your own app :-)

@ljharb ljharb closed this as completed Jul 25, 2016
@hshoff
Copy link
Member

hshoff commented Jul 25, 2016

Previous discussion can be found here #52 and we link to #52 in the Resources section under other styles > conditional callbacks

@taion
Copy link
Contributor Author

taion commented Jul 25, 2016

Sure – I brought this up because these weren't explicitly set to false in the config, which seemed like a potential oversight, and because eslint-config-fbjs was disabling this rule because they wanted to use this pattern.

@ljharb
Copy link
Collaborator

ljharb commented Jul 25, 2016

Thanks, the missing options are indeed an oversight :-) I'll reopen.

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

No branches or pull requests

3 participants