Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the rule fixable #8

Open
gajus opened this issue Jan 19, 2016 · 8 comments
Open

Make the rule fixable #8

gajus opened this issue Jan 19, 2016 · 8 comments

Comments

@gajus
Copy link

gajus commented Jan 19, 2016

It would be nice if this plugin/rule was able to fix itself.

@michaeljonathanblack
Copy link

Ah shoot, that's the only reason I was going to pull this library. I wanted to eslint --fix a file that has way too many functions and isn't sorted in any logical way.

@gajus
Copy link
Author

gajus commented May 25, 2016

@channikhabra has written a brilliant utility for that https://github.com/channikhabra/js-sort-object-properties

@michaeljonathanblack
Copy link

Thanks gajus!

@michaeljonathanblack
Copy link

I spoke too soon, I couldn't get that to work on anything complex... Works great on the example code, though!

@gajus
Copy link
Author

gajus commented May 26, 2016

@mherodev best to raise an issue where the author can see, https://github.com/channikhabra/js-sort-object-properties/issues

@davidpfahler
Copy link

davidpfahler commented Jul 3, 2016

I would be extremely helpful if this did fix itself. Otherwise it really isn't practical.
I would gladly help making this possible, though I really can't find a clue how to attempt this.


Hey all, I dove into this a bit and it seems this is not possible with the current fixer in ESLint. I think a babel plugin would be the better choice here.

@jacobrask
Copy link
Owner

You might be able to do something with jscodeshift, inspired by https://github.com/reactjs/react-codemod/blob/master/transforms/sort-comp.js

@davidpfahler
Copy link

@jacobrask Thank you. I'm still looking into this. For performance reasons, especially during dev, I'd like to avoid parsing the code twice. For reference, these discussion in eslint issues might be relevant: eslint/eslint#5329 estree/estree#41

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

No branches or pull requests

4 participants