---
title: Consistent naming for boolean props
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: >-
  Docs > Datadog Security > Code Security > Static Code Analysis (SAST) > SAST
  Rules > Consistent naming for boolean props
---

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# Consistent naming for boolean props

{% callout %}
# Important note for users on the following Datadog sites: app.ddog-gov.com, us2.ddog-gov.com

{% alert level="danger" %}
This product is not supported for your selected [Datadog site](https://docs.datadoghq.com/getting_started/site.md). ({% placeholder "user-datadog-site-name" /%}).
{% /alert %}

{% /callout %}

## Metadata{% #metadata %}

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

**Language:** TypeScript

**Severity:** Notice

**Category:** Code Style

## Description{% #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{% #non-compliant-code-examples %}

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

## Compliant Code Examples{% #compliant-code-examples %}

```typescript
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;
}
```
  Seamless integrations. Try Datadog Code SecurityDatadog Code Security 
{% icon name="icon-external-link" /%}
 