开发者

How to configure eslint for particular ECMA features?

开发者 https://www.devze.com 2022-12-07 19:41 出处:网络
The project targets specific version of Node.js. This is the runtime of the code. There is no transpilation step. JavaScript code is deployed as it is.
  • The project targets specific version of Node.js. This is the runtime of the code.
  • There is no transpilation step. JavaScript code is deployed as it is.
  • Particular Node version can support particular ECMA version partly. I want to use those features that are supported.
  • Eslint allows for specifying compatibility as ECMA version only, as far as I know.

How can I tell Eslint that a particular ECMA feature is supported?

For example: https://kangax.github.io/compat-table/es2016plus/#node16_9. Node v16.9 supports ES2022 only partly, so I cannot set ecmaVersion to 2022. But I want to use instance class fields, for example, which is supported by Node v16.9.

I know about https://github.com/mysticatea/eslint-plugin-node and its fork https://github.com/eslint-community/eslint-plugin开发者_StackOverflow-n, which are supposed to somehow configure Eslint based on the package.engines.node value. But my question is about the core Eslint - is there a way of configuring particular ECMA features that are supported by the runtime?

0

精彩评论

暂无评论...
验证码 换一张
取 消