Skip to main content

Overview

The RuleCard component displays a summary of an ESLint rule with its severity, scope, fixability status, and description. Designed for rule listing pages with hover effects and clickable navigation.

Import

Basic Usage

Props

string
required
The name of the ESLint rule (displayed in monospace font).
string
required
A brief description of what the rule does.
Severity
required
The severity level of the rule: "error", "warn", "suggestion", or "off".
RuleScope
required
The scope where the rule applies: "action", "cross-cutting", "global-action", "model-action", or "route".
boolean
Whether the rule has an automatic fixer. Displays a green “fixable” badge when true.
string
required
The URL to navigate to when the card is clicked.
string
Additional CSS classes to apply.
The RuleCard component extends HTMLAttributes<HTMLAnchorElement>, so all standard anchor attributes are supported.

Rule Scopes

The RuleScope type defines where a rule applies:
  • action - General action code
  • cross-cutting - Multiple contexts
  • global-action - Global action functions
  • model-action - Model-specific actions
  • route - Route handlers

Design Details

  • Renders as an anchor (<a>) element for navigation
  • Card background and border change on hover
  • Smooth transitions (150ms duration)
  • Three badges displayed: severity, scope, and optionally fixable
  • Rule name in monospace font (12px/xs)
  • Description in muted color with relaxed leading
  • No underline on the link (uses no-underline class)

Examples

Error Rule with Fixer

Warning Rule

Rule Grid Layout

Hover Effects

When hovering over the card:
  • Border changes to accent color with muted opacity
  • Shadow elevation increases (shadow-raised)
  • Smooth transition applied

Type Exports

The component exports the RuleScope type:

Component Definition

Location: packages/gadget-ui/src/components/rule-card.tsx:19 The component uses Card, CardHeader, CardTitle, CardContent, SeverityBadge, and Badge components internally.