question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ES3 reserved words

See original GitHub issue

The issue: https://github.com/zloirock/core-js/issues/980

In the code used char as a variable name. The ESLint config contains ecmaVersion: 3, till this week here was used the default ESLint parser. char is a ES3 reserved word:

Снимок экрана 2021-09-01 в 20 46 37

ESLint parsed it without any errors or warnings. However, this code might not work in some ES3 engines.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:22 (18 by maintainers)

github_iconTop GitHub Comments

1reaction
nzakascommented, Sep 7, 2021
1reaction
nzakascommented, Sep 7, 2021

We could fix this in Espree as a breaking change, release Espree v9.0.0, and then use Espree 9 in ESLint v8.0.0.

That’s what I was thinking, too.

Should we actually set allowReserved: “never” for ES3, to also disallow obj.char and var obj = { char: 1 }?

Yes. Reserved words were completely illegal in ES3.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Keywords and reserved words in JavaScript
The filters below show which are keywords, and which are reserved words in different versions of ECMA ... The reserved words in ES2...
Read more >
babel/plugin-transform-reserved-words
This plugin, to be used when targeting ES3 environments, renames variables from that set of words.
Read more >
9. Reserved Words | Javascript: Object Oriented Programming
Chapter 9. Reserved Words. This appendix provides two lists of reserved keywords as defined in ECMAScript 5 (ES5). The first one is the...
Read more >
[MS-ES3]: [ECMA-262-1999] Section 7.5.3, Future Reserved Words ...
JScript 5.x only considers the following to be FutureReservedWords: class, const, debugger, enum, export, extends, import, super.
Read more >
reserved-keywords - npm
Tiny package for detecting reserved words. Reserved Word is either a Keyword , or a Future Reserved Word , or a Null Literal...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found