eslint-plugin-compat
eslint-plugin-compat copied to clipboard
ES6 features (e.g. generators) not being tested against browsers
Generators for example don't throw an error for IE11 https://kangax.github.io/compat-table/es6/#test-generators
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 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 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.
@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
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?
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.