eslint-plugin-compat icon indicating copy to clipboard operation
eslint-plugin-compat copied to clipboard

ES6 features (e.g. generators) not being tested against browsers

Open niftylettuce opened this issue 5 years ago • 6 comments

Generators for example don't throw an error for IE11 https://kangax.github.io/compat-table/es6/#test-generators

niftylettuce avatar Mar 21 '19 17:03 niftylettuce

Hey @amilajack for the great work so far,

Quick question - Is kangax supported currently or is it still TODO?

A couple of tools which have fallen out of maintainence, that check kangax that may be worth looking at to help with incorporating with this tool, if it would be preferable

https://github.com/kamilogorek/compat-cli https://github.com/jgardella/compat

YOU54F avatar Apr 30 '19 15:04 YOU54F

@YOU54F we're mostly trying to check browser API features at the moment. Usually ES features can either be polyfilled. It is often that browser APIs do not have polyfills so we're trying to focus on those first. Since babel-polyfill can be used for polyfilling, this is a lower priority.

amilajack avatar Apr 30 '19 15:04 amilajack

I can imagine having two separate rules: compat/apis vs. compat/syntax. Would be neat.

I also am mostly looking for linting of APIs since babel-preset-env handles pretty much every modern syntax enhancement, but as more and more of the syntaxes are natively supported, it'd be neat to have this plugin check syntaxes also. Probably pretty straightforward as there are probably often direct mappings between modern features and ESTree node types.

benmosher avatar May 08 '19 11:05 benmosher

@YOU54F we're mostly trying to check browser API features at the moment. Usually ES features can either be polyfilled. It is often that browser APIs do not have polyfills so we're trying to focus on those first. Since babel-polyfill can be used for polyfilling, this is a lower priority.

I run into a similar problem. I used arrow functions and for...of but its not supported for IE 11. The plugin should check syntax, too. In my envorinment it's not possible to use transpilers

wehrstedt avatar Jun 21 '19 10:06 wehrstedt

I added https://github.com/mysticatea/eslint-plugin-es to disallow some es6 features for my needs. Isnt it possible to extend this plugin here?

wehrstedt avatar Jun 21 '19 10:06 wehrstedt

You don’t need an eslint plugin. Just set ecmaVersion to what you’re targeting, and use no-restricted-syntax if you need to block a subset.

ljharb avatar Jun 21 '19 18:06 ljharb