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

Should we support single-line control-flow statements? #9699

Open
gibson042 opened this issue Jul 12, 2024 · 1 comment
Open

Should we support single-line control-flow statements? #9699

gibson042 opened this issue Jul 12, 2024 · 1 comment

Comments

@gibson042
Copy link
Member

(derived from #9688 (comment))

To satisfy the github/array-foreach ESLint rule, #9688 is changing lines like

  keywords.forEach(assertKeywordName);

into

  for (const keyword of keywords) {
    assertKeywordName(keyword);
  }

However, I believe it would be nice to preserve the brevity of the former:

  for (const keyword of keywords) assertKeywordName(keyword);

This is currently not allowed in agoric-sdk (although it is in endo, cf. encodePassable.js/arb-passable.js/etc.), but we could enable it by adding curly: ["error", "multi-line"] ESLint configuration.

@erights
Copy link
Member

erights commented Jul 13, 2024

I'm on the fence. I always write it with curlies. But as long as the curlies can only be omitted when it is on the same line, I have no objection. I would not be surprised if I come to love it over time ;)

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

2 participants