Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are the ESLint globals from all environments "es6", "es2017", and "es2020" cumulative or incremental settings?

ESLint has global settings from all environments:

{
    "env": {
        "es6": true,
        "es2017": true,
        "es2020": true
    }
}

Are the ESLint globals from all environments es6, es2017, and es2020 cumulative or incremental settings?

In other words, is it enough to enable es2020 support to benefit from es6 and es2017 as well, or it is mandatory to enable each JS language version support separately?

like image 690
Mike Avatar asked May 08 '20 21:05

Mike


1 Answers

Yes, the environments are cumulative.

This can be best seen by looking at the relevant part of the source code (linking to the current master version on GitHub).

es6 includes only the globals defined in newGlobals2015. es2017 includes newGlobals2015 and newGlobals2017, while es2020 includes newGlobals2015, newGlobals2017 and newGlobals2020.

Update

Newer versions of ESLint depend on environments defined in a separate package, which uses a different structure (it's a plain JSON file). In the end though, the global definitions haven't changed.

like image 72
GOTO 0 Avatar answered Oct 19 '22 15:10

GOTO 0