Skip to content

Extend lint/formatting rule to enforce and auto change to code blocks #97

Open

Description

@wiktoriavh

Acceptance Criteria

  • Code Blocks should be enforced.

Example:

// BAD
const foo = () => "foo string";

// GOOD
const foo = () => {
  return "foo string"
}

Originally posted by @wiktoriavh in #85 (comment)

Activity

  1. changed the title [-]extend lint rule to enforce code blocks[/-] [+]Extend lint rule to enforce code blocks[/+] on Aug 23, 2026
  2. changed the title [-]Extend lint rule to enforce code blocks[/-] [+]Extend lint/formatting rule to enforce and auto change to code blocks[/+] on Aug 23, 2026
  3. added
    triagedWhen an issue was triaged by the owner and given the green light for implementation.
    on Aug 23, 2026
  4. added theissue type on Aug 23, 2026
  5. hmd-ali commented on Aug 24, 2026

    @hmd-ali
    Contributor

    Why is the first example bad? In that specific example, I do believe the one that's BAD is more readable. We already have a rule that requires code blocks for control statements (example attached), which makes sense to me. But I'm not sure about enforcing code blocks for everything, specially for simple statements like the one you shared.

    // BAD
    if(condition) foo()
    bar()
    
    // GOOD
    if(condition) {
      foo()
    }
    bar()
  6. wiktoriavh commented on Aug 27, 2026

    @wiktoriavh
    MemberAuthor

    It was a simplified example, i know there are situations where it is acceptable, but I want to avoid strange arrow functions that are hard to read. If you believe having it all inline is acceptable, you can always ignore that line and be specific.

    // eslint-ignore rule-name
    const foo = () => "foo string"; // <-- is now allowed
  7. hmd-ali commented on Aug 28, 2026

    @hmd-ali
    Contributor

    We can use eslint/arrow-body-style with the value of as-needed and requireReturnForObjectLiteral

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    triagedWhen an issue was triaged by the owner and given the green light for implementation.

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions