Skip to content

build: add JSON and YAML linting via ESLint - #10975

Draft
Planeshifter wants to merge 3 commits into
developfrom
philipp/gh55-json-yaml-linting
Draft

Planeshifter wants to merge 3 commits into
developfrom
philipp/gh55-json-yaml-linting

Conversation

@Planeshifter

@Planeshifter Planeshifter commented Mar 15, 2026 •

Copy link
Copy Markdown
Member

Resolves stdlib-js/metr-issue-tracker#55.

Description

This pull request adds JSON and YAML linting to the default make lint target.

  • Enforces strict JSON syntax, duplicate-key checks, two-space indentation, tab indentation for cli_opts.json, and the canonical root key order for package.json.
  • Covers project JSON beyond package manifests, including tool configuration, manifests, and all 438 CLI option files. Explicit exclusions cover test fixtures and imported/generated files under data/, alongside shared build/dependency ignores.
  • Adds YAML formatting and workflow root-key ordering, with empty mappings permitted in GitHub Actions workflows for valid event declarations.
  • Adds stdlib/yaml-license-header, validating the complete Apache-2.0 header, a four-digit copyright year, and the Stdlib author attribution.
  • Normalizes existing JSON/YAML formatting so the new targets pass. Parsed values are unchanged; the intended workflow behavior change is the new CI lint/test step.
  • Runs configuration regression tests, license-rule tests, and both complete lint targets in CI. Declares the directly imported JSON/YAML parsers and updates the installation dependency list.

The branch targets develop directly. The existing package.json schema validator remains complementary to ESLint.

Validation

  • make lint-json lint-yaml: 9,479 JSON files and 86 YAML files; zero errors.
  • Configuration tests cover strict syntax, duplicate keys, CLI indentation, package key ordering, and workflow event mappings.
  • RuleTester exercises valid headers and rejects missing headers, malformed years, wrong attribution, and altered/displaced headers.
  • Parsed-value comparisons confirm the formatting changes preserve JSON/YAML values.
  • JavaScript lint, package.json validation, license headers, EditorConfig, Markdown lint, and git diff --check pass.

Related Issues

Other

YAML quote style remains a warning. See etc/eslint/README.md for commands and scope exclusions.

Checklist

AI Assistance

  • Yes
  • No

AI assistance was used for:

  • Code generation and bug fixes
  • Test generation
  • Documentation
  • Research and understanding

Disclosure

The original implementation was written primarily by Claude Code.

@socket-security

socket-security Bot commented Mar 15, 2026 •

Copy link
Copy Markdown

All alerts resolved. Learn more about Socket for GitHub.

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

View full report

@stdlib-js stdlib-js deleted a comment from stdlib-bot Mar 15, 2026
@Planeshifter Planeshifter added the METR Pull request associated with the METR project. label Mar 18, 2026
@Planeshifter
Planeshifter force-pushed the philipp/gh55-json-yaml-linting branch from d3fe5ed to 74e217c Compare August 20, 2026 05:57
@Planeshifter
Planeshifter force-pushed the philipp/gh55-json-yaml-linting branch 2 times, most recently from 944a540 to 76a5bb2 Compare August 20, 2026 06:25
@kgryte
kgryte force-pushed the philipp/gh55-json-yaml-linting branch from 76a5bb2 to b840b47 Compare August 21, 2026 10:06
@kgryte
kgryte force-pushed the philipp/gh55-json-yaml-linting branch from b840b47 to be8ab80 Compare August 21, 2026 10:14
@Planeshifter
Planeshifter force-pushed the philipp/gh55-json-yaml-linting branch from be8ab80 to 082f8bf Compare August 25, 2026 03:49
@socket-security

socket-security Bot commented Aug 25, 2026 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addednpm/​yaml-eslint-parser@​1.3.210010010082100
Addednpm/​jsonc-eslint-parser@​2.4.29910010084100
Addednpm/​eslint-plugin-jsonc@​2.21.19910010090100
Addednpm/​eslint-plugin-yml@​1.19.19910010094100

View full report

@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

No coverage information available.

@kgryte
kgryte force-pushed the philipp/gh55-json-yaml-linting branch from 082f8bf to abcc30f Compare August 26, 2026 01:17
@Planeshifter
Planeshifter force-pushed the philipp/gh55-json-yaml-linting branch from abcc30f to 18706b2 Compare October 28, 2026 06:24
@kgryte
kgryte force-pushed the philipp/gh55-json-yaml-linting branch 2 times, most recently from 9ab8cc9 to ee9921f Compare October 29, 2026 02:10
Base automatically changed from philipp/gh54-delete-legacy-config to develop October 29, 2026 02:23
@kgryte

kgryte commented Oct 29, 2026

Copy link
Copy Markdown
Member

@Planeshifter I believe this PR needs to be updated before review.

Ref: stdlib-js/metr-issue-tracker#55

- Add `eslint-plugin-jsonc` and `eslint-plugin-yml` as devDependencies
- Create `etc/eslint/rules/json.js` with 10 rules enforcing JSON spec
  compliance (indent, no-dupe-keys, comma-dangle, etc.)
- Create `etc/eslint/rules/yaml.js` with 12 rules for YAML formatting
  and best practices (indent, block-mapping, quotes as warn, etc.)
- Add 5 config blocks to `eslint.config.js`: base JSON, cli_opts.json
  tab override, package.json key ordering (canonical stdlib order),
  base YAML, and GitHub Actions workflow key ordering
- Un-ignore `.github/` and `.codecov.yml` in global ESLint ignores
- Create custom `stdlib/yaml-license-header` rule enforcing Apache-2.0
  license header at the start of YAML files
- Register the new rule in the stdlib ESLint plugin
- Add `lint-json` and `lint-yaml` Make targets with `--cache`
- Wire new targets into the top-level `lint` prerequisite

---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
  - task: lint_filenames
    status: passed
  - task: lint_editorconfig
    status: passed
  - task: lint_markdown
    status: na
  - task: lint_package_json
    status: passed
  - task: lint_repl_help
    status: na
  - task: lint_javascript_src
    status: passed
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: na
  - task: lint_javascript_tests
    status: passed
  - task: lint_javascript_benchmarks
    status: na
  - task: lint_python
    status: na
  - task: lint_r
    status: na
  - task: lint_c_src
    status: na
  - task: lint_c_examples
    status: na
  - task: lint_c_benchmarks
    status: na
  - task: lint_c_tests_fixtures
    status: na
  - task: lint_shell
    status: na
  - task: lint_typescript_declarations
    status: passed
  - task: lint_typescript_tests
    status: na
  - task: lint_license_headers
    status: passed
---
@Planeshifter
Planeshifter force-pushed the philipp/gh55-json-yaml-linting branch from ee9921f to de63e9e Compare October 29, 2026 06:35

This branch has not been deployed

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

Labels

METR Pull request associated with the METR project.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RFC]: Setup YAML / JSON linting after ESLint has been migrated to v9

3 participants