Skip to content

Enforce curly braces in conditional statements - #386

Merged
bartveneman merged 2 commits into
mainfrom
claude/oxlint-curly-rule-x3fy8l
Aug 31, 2026
Merged

Enforce curly braces in conditional statements#386
bartveneman merged 2 commits into
mainfrom
claude/oxlint-curly-rule-x3fy8l

Conversation

@bartveneman

Copy link
Copy Markdown
Member

This PR enforces consistent code style by requiring curly braces around all conditional statement bodies, improving code readability and reducing potential bugs.

Summary

Updated the linting configuration to use a shared preset and enforce the curly rule, then applied the resulting style changes across the codebase.

Key Changes

  • Linting Configuration:

    • Simplified oxlintrc.json by extending @projectwallace/preset-oxlint preset
    • Removed redundant rule definitions now provided by the preset
    • Added curly: "error" rule to enforce braces around all conditional blocks
    • Added test-specific override for vitest/no-conditional-in-test
    • Removed es2024 from env (now in preset)
  • Code Style Updates:

    • Added curly braces to all single-line if statements throughout the codebase
    • Applied consistent formatting to early returns and conditional logic
    • Affected files include components, utilities, and route handlers
    • Removed trailing blank lines to match linter preferences

Implementation Details

  • All conditional statements now use explicit block syntax: if (condition) { return } instead of if (condition) return
  • This change applies to early returns, loop continuations, and all other conditional branches
  • The preset-based configuration reduces maintenance burden by centralizing style rules

https://claude.ai/code/session_01Uvf2EU2MbXrBs95K94d8vo

claude added 2 commits August 31, 2026 08:38
The style category isn't enabled in oxlintrc.json, so curly (require
braces around all control statement bodies) was off by default. Turn
it on explicitly and auto-fix + reformat the codebase.
Our own oxlintrc.json rules were essentially the preset already, so
extend it and keep only the local differences (env, curly, and the
handful of rules the preset doesn't set or sets differently).

The preset pulls in the vitest plugin, whose no-conditional-in-test
rule fires on our Playwright *.spec.ts files (they use test()/expect()
too, but aren't vitest tests) — turn it off there via an override.
@netlify

netlify Bot commented Aug 31, 2026

Copy link
Copy Markdown

Deploy Preview for projectwallace ready!

Name Link
🔨 Latest commit ae52d15
🔍 Latest deploy log https://app.netlify.com/projects/projectwallace/deploys/6a953f7ef96ff400081e3943
😎 Deploy Preview https://deploy-preview-386--projectwallace.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@bartveneman
bartveneman merged commit 8ed5706 into main Aug 31, 2026
11 checks passed
@bartveneman
bartveneman deleted the claude/oxlint-curly-rule-x3fy8l branch August 31, 2026 08:51
bartveneman pushed a commit that referenced this pull request Aug 31, 2026
Rebased on main, which now enforces oxlint's curly rule repo-wide
(#386). Fixes the handful of one-line if-statements in this branch's
own new code that the rule now flags.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E7X88yKZHKpehyuogXpFDT
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