Skip to content
intermediate

Build the tool: check every usage against the props table

Implement this from the stub. Hidden tests grade the behaviour you write, not the comments you leave.

This exercise is real in shape: this platform's context exercises exist because models write `variant="destructive" size="sm"` against design systems whose props are `intent` and `compact` — the famous names, not the real ones. A human reviewer misses it for the same reason the model guessed it: it *looks* standard.

export interface UnknownProp {
  /** The file the usage is in, as given. */
  file: string
  /** 1-based line of the usage. */
  line: number
  /** The offending attribute name. */
  prop: string
}

export interface SourceFile {
  path: string
  contents: string
}

/**
 * Reports every attribute passed to `component` that is not in `allowed`,
 * in file order, then line order, then attribute order.
 */
export function findUnknownProps(
  component: string,
  allowed: string[],
  files: SourceFile[]
): UnknownProp[] {
  // Your implementation here
  return []
}
challenge — implement from scratchCtrl+↵ submits · Ctrl+Shift+↵ runsstarter code