Add ESLint rule: types must live in types.ts files#1068
Open
craigmarker wants to merge 6 commits intomainfrom
Open
Add ESLint rule: types must live in types.ts files#1068craigmarker wants to merge 6 commits intomainfrom
craigmarker wants to merge 6 commits intomainfrom
Conversation
Enforces that type/interface declarations belong in types.ts (or *-types.ts, or files in a types/ directory). Only *Props interfaces used as component function parameters or forwardRef generics are exempt. Fixes 3 existing violations by moving types to their proper files. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
JavaScript Coverage ReportTotal Coverage: 88.67% Coverage Policy:
Coverage Details |
📊 Combined Coverage Report
Coverage PolicyBaseline (Existing Code):
New/Changed Code: ≥90% STRICTLY ENFORCED Long-term Goal: Maintain and improve coverage baselines 📝 Coverage Guidelines
🔗 Quick Links |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Small single-use types (≤2 members, referenced once) now get an inline suggestion rather than always being told to move to types.ts. A named type that annotates exactly one call site adds indirection without aiding discoverability. Also adds types-in-types-file.md as the first example of the co-located companion doc convention for eslint-local-rules. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The .md file is the canonical reference — the JSDoc header was duplicating it. Restructured the markdown to match the no-module-scope pattern (one-liner opener, why, exceptions, how-to-fix) and softened the inline guidance to acknowledge that named types with semantic value are worth keeping. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
RuntimeConfig (1 field) and UseDateFormattersReturn (2 fields) were each used in a single file — inlining them is clearer than the indirection of a types.ts import. Also updated the inlineType lint message to present both inline and move-to-types options. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Enforces that type/interface declarations belong in types.ts (or *-types.ts, or files in a types/ directory). Only *Props interfaces used as component function parameters or forwardRef generics are exempt.
What type of PR is this? (check all applicable)
What changed?
Why?
How did you test it?
Potential risks
Release notes
Documentation Changes