---
url: /docs/guide/usage/linter/rules/unicorn/consistent-template-literal-escape.md
---

### 作用

强制在模板字面量中转义 `${` 时保持一致的风格。

### 为什么这不好？

使用 `\${` 而不是 `${` 可以提升可读性，并避免混淆。

### 示例

以下是此规则下**不正确**的代码示例：

```js
const foo = `$\{a}`;
```

```js
const foo = `\$\{a}`;
```

以下是此规则下**正确**的代码示例：

```js
const foo = `\${a}`;
```

## How to Use

## 版本

此规则已在 v1.60.0 中添加。

## 参考资料
