wharfkit / antelope

Core types, client interfaces, and other tools for working with Antelope-based blockchains.
Other
42 stars 23 forks source link

Add eslint-plugin with rule no-optional-chaining #40

Closed ericpassmore closed 1 year ago

ericpassmore commented 1 year ago

Project does not allow optional chaining. We should prevent optional chaining with a eslint custom rule. https://github.com/facebook/lexical/pull/3233

ericpassmore commented 1 year ago

After some investigation, downstream clients running older node or older browsers would likely have the problem. Another option to eslint back to a common supported release. Optional Chaining was introduced in ES2020 so standardizing on ES2019 would be fairly safe. Although with downstream browsers it might be better to go further back to ES2015.

Linting would warn/error on unsupported features, but we could still compile with the latest TS release.

npm install --save-dev eslint eslint-plugin-es-x

with plugin:es/restrict-to-es2020