이 제품은 선택한 Datadog 사이트에서 지원되지 않습니다. ().
이 페이지는 아직 한국어로 제공되지 않습니다. 번역 작업 중입니다.
현재 번역 프로젝트에 대한 질문이나 피드백이 있으신 경우 언제든지 연락주시기 바랍니다.

Metadata

ID: typescript-best-practices/boolean-prop-naming

Language: TypeScript

Severity: Notice

Category: Code Style

Description

Enforces a consistent naming pattern for boolean props to ensure that the variable is prefixed with either is or has (or the uppercase equivalent). Any prefix symbol (_, $, etc) is allowed.

Non-Compliant Code Examples

type Props = {
  enabled: boolean;
  __enabled: boolean;
}

Compliant Code Examples

type Props = {
  isEnabled: boolean;
  hasFoo: boolean;
  __hasFoo: boolean;
  IS_ENABLED: boolean;
  is_enabled: boolean;
  has_enabled: boolean;
  __is_enabled: boolean;
  __has_enabled: boolean;
  hasEnabled: boolean;
  __isEnabled: boolean;
  __hasEnabled: boolean;
  canDoThis: boolean;
  shouldDoThat: boolean;
}
https://static.datadoghq.com/static/images/logos/github_avatar.svg https://static.datadoghq.com/static/images/logos/vscode_avatar.svg jetbrains

원활한 통합. Datadog Code Security 사용해 보기