eslint / eslint-scope

eslint-scope: ECMAScript scope analyzer
BSD 2-Clause "Simplified" License
125 stars 30 forks source link

ecmaVersion >= 2015 #82

Closed mdjermanovic closed 2 years ago

mdjermanovic commented 2 years ago

ref: https://github.com/eslint/eslint/pull/15185#issuecomment-980475525

eslint-scope expects 3, 5, 6, 7, ... 13 as ecmaVersion. Those are the values eslint-scope is currently getting from ESLint, and all eslint-scope tests are based on those values.

After we merge and release https://github.com/eslint/eslint/pull/15185, ESLint will be passing 3, 5, 2015, 2016, ... 2022 as ecmaVersion to eslint-scope, regardless of the mode (eslintrc or flat config).

This should work the same as it was working before, because eslint-scope uses ecmaVersion only to check if it is >= 5, and >= 6:

https://github.com/eslint/eslint-scope/blob/e57ffb0409d12be60fc006a12d191321e4879925/lib/scope-manager.js#L80-L82

https://github.com/eslint/eslint-scope/blob/e57ffb0409d12be60fc006a12d191321e4879925/lib/scope-manager.js#L248-L250

So, any of 6, 7, 8, 9, 10, 11, 12, 13, 2015, 2016, 2017, 2018, 2019, 2020, 2021, and 2022 will work the same, as they're all >= 5 and >= 6.

However, it would be good to add some tests with the new values, to confirm this behavior and make sure that it won't break after future changes to eslint-scope.