Skip to content

Report '\08' and '\09' in no-octal-escape #12080

@mdjermanovic

Description

@mdjermanovic

Tell us about your environment

  • ESLint Version: 6.1.0
  • Node Version: 10.16.0
  • npm Version: 6.9.0

What parser (default, Babel-ESLint, etc.) are you using?

default

Please show your full configuration:

Configuration
```js
module.exports = {
  parserOptions: {
    ecmaVersion: 2015,
  },
};

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

/*eslint no-octal-escape: "error"*/

"\08"
"\09"
eslint index.js

What did you expect to happen?

2 errors

What actually happened? Please include the actual, raw output from ESLint.

No errors

Are you willing to submit a pull request to fix this bug?

Yes, I'll be glad to do it. (#12079 should be merged first as this would collide)

Engines/parsers are already reporting these as octal escapes in strict mode:

"use strict";
"\08"
  • Chrome: Octal escape sequences are not allowed in strict mode.
  • Firefox: "0"-prefixed octal literals and octal escape sequences are deprecated; for octal literals use the "0o" prefix instead
  • Espree: Octal literal in strict mode

Per the spec. 08 is not a valid escape sequence but it seems that it can be interpreted like 0 as a LegacyOctalEscapeSequence followed by a character 8.

LegacyOctalEscapeSequence::

OctalDigit[lookahead ∉ OctalDigit]

So I guess to be technically correct the rule should report \0?

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedThere is consensus among the team that this change meets the criteria for inclusionarchived due to ageThis issue has been archived; please open a new issue for any further discussionbugESLint is working incorrectlyenhancementThis change enhances an existing feature of ESLintruleRelates to ESLint's core rules

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions