Skip to content

fix: Add a helper for naming-convention overrides - #79

Merged
slifty merged 1 commit into
mainfrom
77-naming-convention-helper
Nov 10, 2026
Merged

slifty merged 1 commit into
mainfrom
77-naming-convention-helper

Conversation

@slifty

@slifty slifty commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

This PR lets projects change our @typescript-eslint/naming-convention choices for specific selectors without restating the rest. namingConventionOptionsWithout([...selectors]) returns our entries minus every entry for those selectors, and the project adds its own. The shipped config is unchanged, so this is a patch release.

Closes #77

Testing

  • npm run lint and npm test pass.
  • New tests lint a consumer config that overrides variable with snake_case and confirm that const variables follow the override while entries that weren't omitted stay enforced.
  • Packed the build and type-checked a test consumer (module: nodenext) against the exported types.
Notes for agentic reviewers
  • typescript-eslint sorts entries by specificity before array order (naming-convention-utils/validator.js), so prepending an override loses to any more specific entry of ours (e.g. our variable + const). Omitting whole selectors avoids that.
  • Omitting a selector also removes our exemptions for it (destructured, unused). This is intentional and documented in the README.
  • Grouped entries are split, so omitting typeProperty keeps objectLiteralProperty. The helper throws for a selector with no entry (e.g. class, which we cover only through typeLike).
  • Selectors are typed as plain strings. typescript-eslint types rule options as unknown[] in its public declarations, so there's no type to derive from, and a hand-written union would drift. Typos still fail at config load: the helper throws for any selector we have no entry for, and ESLint validates the project's own entries against the rule's schema.

🤖 Generated with Claude Code (session 186d8b34-8577-4116-b28f-8ac21758843c)

@slifty
slifty requested a lite review from Copilot November 6, 2026 22:30
@slifty
slifty force-pushed the 77-naming-convention-helper branch from dc197c6 to 8b3c022 Compare November 6, 2026 22:32

Copilot AI 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.

🟢 Approval recommended

No active review issues remain, and the narrowly scoped helper and documentation changes preserve the existing default configuration.

No open issues 🎉

What changed in this PR

This pull request adds a public helper for selectively replacing @typescript-eslint/naming-convention entries while preserving the remaining shipped conventions. The default configuration remains unchanged.

Changes:

  • Extracts naming-convention entries into a reusable internal collection.
  • Adds and exports namingConventionOptionsWithout and its supporting types.
  • Documents selector overrides and grouped-entry behavior.
  • Adds tests covering filtering, validation, errors, and consumer overrides.
File Description
src/​test/​naming-convention-options.test.ts Tests helper behavior, validation, grouped entries, and consumer configuration overrides.
src/​index.ts Exports the helper and its public TypeScript types.
src/​configs/​typescript.ts Defines the reusable naming-convention options and selector-filtering helper.
README.md Documents how consumers can customize selected naming conventions.

Review effort: Lite

@slifty
slifty force-pushed the 77-naming-convention-helper branch 3 times, most recently from d5b3f0c to a196964 Compare November 10, 2026 18:28
The rule takes its whole option list at once, and typescript-eslint
ranks entries by specificity before order, so prepending an override
can silently lose to one of ours. Omitting our entries for a selector
leaves nothing to compete with the project's own.

Issue #77 Make it easier to override parts of `@typescript-eslint/naming-convention`

Claude-Session: 186d8b34-8577-4116-b28f-8ac21758843c
@slifty
slifty force-pushed the 77-naming-convention-helper branch from a196964 to dfa6872 Compare November 10, 2026 18:29
@slifty
slifty enabled auto-merge November 10, 2026 18:30
@slifty
slifty merged commit a562c66 into main Nov 10, 2026
9 checks passed
@slifty
slifty deleted the 77-naming-convention-helper branch November 10, 2026 18:31
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 10.33.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make it easier to override parts of @typescript-eslint/naming-convention

2 participants