Skip to content

chore: remove trailing commas from JSON and add linter rule#487

Open
platex-rehor-bot wants to merge 1 commit into
RedHatInsights:mainfrom
platex-rehor-bot:bot/RHCLOUD-47771
Open

chore: remove trailing commas from JSON and add linter rule#487
platex-rehor-bot wants to merge 1 commit into
RedHatInsights:mainfrom
platex-rehor-bot:bot/RHCLOUD-47771

Conversation

@platex-rehor-bot
Copy link
Copy Markdown
Contributor

@platex-rehor-bot platex-rehor-bot commented May 21, 2026

Description

Remove trailing commas from all JSON files and add an ESLint rule to prevent future regressions. This is a preventive fix for the upcoming Nx 22.7.1 upgrade, which has stricter JSON parsing that fails on trailing commas.

RHCLOUD-47771


How to test locally

  1. npm install
  2. npm run lint — all 16 projects should pass
  3. Add a trailing comma to any JSON file (e.g. tsconfig.json) and run npm run lint again — the jsonc/comma-dangle rule should flag it as an error

Anything reviewers should know?

  • Uses eslint-plugin-jsonc (not eslint-plugin-json as originally suggested in the ticket) because:
    • The repo already uses jsonc-eslint-parser for JSON files
    • eslint-plugin-jsonc provides the specific jsonc/comma-dangle rule
    • It integrates cleanly with the existing legacy ESLint config (.eslintrc.json)
  • prettier/prettier is disabled for JSON files to avoid conflicts with the jsonc rule
  • Lint file patterns in project.json files expanded from package.json-only to *.json so all JSON files in each package are covered

Checklist

  • Tests: new/updated tests cover the change
  • API: spec updated if endpoints changed (or N/A)
  • Migrations: backwards compatible if schema changed (or N/A)
  • Dependencies: no known impact to dependent services
  • Security: reviewed against secure coding checklist (or N/A)

AI disclosure

Assisted by: Claude Code

RHCLOUD-47771

Add eslint-plugin-jsonc with jsonc/comma-dangle rule set to "error"
to prevent trailing commas in JSON files. Remove existing trailing
commas from tsconfig and project.json files across all packages.
Expand lint file patterns to cover all JSON files (*.json).

This prevents future Nx upgrade blockers — Nx 22.7.1 has stricter
JSON parsing that fails on trailing commas.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant