Names should accurately reflect their purpose and be used consistently throughout the codebase. This applies to props, function names, variables, and UI labels.
// Inconsistent - avoid this:
<EditFile changes={args.diff ?? ""} />
<EditFile changes={args.changes ?? ""} />
// Consistent - do this:
<EditFile changes={args.changes ?? ""} />
<EditFile changes={args.changes ?? ""} />
// Misleading - avoid this:
<span onClick={() => void dispatch(cancelStream())}>Pause</span>
// Clear and accurate - do this:
<span onClick={() => void dispatch(cancelStream())}>Cancel</span>
// Unclear semantics - avoid this:
<Switch onWarningText="This is a warning" />
// Clear semantics - do this:
<Switch warningText="This is a warning" />
Following these guidelines helps prevent bugs, improves code readability, and makes the codebase more maintainable.
Enter the URL of a public GitHub repository