Skip to content

SonarCloud: JavaScript code-quality modernization (×7) #371

Closed as not planned

Description

@don-petry

JavaScript code-quality modernization

SonarCloud open findings in petry-projects/broodly — 7 issue(s) grouped as one workstream. Part of the org SonarCloud tuning initiative combsmith/.github#593.

Findings

Rule Count Representative message
typescript:S6759 2 Mark the props of the component as read-only.
typescript:S6767 2 'as' PropType is defined but prop is never used
javascript:S7726 1 The function should be named.
typescript:S4782 1 Consider removing 'undefined' type or '?' specifier, one of them is redundant.
typescript:S1871 1 This case's code block is the same as the block for the case on line 78.

Affected files

  • apps/mobile/components/ui/heading/index.tsx (3)
  • apps/mobile/App.tsx (1)
  • apps/mobile/babel.config.js (1)
  • apps/mobile/components/ui/button/index.tsx (1)
  • apps/mobile/components/ui/gluestack-ui-provider/index.tsx (1)

Approach

Apply the flagged idiom fixes: optional chaining (S6582), replaceAll (S7781), globalThis over window (S7764), Number.parseInt (S7773), and the other per-line suggestions. Each carries SonarCloud's exact recommendation. Mechanical; behavior identical.

Acceptance

  • All listed SonarCloud findings for this repo/workstream resolved to zero
  • No behavior change; existing tests/CI green
  • Fixes are real (no blanket NOSONAR unless a confirmed false positive, noted inline)

Filed from the 2026-07-03 org SonarCloud review.

Activity

  1. don-petry commented on Jul 3, 2026

    @don-petry
    ContributorAuthor

    Dev-Lead Implementation Plan

    Issue: #371 — SonarCloud: JavaScript code-quality modernization (×7)

    Scope

    Apply the 7 flagged SonarCloud fixes (S6759 ×2, S6767 ×2, S7726, S4782, S1871) across 5 Expo/RN files — all mechanical, behavior-preserving, verified against the SonarCloud API for exact line numbers.

    Findings → Fixes (confirmed via SonarCloud API)

    File:Line Rule Fix
    apps/mobile/App.tsx:10 S6759 Mark ColorSwatch props Readonly<>
    apps/mobile/components/ui/gluestack-ui-provider/index.tsx:8 S6759 Mark provider props Readonly<>
    apps/mobile/components/ui/heading/index.tsx:9 (×2) S6767 as PropType flagged unused by both MappedHeading & Heading — split base type so MappedHeading no longer declares as, and make Heading's as usage statically detectable
    apps/mobile/components/ui/heading/index.tsx:106 S1871 default case block duplicates case 'lg' — remove redundant explicit case 'lg' (falls through to identical default → H4)
    apps/mobile/babel.config.js:1 S7726 Name the anonymous module.exports = function (api)
    apps/mobile/components/ui/button/index.tsx:339 S4782 className?: string | undefined → drop redundant | undefined

    Implementation Checklist

    • App.tsx — wrap ColorSwatch props in Readonly<>
    • gluestack-ui-provider/index.tsx — wrap provider props in Readonly<>
    • heading/index.tsx — split IHeadingProps base (no as) for MappedHeading; make Heading's as detectably used; remove duplicate case 'lg'
    • babel.config.js — name the config function
    • button/index.tsx — drop | undefined

    Tests to Write

    • smoke-test.test.tsx — guard Heading renders at lg size (dedup path) and with a custom as component (behavior lock for the as refactor)

    Test Command

    pnpm --filter mobile test (jest), plus pnpm --filter mobile run lint and bash .dev-lead/scripts/dev-lead-lint.sh

    Notes

    Behavior-preserving refactors: no runtime change. Guard tests added for the two heading paths I touch. No NOSONAR used — all fixes are real.

  2. don-petry commented on Jul 3, 2026

    @don-petry
    ContributorAuthor

    Dev-Lead: issue #371 implementation failed — will retry

    The engine failed (engine-error — e.g. a timeout or transient engine error). This was attempt 1 of 3; dev-lead will retry automatically. You can also re-apply the dev-lead label to retry now.

  3. don-petry commented on Jul 3, 2026

    @don-petry
    ContributorAuthor

    Dev-Lead: issue #371 implementation failed — will retry

    The engine failed (engine-error — e.g. a timeout or transient engine error). This was attempt 2 of 3; dev-lead will retry automatically. You can also re-apply the dev-lead label to retry now.

    Last 40 lines of engine output (redacted)
        [copilot] calling gh copilot (model=openai/o4-mini, timeout=600s, flags=--yolo)
    Error: Model "openai/o4-mini" from --model flag is not available.
    
    
  4. don-petry commented on Jul 4, 2026

    @don-petry
    ContributorAuthor

    Dev-Lead Implementation Plan

    Issue: #371 — SonarCloud: JavaScript code-quality modernization (×7)

    Scope

    Apply 7 mechanical, behavior-preserving SonarCloud idiom fixes across 5 files (exact locations confirmed via SonarCloud issues API).

    Findings → Fixes

    • typescript:S6759 — apps/mobile/App.tsx:10 — mark ColorSwatch props Readonly<...>
    • typescript:S6759 — apps/mobile/components/ui/gluestack-ui-provider/index.tsx:8 — mark GluestackUIProvider props Readonly<...>
    • javascript:S7726 — apps/mobile/babel.config.js:1 — name the exported function (babelConfig)
    • typescript:S4782 — apps/mobile/components/ui/button/index.tsx:339 — drop redundant | undefined from className?: string | undefined
    • typescript:S6767 ×2 — apps/mobile/components/ui/heading/index.tsx:9 — split props type so MappedHeading no longer declares the unused as prop (kept on the public Heading, which uses it)
    • typescript:S1871 — apps/mobile/components/ui/heading/index.tsx:106 — remove duplicate case 'lg' block; 'lg' falls through to identical default (H4)

    Implementation Checklist

    • apps/mobile/App.tsx — Readonly ColorSwatch props
    • apps/mobile/components/ui/gluestack-ui-provider/index.tsx — Readonly provider props
    • apps/mobile/babel.config.js — named function
    • apps/mobile/components/ui/button/index.tsx — remove redundant | undefined
    • apps/mobile/components/ui/heading/index.tsx — split props type + dedupe switch case

    Tests to Write

    • Heading size="lg" renders (guards S1871 default fallthrough)
    • Heading as={...} renders polymorphically (guards S6767 type split)

    Test Command

    pnpm --filter mobile run test (also: pnpm -r run typecheck, pnpm -r run lint, pnpm format:check)

  5. don-petry commented on Jul 4, 2026

    @don-petry
    ContributorAuthor

    Dev-Lead: cannot implement issue #371 — needs human attention

    Automatic retries are exhausted (attempt 3 of 3). The most recent failure was engine-error.

    Please review the failures above. To retry anyway, remove the dev-lead:needs-human label and re-apply the dev-lead label.

  6. github-actions commented on Sep 7, 2026

    @github-actions
    Contributor

    This issue has had no activity for 60 days. It will be closed in 7 days unless there is new activity. If this is still relevant, please comment or remove the stale label.

  7. github-actions commented on Sep 14, 2026

    @github-actions
    Contributor

    Closed after 60 days of inactivity followed by 7 days in stale state (~67 days total). Re-open if this is still relevant.

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

    dev-leadFor dev-lead agent pickupdev-lead:needs-humandev-lead could not complete this issue; needs human attentionenhancementFeature requestsstale

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions