# prefer-short-escape-sequences

Rule `unicorn/prefer-short-escape-sequences`. Prefer shorter alternatives to Unicode escape sequences.

- Source: unicorn
- Technologies: JavaScript
- Kind: style
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 9.9M weekly downloads of presets that enable it
- Trend: +28.3% last quarter
- Rank: #991 by reach, #1246 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `unicorn/prefer-short-escape-sequences` | no | safe | package `eslint-plugin-unicorn` | [docs](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v80.0.0/docs/rules/prefer-short-escape-sequences.md) |

## Code examples

### Incorrect: the rule reports this

```js
const text = "Line one\u000ALine two";
const template = `Line one\u000ALine two`;
```

### Correct: the rule accepts this

```js
const text = "Line one\nLine two";
const template = `Line one\nLine two`;
```

Examples from the ESLint documentation.

## Enable it

### ESLint: `eslint.config.js`

```js
import unicorn from "eslint-plugin-unicorn";

export default [
  {
    plugins: { unicorn },
    rules: {
      "unicorn/prefer-short-escape-sequences": "error",
    },
  },
];
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Unicorn recommended](https://lintradar.dev/presets/unicorn-recommended.md) | ESLint | `eslint-plugin-unicorn` | 340 | 9.5M | +30.3% |
| [Unicorn unopinionated](https://lintradar.dev/presets/unicorn-unopinionated.md) | ESLint | `eslint-plugin-unicorn` | 236 | 9.5M | +30.3% |
| [XO](https://lintradar.dev/presets/xo.md) | ESLint | `eslint-config-xo` | 618 | 413K | −5.0% |

## Related rules

- [unicorn/prefer-queue-microtask](https://lintradar.dev/rules/unicorn/prefer-queue-microtask.md): Prefer `queueMicrotask()` over `process.nextTick()`, `setImmediate()`, and `setTimeout(…, 0)`.
- [unicorn/prefer-simple-sort-comparator](https://lintradar.dev/rules/unicorn/prefer-simple-sort-comparator.md): Prefer a simple comparison function for `Array#sort()`.
- [unicorn/prefer-promise-with-resolvers](https://lintradar.dev/rules/unicorn/prefer-promise-with-resolvers.md): Prefer `Promise.withResolvers()` when extracting resolver functions from `new Promise()`.
- [unicorn/prefer-simplified-conditions](https://lintradar.dev/rules/unicorn/prefer-simplified-conditions.md): Prefer simplified conditions.
- [unicorn/prefer-promise-static-methods](https://lintradar.dev/rules/unicorn/prefer-promise-static-methods.md): Prefer `Promise.resolve()` and `Promise.reject()` over trivial `new Promise()` calls.
- [unicorn/prefer-single-array-predicate](https://lintradar.dev/rules/unicorn/prefer-single-array-predicate.md): Prefer a single `Array#some()` or `Array#every()` with a combined predicate.

---

Web page: https://lintradar.dev/rules/unicorn/prefer-short-escape-sequences. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
