Skip to content

[RFE] linter: option to relax rule requiring braces for single statements #39

@chrizilla

Description

@chrizilla

summary

Firemonkey linter currently issues warnings about missing braces for all single-statement blocks (e.g. if (cond) return; must be if (cond) { return; }).

steps to reproduce

  1. create a userscript with single-line blocks:
    if (a !== b) return false;

⛔ actual behaviour

Firemonkey linter complains about missing curly braces:
⚠️ Expected "{" and instead saw "return"

✅ expected behavior

Valid idiomatic code should not produce warnings.

😟 problem

  • This rule is causing many noisy lint warnings for otherwise valid code and makes it hard to spot real issues.
  • Many developers prefer single-line blocks for brevity. Forcing braces creates a large volume of stylistic warnings that drown out real problems.

💡 proposed solutions

  • option to accept brace-less single-statement blocks
  • or use a less strict default
  • or accept both styles by default and optionally enforce braces only for multi-line blocks.
  • Or support common linter config formats (ESLint/.editorconfig) to override this rule.

👍 benefits

  • Allowing configuration preserves safety-conscious defaults while reducing noise for users who prefer concise style.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions