keithamus / eslint-plugin-escompat

Report errors for code which wont work in browsers without transpiling
MIT License
32 stars 6 forks source link

Review and incorporate from eslint-plugin-es-x #36

Open brettz9 opened 1 month ago

brettz9 commented 1 month ago

eslint-plugin-es-x is an ESLint community project which tracks ES features (some polyfillable and some not) and lets one selectively disable them.

It appears they have some rules this project should probably include, e.g., https://eslint-community.github.io/eslint-plugin-es-x/rules/no-regexp-unicode-property-escapes-2023.html or https://eslint-community.github.io/eslint-plugin-es-x/rules/no-private-in.html

I don't know if you'd think it better for maintenance to just incorporate their rules in a config-like fashion, or adopt from their MIT-licensed source code.

keithamus commented 1 month ago

I'd be happy either way, but it seems like there's a high level of duplication between eslint-plugin-es, eslint-plugin-es-x and this plugin. We should endevour to simplify the ecosystem, so I'd be happy to see some of the featureset of this plugin contributed to eslint-plugin-es-x and deprecate this plugin or something.

Either way, I've invited you to maintain this project so please feel free to take decisions you feel are best.

brettz9 commented 1 month ago

Thanks. I've also since noticed (and hadn't before) that eslint-plugin-compat has its own lintAllEsApis setting, which is rather interesting as I see it is getting its data (including this data) from two large sources of browser support information, MDN and caniuse.com, through the packages of https://www.npmjs.com/package/ast-metadata-inferer (which gets it from https://www.npmjs.com/package/@mdn/browser-compat-data ) and https://www.npmjs.com/package/caniuse-lite (which gets it from https://www.npmjs.com/package/caniuse-db ).

I don't see any expression of intention for eslint-plugin-es-x to work with browserslist detection, so I imagine there may remain a need for at least one of the two compatibility plugins. I'm also not sure whether the "experimental" inclusion of ES data in eslint-plugin-compat means that the sources are limited in the information they provide. So there may remain a need for both plugins unless the metadata sources are maintained with all this information. But would be worth looking into. (My plate is kind of full atm, but wanted to explore the landscape a little.)

If the metadata from eslint-plugin-compat is lacking, I think this plugin ought to expand its scope a little beyond the items which can't be polyfilled to include ES-only features which can be polyfilled (e.g., globalThis support detection). This should ensure that no feature detection type falls through the cracks.

keithamus commented 1 month ago

I think that sounds reasonable. Happy to review any PRs or discuss any issues but I won’t have much time for development.