---
# Don't modify this file manually. This file is auto generated from source, and you will lose your changes next time the website is built.
# Head to the `biomejs/biome` repository, and modify the source code in there.

title: noNonoctalDecimalEscape
description: Learn more about noNonoctalDecimalEscape
---
import { Tabs, TabItem } from '@astrojs/starlight/components';

<Tabs>
<TabItem label="JavaScript (and super languages)" icon="seti:javascript">
## Summary
- Rule available since: `v1.0.0`
- Diagnostic Category: [`lint/correctness/noNonoctalDecimalEscape`](/reference/diagnostics#diagnostic-category)
- This rule is **recommended**, meaning it is enabled by default.
- This rule has a [**safe**](/linter/#safe-fixes) fix.
- The default severity of this rule is [**error**](/reference/diagnostics#error).
- Sources: 
  - Same as [`no-nonoctal-decimal-escape`](https://eslint.org/docs/latest/rules/no-nonoctal-decimal-escape)

## How to configure
```json title="biome.json"
{
	"linter": {
		"rules": {
			"correctness": {
				"noNonoctalDecimalEscape": "error"
			}
		}
	}
}

```
## Description
Disallow `\8` and `\9` escape sequences in string literals.

Since ECMAScript 2021, the escape sequences \8 and \9 have been defined as non-octal decimal escape sequences.
However, most JavaScript engines consider them to be "useless" escapes. For example:

```js
"\8" === "8"; // true
"\9" === "9"; // true
```

Although this syntax is deprecated, it is still supported for compatibility reasons.
If the ECMAScript host is not a web browser, this syntax is optional.
However, web browsers are still required to support it, but only in non-strict mode.
Regardless of your targeted environment, it is recommended to avoid using these escape sequences in new code.

## Examples

### Invalid

```js
const x = "\8";
```

<pre class="language-text"><code class="language-text">code-block.js:1:12 <a href="https://biomejs.dev/linter/rules/no-nonoctal-decimal-escape">lint/correctness/noNonoctalDecimalEscape</a> <span style="color: #000; background-color: #ddd;"> FIXABLE </span> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━<br /><br />  <strong><span style="color: Tomato;">✖</span></strong> <span style="color: Tomato;">Don't use </span><span style="color: Tomato;"><strong>&#96;&#92;8&#96;</strong></span><span style="color: Tomato;"> and </span><span style="color: Tomato;"><strong>&#96;&#92;9&#96;</strong></span><span style="color: Tomato;"> escape sequences in string literals.</span><br />  <br />  <strong><span style="color: Tomato;">&gt;</span></strong> <strong>1 │ </strong>const x = &quot;&#92;8&quot;;<br />   <strong>   │ </strong>           <strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><br />    <strong>2 │ </strong><br />  <br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used.</span><br />  <br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">Safe fix</span><span style="color: lightgreen;">: </span><span style="color: lightgreen;">Replace </span><span style="color: lightgreen;"><strong>&#92;8</strong></span><span style="color: lightgreen;"> with </span><span style="color: lightgreen;"><strong>8</strong></span><span style="color: lightgreen;">. This maintains the current functionality.</span><br />  <br />  <strong>  1 │ </strong>const<span style="opacity: 0.8;">·</span>x<span style="opacity: 0.8;">·</span>=<span style="opacity: 0.8;">·</span>&quot;<span style="color: Tomato;">&#92;</span>8&quot;;<br />  <strong>    │ </strong>           <span style="color: Tomato;">-</span>   <br /></code></pre>

```js
const x = "Don't use \8 escape.";
```

<pre class="language-text"><code class="language-text">code-block.js:1:22 <a href="https://biomejs.dev/linter/rules/no-nonoctal-decimal-escape">lint/correctness/noNonoctalDecimalEscape</a> <span style="color: #000; background-color: #ddd;"> FIXABLE </span> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━<br /><br />  <strong><span style="color: Tomato;">✖</span></strong> <span style="color: Tomato;">Don't use </span><span style="color: Tomato;"><strong>&#96;&#92;8&#96;</strong></span><span style="color: Tomato;"> and </span><span style="color: Tomato;"><strong>&#96;&#92;9&#96;</strong></span><span style="color: Tomato;"> escape sequences in string literals.</span><br />  <br />  <strong><span style="color: Tomato;">&gt;</span></strong> <strong>1 │ </strong>const x = &quot;Don't use &#92;8 escape.&quot;;<br />   <strong>   │ </strong>                     <strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><br />    <strong>2 │ </strong><br />  <br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used.</span><br />  <br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">Safe fix</span><span style="color: lightgreen;">: </span><span style="color: lightgreen;">Replace </span><span style="color: lightgreen;"><strong>&#92;8</strong></span><span style="color: lightgreen;"> with </span><span style="color: lightgreen;"><strong>8</strong></span><span style="color: lightgreen;">. This maintains the current functionality.</span><br />  <br />  <strong>  1 │ </strong>const<span style="opacity: 0.8;">·</span>x<span style="opacity: 0.8;">·</span>=<span style="opacity: 0.8;">·</span>&quot;Don't<span style="opacity: 0.8;">·</span>use<span style="opacity: 0.8;">·</span><span style="color: Tomato;">&#92;</span>8<span style="opacity: 0.8;">·</span>escape.&quot;;<br />  <strong>    │ </strong>                     <span style="color: Tomato;">-</span>           <br /></code></pre>

```js
const x = "Don't use \9 escape.";
```

<pre class="language-text"><code class="language-text">code-block.js:1:22 <a href="https://biomejs.dev/linter/rules/no-nonoctal-decimal-escape">lint/correctness/noNonoctalDecimalEscape</a> <span style="color: #000; background-color: #ddd;"> FIXABLE </span> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━<br /><br />  <strong><span style="color: Tomato;">✖</span></strong> <span style="color: Tomato;">Don't use </span><span style="color: Tomato;"><strong>&#96;&#92;8&#96;</strong></span><span style="color: Tomato;"> and </span><span style="color: Tomato;"><strong>&#96;&#92;9&#96;</strong></span><span style="color: Tomato;"> escape sequences in string literals.</span><br />  <br />  <strong><span style="color: Tomato;">&gt;</span></strong> <strong>1 │ </strong>const x = &quot;Don't use &#92;9 escape.&quot;;<br />   <strong>   │ </strong>                     <strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><br />    <strong>2 │ </strong><br />  <br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">The nonoctal decimal escape is a deprecated syntax that is left for compatibility and should not be used.</span><br />  <br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">Safe fix</span><span style="color: lightgreen;">: </span><span style="color: lightgreen;">Replace </span><span style="color: lightgreen;"><strong>&#92;9</strong></span><span style="color: lightgreen;"> with </span><span style="color: lightgreen;"><strong>9</strong></span><span style="color: lightgreen;">. This maintains the current functionality.</span><br />  <br />  <strong>  1 │ </strong>const<span style="opacity: 0.8;">·</span>x<span style="opacity: 0.8;">·</span>=<span style="opacity: 0.8;">·</span>&quot;Don't<span style="opacity: 0.8;">·</span>use<span style="opacity: 0.8;">·</span><span style="color: Tomato;">&#92;</span>9<span style="opacity: 0.8;">·</span>escape.&quot;;<br />  <strong>    │ </strong>                     <span style="color: Tomato;">-</span>           <br /></code></pre>

### Valid

```js
const x = "8";
```

```js
const x = "Don't use \\8 and \\9 escapes.";
```

## Related links

- [Disable a rule](/linter/#disable-a-rule)
- [Configure the code fix](/linter#configure-the-code-fix)
- [Rule options](/linter/#rule-options)
- [Source Code](https://github.com/biomejs/biome/blob/main/crates/biome_js_analyze/src/lint/correctness/no_nonoctal_decimal_escape.rs)
- [Test Cases](https://github.com/biomejs/biome/blob/main/crates/biome_js_analyze/tests/specs/correctness/noNonoctalDecimalEscape)

</TabItem>
</Tabs>