close

no-octal-escape

Added in v0.4.2

Configuration

rslint.config.ts
import { defineConfig, js } from '@rslint/core';

export default defineConfig([
  js.configs.recommended,
  {
    rules: {
      'no-octal-escape': 'error',
    },
  },
]);

Rule Details

Disallows octal escape sequences in string literals.

As of the ECMAScript 5 specification, octal escape sequences in string literals are deprecated and should not be used. Unicode escape sequences should be used instead.

Examples of incorrect code for this rule:

var foo = 'Copyright \251';
var foo = '\1';
var foo = '\01';
var foo = '\08';

Examples of correct code for this rule:

var foo = 'Copyright \u00A9';
var foo = '\x51';
var foo = '\0';
var foo = '\\1';

Original Documentation