babel/babel-eslint

generator-star should ignore transpiled async/await functions

jonathanong opened this issue · 12 comments

getting this error:

Expected no space before *  generator-star

instead, this rule should somehow be ignored with transpiled async/await functions

hzoo commented

Should babel-eslint patch actual eslint rules?

Certainly not. It's way too risky as they change so much and it'd mostly require replacing the entire rule. I'm not sure if this specific issue can be addressed since you have to turn await expressions/async functions into something and the likely equivalent is a yield/generator.

hzoo commented

Yeah agree. Although I guess people will ask since

I can speak for myself here: we aren't implementing experimental features. If you need such support in ESLint, you can use babel-eslint.

hzoo commented

I guess we'll just close for now?

would be great if there were a "known rule conflicts" list in the readme so i know just to not use this rule when using babel. no biggie.

hzoo commented

@jonathanong That sounds like a good idea. I already made a comment about using the react plugin for jsx issues. Would you like to make a PR to start the list?

Instead of patching eslint rules, what about a babel plugin that adds comments to disable the rule for that expression (/*eslint-disable generator-star*/)?

👍 for @matthewwithanm comment

hzoo commented

@jonathanong Ok I added the rule to the Known Issues section of the readme.

Unless I'm misunderstanding how it would work, I don't get how the plugin would help with the errors? The babel plugin would transform your generated file to have the comments while the source file wouldn't have them - and eslint is usually run on the source file itself?

hzoo commented

Just notifying people here that there's now a https://github.com/babel/eslint-plugin-babel - will try to reimplement rules as a plugin (similar to eslint-plugin-react). I will add a note in the readme about it.

@hzoo Awesome, thanks!

Apparently, this still happens even with babel/generator-star-spacing when you do static async myFunc() { for example. Will investigate and follow-up in the appropriate repo.