67 lines
1.9 KiB
Plaintext

== Why is this an issue?
The ECMAScript specification defines a set of special words as future keywords of the language. They don't have particular meaning for now, but they might at some future time.
The list contains the following words:
* ``++await++``
* ``++class++``
* ``++const++``
* ``++enum++``
* ``++export++``
* ``++extends++``
* ``++implements++``
* ``++import++``
* ``++interface++``
* ``++let++``
* ``++package++``
* ``++private++``
* ``++protected++``
* ``++public++``
* ``++static++``
* ``++super++``
* ``++yield++``
Some of these words have already been adopted by current versions of ECMAScript, but they are kept to consider legacy JavaScript codebases as well. Others are only reserved when used in strict mode.
These future reserved words should be avoided because they may cause syntax errors if they are ever adopted.
[source,javascript]
----
const package = document.getElementsByName("foo"); // Noncompliant: `package` is used as an identifier here
----
These future keywords can be used anywhere if it is not identifiers.
[source,javascript]
----
const someData = { package: true }; // Compliant: `package` is not used as an identifier here
----
== Resources
=== Documentation
* MDN web docs - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#future_reserved_words[Future reserved words]
* MDN web docs - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode[Strict mode]
* Wikipedia - https://en.wikipedia.org/wiki/Syntax_error[Syntax error]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Rename "{0}" identifier to prevent potential conflicts with future evolutions of the JavaScript language.
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]