Skip to content

Add prefer-named-params rule#45

Open
create-inc-service-account wants to merge 3 commits intomainfrom
prefer-named-params
Open

Add prefer-named-params rule#45
create-inc-service-account wants to merge 3 commits intomainfrom
prefer-named-params

Conversation

@create-inc-service-account

Summary

  • Flags functions with 2+ positional parameters, suggesting object destructuring instead
  • Codifies CLAUDE.md: "Prefer to use named parameters (object destructuring) for functions"
  • Skips callbacks (.map, .filter, .reduce, .sort, .then, etc.), React.forwardRef/memo, and functions already using destructured params
  • Universal rule (not platform-specific)
  • Severity: warning

Test plan

Scenario Expected
npm test All 353 tests pass (17 new for this rule)
function doThing(a: string, b: number) Flagged
const fn = (a, b) => a + b (not a callback) Flagged
function doThing({ a, b }: { a: string; b: number }) Allowed
items.map((item, index) => ...) Allowed
items.reduce((acc, item) => ...) Allowed
forwardRef((props, ref) => ...) Allowed
setTimeout((a, b) => ..., 1000) Allowed

🤖 Generated with Claude Code

arnavsurve and others added 3 commits February 16, 2026 17:03
Flag functions with 2+ positional parameters, suggesting object
destructuring instead. Skips callbacks (.map, .filter, .reduce, etc.),
React.forwardRef/memo, and functions already using destructured params.
Severity: warning.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

3 participants

Comments