Skip to content
This repository was archived by the owner on May 19, 2018. It is now read-only.

Create espree plugin #651

Closed
tunnckoCore opened this issue Jul 28, 2017 · 14 comments
Closed

Create espree plugin #651

tunnckoCore opened this issue Jul 28, 2017 · 14 comments

Comments

@tunnckoCore
Copy link

tunnckoCore commented Jul 28, 2017

Hey! 👋

I'm just digging around babel-eslint, babylon and eslint. Trying to set up some config for eslint. I always wonder why even babel-eslint exist. Okey, there are reasons, but behind the scenes most of it's code base is that babylon-to-espree, so today i'm thinking why not just include it here? So then we can freely add ESLint parser option to babylon, e.g. "parser": "babylon".

Currently there are three problems: 1) babel-eslint has some bugs and don't have "full" support and configuration of the babylon, 2) eslint can't use babylon only because ranges (which thing is exactly the idea behind babylon-to-espree in the babel-eslint), 3) if eslint use babel-eslint it don't get all of the power of babylon. Or okey, it should, but there are some problems, which i don't want to report, because it may be better to do the effort to PR such plugin.

Do you want PRs here and there for such thing?

Sorry if something isn't clear, i'm a bit tired. ;]

@hzoo
Copy link
Member

hzoo commented Jul 28, 2017

Hey @charlike! We really appreciate you taking the time to report an issue. The collaborators
on this project attempt to help as many people as possible, but we're a limited number of volunteers,
so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack
community that typically always has someone willing to help. You can sign-up here
for an invite.

@hzoo
Copy link
Member

hzoo commented Jul 28, 2017

@charlike no it's a good idea, had a similar thought earlier https://github.com/babel/notes/blob/23a33a109cc230119f7abd1348a0e8c4bed442d3/2017-06/june-21.md#babel-eslint about making an "eslint" plugin but espree works too since it would be the same thing. Yeah basically if we integrate that functionality in babylon itself we don't need babel-eslint to do that much stuff.

Not sure what you mean about the full support/config of babylon though? and babylon does allow ranges as an option https://github.com/babel/babylon#options.

cc @not-an-aardvark @kaicataldo on thoughts?

@tunnckoCore
Copy link
Author

I'm not talking about making eslint plugin. I'm talking about moving some babel-eslint code here as native babylon's builtin plugin. Babel-eslint then may be just some thin layer for babel-specific things and fixes. In bonus we will can just use babylon as eslint parser.

Not sure what you mean about the full support/config of babylon though? and babylon does allow ranges as an option babel/babylon#options.

I just mean that babel-eslint has too much hardcoded things and some things may not work so well like it would if we just has espree plugin here and use that parser in the eslint directly, not through babel-eslint.

@existentialism
Copy link
Member

existentialism commented Jul 28, 2017

@charlike that is exactly what @hzoo is proposing :)

Possibly add another Babylon plugin for ESLint so that we don't have to mutate the AST afterward, effectively making babel-eslint a minimal wrapper.

He originally proposed an eslint (in this case naming it estree may make more sense) plugin for babylon.

@tunnckoCore
Copy link
Author

tunnckoCore commented Jul 28, 2017

What? 😆 Sorry it's sounds a bit strange to me. Of course it is possible, but then it won't feel as good as defining it through ESLint's parser option ✌️ I see it like needless effort, when we almost have ready esPree plugin for babylon.

@hzoo
Copy link
Member

hzoo commented Jul 28, 2017

@charlike I think you are confused? Brian is saying I proposed the exact same thing you did, I just named it "eslint" instead of "espree"

@tunnckoCore
Copy link
Author

Doh, probably, i'm a bit tired 🤣 just realised that after rereading it.

@not-an-aardvark
Copy link
Member

cc @not-an-aardvark on thoughts?

Thanks for the ping. In theory it sounds like it would nice to have a way of making babylon produce ESTree, although I think babel-eslint would still be necessary in either case for patching scope analysis. I'm not really familiar enough with babel-eslint's codebase to have a strong opinion one way or the other about whether this is worthwhile.

@hzoo
Copy link
Member

hzoo commented Jul 28, 2017

@not-an-aardvark In theory we should be able to remove everything in https://github.com/babel/babel-eslint/tree/master/babylon-to-espree, the scope stuff is in https://github.com/babel/babel-eslint/blob/master/index.js

(babylon already produces ESTree via the estree plugin) babel/babel-eslint#489

@tunnckoCore
Copy link
Author

tunnckoCore commented Jul 28, 2017

@not-an-aardvark: In theory it sounds like it would nice to have a way of making babylon produce ESTree

it's Babylon's esTree plugin making that? huh. Or you meant esPree. Haha, damn names 🚀 🤣

@not-an-aardvark
Copy link
Member

I meant ESTree. I hadn't realized that plugin already exists.

@danez
Copy link
Member

danez commented Oct 31, 2017

I guess this is already solved, if there are problems with the estree plugin we are happy to accept issues and PRs.

@danez danez closed this as completed Oct 31, 2017
@hzoo
Copy link
Member

hzoo commented Oct 31, 2017

@danez this is for espree not estree. The idea is that we would move logic from babel-eslint into the babylon parser as a plugin, depends on if it's worth doing (possibly)

@tunnckoCore
Copy link
Author

tunnckoCore commented Nov 1, 2017

@hzoo yup.

Yea, it worth.

So please open, i can get something done when get time.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants