Skip to content

feat(eslint): add config snapshots and tighten string coercion rules#228

Merged
jhnns merged 2 commits into
mainfrom
feat/eslint-config-snapshots
Jun 28, 2026
Merged

feat(eslint): add config snapshots and tighten string coercion rules#228
jhnns merged 2 commits into
mainfrom
feat/eslint-config-snapshots

Conversation

@jhnns

@jhnns jhnns commented Jun 28, 2026

Copy link
Copy Markdown
Member

Summary

  • Add snapshot tests that resolve each ESLint preset's effective rules via calculateConfigForFile, with committed JSON in eslint/__snapshots__/ and test:snapshot / test:snapshot:update scripts
  • Enable @typescript-eslint/no-base-to-string and @typescript-eslint/restrict-plus-operands (with allowNumberAndString: true and other operands kept strict), plus a fixture demonstrating both rules
  • Restore lib: ["es2024"] on the root tsconfig.json so typechecking matches base.json intent, and document snapshot review workflow in AGENTS.md

Test plan

  • npm run test:snapshot
  • npm run test:presets:typescript
  • npm run test:types

Snapshot resolved ESLint preset rules to catch dependency drift, enable
no-base-to-string and restrict-plus-operands (allowing string + number),
and restore es2024 lib typing for the root tsconfig.
Copilot AI review requested due to automatic review settings June 28, 2026 13:09
@pkg-pr-new

pkg-pr-new Bot commented Jun 28, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@peerigon/configs@228

commit: 7a37ea7

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances @peerigon/configs’ ESLint preset maintenance and tightens TypeScript string-coercion safety by adding deterministic config snapshot tests and enabling stricter coercion-related rules.

Changes:

  • Add an ESLint config snapshot test harness (calculateConfigForFile) and commit resolved rule snapshots for all presets, plus test:snapshot scripts.
  • Tighten TypeScript preset behavior by enabling @typescript-eslint/no-base-to-string and configuring @typescript-eslint/restrict-plus-operands (allowing only string + number).
  • Align repository typechecking with intended lib typings by restoring lib: ["es2024"] in the root tsconfig.json, and document snapshot review workflow in AGENTS.md.

Reviewed changes

Copilot reviewed 9 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tsconfig.json Restores lib: ["es2024"] for repo typechecking consistency.
package.json Adds test:snapshot / test:snapshot:update scripts.
eslint/rules/typescript.js Enables no-base-to-string via defaults and configures restrict-plus-operands with strict operands.
eslint/review-config-snapshot.prompt.md Adds documented workflow for reviewing snapshot diffs.
eslint/presets/typescript.test/string-coercion.ts Adds fixture coverage for the tightened coercion rules.
eslint/config-snapshot.test.js Introduces snapshot runner resolving effective rules per preset/file.
eslint/snapshots/*.json Adds committed resolved-rule snapshots for each preset.
AGENTS.md Documents when/how to run and review snapshot tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread eslint/config-snapshot.test.js Outdated
Comment thread eslint/config-snapshot.test.js Outdated
Reuse one ESLint instance per preset instead of per file, and throw a
targeted error with recovery hint when a snapshot file is missing.
@jhnns jhnns merged commit 1275b8d into main Jun 28, 2026
2 checks passed
@jhnns jhnns deleted the feat/eslint-config-snapshots branch June 28, 2026 13:20
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