Skip to content
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.

passing options to rake eslint:run #17

Open
metapraveen opened this issue May 6, 2016 · 4 comments
Open

passing options to rake eslint:run #17

metapraveen opened this issue May 6, 2016 · 4 comments

Comments

@metapraveen
Copy link

Sorry if I have missed any obvious point, how do I pass option to eslint while running rake eslint:run
I am adding this gem to my rails project and I want to run eslint on only chnaged or new files, so I need to pass option --cache to eslint

@e0da
Copy link
Contributor

e0da commented May 9, 2016

So I think we should just add a variable parameter to the rake task. When we do rake test, we can do

rake test TEST=path/to/my_test.rb TESTOPTS='--name=test_a_feature'

So I'm thinking we could add something so you can do

rake eslint:run ESLINTOPTS='--cached'

The only downside I see is that we probably should not mirror this capability in the web interface because I haven't thought of a good way to do it yet. Also, maybe people don't use the web interface?

@DLvalentine
Copy link

I certainly love the web interface when I am manually fixing warnings/errors by hand. It helps a lot, and reduces the strain of having to read terminal output, which isn't always pretty.

I do wish there was an easier way to provide flags, and think it is critical considering eslint can attempt to auto correct issues with the --fix flag. Rubocop has an excellent way of handling flags like that, and I would very much like to see this be a thing with eslint-rails.

@DLvalentine
Copy link

I will consider taking a look at this perhaps contributing in order to make this a reality 😎🤔🍻

@DLvalentine
Copy link

DLvalentine commented Feb 16, 2018

So I forked this repo and wrote in code to allow for auto-correction, as well as a few more goodies. Seeing as this repo isn't really being actively maintained, I will keep the fork separate unless it is desired that they be merged.

New features include

  1. updated readme
  2. updated eslint
  3. autocorrection feature
  4. different exit statuses based on eslint.json settings. If you have a rule set to error, the build will exit 1. If it is set to warning and no errors exist, it will exit 0
  5. updated the controller to not break if you don't provide force_deafult
  6. updated the web interface to allow you to use autocorrect, or not
  7. updated the rake tasks
  8. updated the before_filter to be before_action, since the former was deprecated

I'll be continuing my own support for this in my free time, and intend to include many more features and improvements :)

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

No branches or pull requests

3 participants