Skip to content

fix(eslint): preserve TypeScript core-rule replacements - #43

Merged
Eli Bosley (elibosley) merged 2 commits into
unraid:mainfrom
Ajit-Mehrotra:codex/fix-typescript-core-rules
Aug 6, 2026
Merged

fix(eslint): preserve TypeScript core-rule replacements#43
Eli Bosley (elibosley) merged 2 commits into
unraid:mainfrom
Ajit-Mehrotra:codex/fix-typescript-core-rules

Conversation

@Ajit-Mehrotra

@Ajit-Mehrotra Ajit Mehrotra (Ajit-Mehrotra) commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • composes the JavaScript quality layer before the TypeScript layer
  • lets typescript-eslint keep overlapping core rules such as no-undef and no-unused-vars disabled for TypeScript
  • preserves equivalent undefined-name and unused-variable coverage for JavaScript
  • adds regression coverage for the effective Node preset

Problem

The shared core preset currently applies @eslint/js recommended rules after typescript-eslint. That ordering silently turns core no-undef and no-unused-vars back on for TypeScript files, so consumers receive duplicate or incorrect diagnostics even though the TypeScript extension rules are enabled.

Validation

  • pnpm test passes all 39 tests
  • pnpm run format:check passes
  • the regression test verifies the calculated effective rules for both .ts and .js files

Summary by CodeRabbit

  • Bug Fixes

    • Improved TypeScript linting by preventing duplicate or conflicting warnings from overlapping JavaScript rules.
    • TypeScript files now receive more accurate unused-variable checks while retaining undefined-variable detection.
  • Documentation

    • Updated the core linting preset documentation to reflect the order in which rule groups are applied.
  • Tests

    • Added coverage confirming the expected JavaScript and TypeScript linting behavior.

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The core ESLint preset now applies quality rules before typescript rules. Documentation reflects this order. Tests verify overlapping core and TypeScript rule behavior for TypeScript and JavaScript configurations.

Changes

ESLint preset precedence

Layer / File(s) Summary
Core preset ordering
src/eslint/core.js, src/eslint/base.js
The documented and exported preset order places quality before typescript.
Rule replacement validation
test/typescript-core-rule-replacements.test.mjs
Tests verify the expected severities for core and TypeScript unused-variable rules in TypeScript and JavaScript fixtures.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: elibosley

Poem

A rabbit checked the rules with care,
Quality first, then types in air.
Core warnings hopped aside,
TypeScript rules took the ride.
Green tests danced in tidy rows.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title uses the required conventional commit format and accurately describes the TypeScript core-rule replacement changes.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
✨ Simplify code
  • Create PR with simplified code

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/eslint/core.js`:
- Line 2: Update the preset-order comment in src/eslint/base.js to list quality
before typescript, matching the order exported by the preset. Keep the
documented ignores and testing entries unchanged.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8b57f46f-e95b-4bf3-976b-e67686166cac

📥 Commits

Reviewing files that changed from the base of the PR and between da3519e and 52bc43a.

📒 Files selected for processing (2)
  • src/eslint/core.js
  • test/typescript-core-rule-replacements.test.mjs

Comment thread src/eslint/core.js
@elibosley
Eli Bosley (elibosley) marked this pull request as ready for review August 6, 2026 14:44
@elibosley
Eli Bosley (elibosley) merged commit 2384141 into unraid:main Aug 6, 2026
3 checks passed
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