---
title: "lint/operators/no-and-or-keywords"
pagination: false
---

{/* Generated by scripts/gen-rule-docs.py. Edit mapping.toml, not this file. */}

<RuleId id="lint/operators/no-and-or-keywords" />

In the [`code-quality`](/docs/rules/sets/code-quality) set. Unsafe fix: it can change behaviour. Intent: suspicious.

## What it does

Use `&&` and `||` logical operators instead of `and` and `or`.

## Configuration

```toml title="pun.toml"
[lint.rules]
"operators/no-and-or-keywords" = "error"
```

To skip it in some files, add an [override](/docs/configuration/pun-toml#lint) or a [`@pun-ignore-file`](/docs/configuration/ignore-comments) comment.

## Replaces

- [`logical_operators`](https://cs.symfony.com/doc/rules/operator/logical_operators.html) (php-cs-fixer, risky)
- [`LogicalToBoolean`](https://getrector.com/rule-detail/logical-to-boolean-rector) (rector)

## Merged rules

These old IDs are now this rule. A config that still names one stops with an error. See [merged rules](/docs/migrate/merged-rules).

- `lint/operators/prefer-boolean-and-or`

[More lint/operators rules](/docs/rules/lint/operators) · [Edit this page](https://github.com/shipfastlabs/pun/edit/main/crates/pun-config/rules/mapping.toml)
