Skip to content

Add prefer-named-params rule#45

Merged
arnavsurve merged 4 commits intomainfrom
prefer-named-params
Feb 25, 2026
Merged

Add prefer-named-params rule#45
arnavsurve merged 4 commits intomainfrom
prefer-named-params

Conversation

@create-inc-service-account
Copy link
Contributor

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 24, 2026 20:47
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>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@arnavsurve arnavsurve merged commit 10cdd26 into main Feb 25, 2026
7 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.

3 participants