Skip to content
New issue

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

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

Already on GitHub? # to your account

Eslint Auto fix #1597

Closed
shai32 opened this issue Feb 20, 2017 · 13 comments
Closed

Eslint Auto fix #1597

shai32 opened this issue Feb 20, 2017 · 13 comments

Comments

@shai32
Copy link

shai32 commented Feb 20, 2017

can we make Eslint Auto fix configurable?

I like that when in watch mode, it fixes my eslint on the fly.

@gaearon
Copy link
Contributor

gaearon commented Feb 20, 2017

Which rules would it be valuable for? Our lint rules don't include any style rules, so I'm not sure anything we report is autofixable. I also heard reports of autofix not working well with eslint-loader, causing infinite cycles.

For enforcing style, I would instead suggest Prettier. Does this help?

@shai32
Copy link
Author

shai32 commented Feb 20, 2017

I am not sure what rules are used in this project.

but if there are not there I will add them in eslint.js

Rules that the auto fix was useful for me is (you can see that all rules are fixable)

jsx-indent
arrow-body-style
object-shorthand
and there is a lot more.

it's very convenient that it auto fix my stuff.

can we add it?

@gaearon
Copy link
Contributor

gaearon commented Feb 20, 2017

I don't quite understand what you're asking.

Before ejecting, you can't change the ESLint config. Our ESLint config does not contain any style rules, as I said earlier. This is intentional, and briefly discussed at the end of #808.

I recommend using Prettier to enforce style, if you want to.

@gaearon gaearon closed this as completed Feb 20, 2017
@shai32
Copy link
Author

shai32 commented Feb 21, 2017

I don't want to use Prettier, I just want to turn on Auto fix in eslint.

I added some rules in my own custom eslint config.

and I Can't turn on eslint auto fix.

@gaearon
Copy link
Contributor

gaearon commented Feb 21, 2017

Sorry, it is not clear from your comments what you problem is. You didn't specify whether you ejected or not, what have you tried, what exactly didn't work, etc. It is very hard to help if you give so little information.

@shai32
Copy link
Author

shai32 commented Feb 22, 2017

I didn't eject.

everything is working, I am not reporting a bug.

I didn't try to turn on Eslint fix option because there is no way to do that without eject.

I am asking for an ability to turn on Eslint fix without ejecting

I Understand that your ESLint config does not include style rules.

I added style rules manually (no eject, only by adding .eslintrc to my project as discussed at #808)
and I want to turn on fix flag but there is no way to do it without eject.

I understand that there is reports of autofix not working well with eslint-loader, causing infinite cycles, but for me its working fine (we have 50 engineers working with it)

so Thats why I want the fix flag to be configurable (default off) so we can decide if to use it.

@gaearon
Copy link
Contributor

gaearon commented Feb 22, 2017

I added style rules manually (no eject, only by adding .eslintrc to my project as discussed at #808)

Okay, I understand better now. This is not really supported. If you add your own style rules, then please also manually run eslint --fix to get them fixed. As I mentioned before, eslint-loader has issues with autofix, and we won't be enabling it by default.

@shai32
Copy link
Author

shai32 commented Feb 22, 2017

I understand that there is reports of autofix not working well with eslint-loader, causing infinite cycles, but for me its working fine for me (we have 50 engineers working with it)

so Thats why I want the fix flag to be configurable (default off) so we can decide if to use it.

adding run eslint --fix will not help, because I Will need to run it every time I change my code.
when we run the project, it is in watch mode and every change is hot reloading the browser.
Adding fix flag in eslint-loader option is a more convenient, because it will fix the code on the fly (in watch mode). fixing my code instantly.

please consider adding it, its a very minor change. 👍

@gaearon
Copy link
Contributor

gaearon commented Feb 22, 2017

It is not a minor change if it breaks in some cases, and people can't turn it off.

I understand your concerns but using a custom .eslintrc is not supported in the first place. It may happen to work, but it's not how this tool is intended to be used.

I'm sorry if this is frustrating to you.

@gaearon
Copy link
Contributor

gaearon commented Feb 22, 2017

If you need modifications like this, consider making a fork for your company: #682

@shai32
Copy link
Author

shai32 commented Feb 22, 2017

I think that using a custom .eslintrc is very important, is there an open discusstion on it?, so I will write done my opinion about it.

@gaearon
Copy link
Contributor

gaearon commented Feb 22, 2017

Thanks, it's been discussed in #808 at length. Feel free to write here.

@sgehrman
Copy link

sgehrman commented Dec 1, 2018

so, there's no way to get autofix?

@lock lock bot locked and limited conversation to collaborators Jan 9, 2019
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants