no-unsupported-features/es-syntax
UnreleasedConfiguration
Disallows ECMAScript features that are unavailable in part of the configured Node.js version range.
Rule details
The rule checks syntax such as optional chaining, dynamic imports, class fields,
static blocks, regular expressions, and top-level await. It also checks the
built-in APIs included in the upstream feature table, such as Object.hasOwn
and Array.prototype.toSorted. Local bindings that shadow built-in globals
are excluded.
With version: ">=16.0.0", these examples are incorrect:
These features require Node.js 16.11, 16.9, and 20 respectively. Set a version range that supports the features you use, or use older syntax and APIs:
The rule does not provide automatic fixes or suggestions.
Options
version
The first valid Node.js version range is used, in this order:
- The rule's
versionoption. settings.n.version, thensettings.node.version.- The nearest valid
package.json'sengines.node. - Its
devEngines.runtimeentry namednode. - The default,
>=16.0.0.
Every version in the range must support a feature. For example, dynamic imports
support ^12.17.0 || >=13.2.0, but >=12.17.0 also includes unsupported Node.js
13.0 and 13.1. Strict mode is taken into account for features whose support in
older Node.js releases depends on it.
ignores
An array of features to skip, for example when a transpiler or polyfill supplies
them. Each feature accepts its upstream rule name, the name without no-, and
the camelCase spelling: no-optional-chaining, optional-chaining, and
optionalChaining are equivalent. Legacy aliases such as new.target,
regexpLookbehind, and trailingCommasInFunctions are also supported.
See the upstream feature table for the complete list and version ranges.
Shared settings
settings.node.version sets the target for multiple Node rules. The upstream
settings.n.version spelling remains supported and takes precedence when both
are set.
settings["es-x"].aggressive: true also reports prototype properties on receivers
whose type cannot be determined. By default, only recognized receivers are
reported. When a TypeScript project is configured, available type information
is used to recognize receivers, including unions and constrained generics.
Differences from upstream
- With
version: ">=15 || >20 <15", dynamic imports and nullish coalescing are accepted: the impossible>20 <15alternative matches no Node.js version. Upstream reports both features. Use>=15to get the same result in both tools.