Skip to content

build: add JSON and YAML linting via ESLint#10975

Draft
Planeshifter wants to merge 1 commit intophilipp/gh54-delete-legacy-configfrom
philipp/gh55-json-yaml-linting
Draft

build: add JSON and YAML linting via ESLint#10975
Planeshifter wants to merge 1 commit intophilipp/gh54-delete-legacy-configfrom
philipp/gh55-json-yaml-linting

Conversation

@Planeshifter
Copy link
Member

@Planeshifter Planeshifter commented Mar 15, 2026

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

Description

What is the purpose of this pull request?

This pull request:

  • Adds JSON linting via eslint-plugin-jsonc with 10 rules enforcing JSON spec compliance (indent, no-dupe-keys, comma-dangle, etc.), a cli_opts.json tab-indent override, and package.json key ordering using the canonical stdlib key order
  • Adds YAML linting via eslint-plugin-yml with 12 rules for formatting and best practices (indent, block-mapping, block-sequence, quotes as warn, etc.), plus GitHub Actions workflow root-key ordering
  • Creates a custom stdlib/yaml-license-header ESLint rule enforcing the Apache-2.0 license header at the start of YAML files
  • Adds lint-json and lint-yaml Make targets (with --cache) wired into the top-level lint target
  • Un-ignores .github/ and .codecov.yml in ESLint global ignores so YAML files under .github/ are linted
  • Adds .cjs to the filename linter's supported extensions allowlist

Related Issues

Does this pull request have any related issues?

This pull request has the following related issues:

Questions

Any questions for reviewers of this pull request?

  • Should yml/quotes be promoted from warn to error now, or after a separate auto-fix pass?
  • Is the jsonc/sort-keys key ordering for package.json complete, or are there additional keys to include?

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

Stacked on philipp/gh54-delete-legacy-config. The existing custom package.json validator (@stdlib/_tools/lint/pkg-json) does AJV schema validation and is complementary — it stays.

Checklist

Please ensure the following tasks are completed before submitting this pull request.

AI Assistance

When authoring the changes proposed in this PR, did you use any kind of AI assistance?

  • Yes
  • No

If you answered "yes" above, how did you use AI assistance?

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

Disclosure

If you answered "yes" to using AI assistance, please provide a short disclosure indicating how you used AI assistance. This helps reviewers determine how much scrutiny to apply when reviewing your contribution. Example disclosures: "This PR was written primarily by Claude Code." or "I consulted ChatGPT to understand the codebase, but the proposed changes were fully authored manually by myself.".

This PR was written primarily by Claude Code.


@stdlib-js/reviewers

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.cjs`: 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 `.cjs` to the filename linter's supported extensions allowlist
- 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
---
@socket-security
Copy link

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

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedeslint-plugin-yml@​1.19.19910010093100
Addedeslint-plugin-jsonc@​2.21.19910010095100

View full report

@socket-security
Copy link

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Warn Critical
Critical CVE: npm form-data uses unsafe random function in form-data for choosing boundary

CVE: GHSA-fjxv-7rqg-78g4 form-data uses unsafe random function in form-data for choosing boundary (CRITICAL)

Affected versions: < 2.5.4; >= 3.0.0 < 3.0.4; >= 4.0.0 < 4.0.4

Patched version: 2.5.4

From: ?npm/form-data@2.3.3

ℹ Read more on: This package | This alert | What is a critical CVE?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Remove or replace dependencies that include known critical CVEs. Consumers can use dependency overrides or npm audit fix --force to remove vulnerable dependencies.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/form-data@2.3.3. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn Critical
Critical CVE: Prototype Pollution in npm minimist

CVE: GHSA-xvch-5gv4-984h Prototype Pollution in minimist (CRITICAL)

Affected versions: >= 1.0.0 < 1.2.6; < 0.2.4

Patched version: 0.2.4

From: ?npm/factor-bundle@2.5.0npm/minimist@0.0.5

ℹ Read more on: This package | This alert | What is a critical CVE?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Remove or replace dependencies that include known critical CVEs. Consumers can use dependency overrides or npm audit fix --force to remove vulnerable dependencies.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/minimist@0.0.5. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

@stdlib-js stdlib-js deleted a comment from stdlib-bot Mar 15, 2026
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