Back to all reviewers

Prioritize code legibility

TanStack/router
Based on 2 comments
TSX

Write clear, explicit code that prioritizes readability over brevity. Remove unnecessary operations and use straightforward syntax patterns. This is especially important in library code where clarity benefits all consumers.

Code Style TSX

Reviewer Prompt

Write clear, explicit code that prioritizes readability over brevity. Remove unnecessary operations and use straightforward syntax patterns. This is especially important in library code where clarity benefits all consumers.

Key practices:

  • Eliminate redundant operations (like unnecessary object spreading of rest parameters)
  • Use explicit syntax over implicit shortcuts
  • Structure code for maximum legibility

Example of improvement:

// Avoid: Unnecessary spreading of rest object
).map(({ children, ...style }) => ({
  tag: 'style',
  attrs: {
    ...style,
  },

// Prefer: Direct use of rest parameter
).map(({ children, ...attrs }) => ({
  tag: 'style',
  attrs,

// Avoid: Implicit returns with complex logic
.handler(async ({ data: { name, age, pets } }) => 
  `Hello, ${name}! You are ${age + testValues.__adder} years old, and your favourite pets are ${pets.join(',')}.`
)

// Prefer: Explicit returns with clear structure
.handler(({ data: { name, age, pets } }) => {
  return `Hello, ${name}! You are ${age + testValues.__adder} years old, and your favourite pets are ${pets.join(',')}.`
})

The goal is legibility - code should be immediately understandable to any developer reading it.

2
Comments Analyzed
TSX
Primary Language
Code Style
Category

Source Discussions