Back to all reviewers

Use concise methods

shadcn-ui/ui
Based on 2 comments
Other

Prefer built-in methods and properties that achieve the same result with less code. This improves readability, reduces potential bugs, and makes your code more maintainable.

Code Style Other

Reviewer Prompt

Prefer built-in methods and properties that achieve the same result with less code. This improves readability, reduces potential bugs, and makes your code more maintainable.

For DOM manipulations, use specialized methods like classList.toggle() instead of conditional add/remove operations:

// Instead of this:
document.documentElement.classList[isDark ? 'add' : 'remove']('dark');

// Use this more concise approach:
document.documentElement.classList.toggle('dark', isDark);

Similarly, avoid redundant styling properties when fewer properties can achieve the desired effect. Review your CSS classes to eliminate unnecessary declarations that don’t contribute to the intended visual outcome:

// Instead of potentially redundant classes:
<SheetContent className="w-[400px] sm:w-[540px] sm:max-w-none">

// Use only what's necessary:
<SheetContent className="w-[400px] sm:w-[540px]">

These simplifications make code easier to read and maintain while reducing the possibility of conflicting declarations.

2
Comments Analyzed
Other
Primary Language
Code Style
Category

Source Discussions