robatwilliams / es-compat

Check JavaScript code compatibility with target runtime environments
MIT License
65 stars 13 forks source link

Update to ES modules #38

Closed robatwilliams closed 6 months ago

robatwilliams commented 2 years ago

Update the code of the plugin itself to use import and export rather than require and module.exports.

Update the lint rules in eslintrc to require this style, and prohibit CommonJS style.

robatwilliams commented 1 year ago

Runs into problem https://github.com/mysticatea/eslint-plugin-node/issues/349

Could disable that rule, and rely on CI unit tests to catch e.g. Node 14 issues. But currently that doesn't cover the check-es-compat utility.

robatwilliams commented 1 year ago

Disable the rule, and use es-compat itself to check compatibility of its own source code? (!) But that would be disconnected from package.json:engines

robatwilliams commented 1 year ago

Need to switch to https://github.com/eslint-community/eslint-plugin-n because the author (same one as eslint-plugin-es) has also abandoned his node plugin

robatwilliams commented 1 year ago

Blocked on Jest ESM support - https://jestjs.io/docs/ecmascript-modules

robatwilliams commented 1 year ago

to do as part of this eventually:

robatwilliams commented 1 year ago

Also see this about importing browser compat data https://github.com/mdn/browser-compat-data/releases/tag/v5.0.0