Lint-staged: The command line is too long(windows)

Created on 15 Apr 2017  ·  36Comments  ·  Source: okonet/lint-staged

I ran my project through prettier and ended up with 99+ modified files. Am using cmder on windows 8 and I got this while trying to commit:

λ git commit -m "Make it prettier"
25l[20:30:20] Running tasks for src/**/*.js [started]
[20:30:20] eslint --fix [started]
[20:30:20] eslint --fix [failed]
[20:30:20] → 🚫 eslint --fix found some errors. Please fix them and try committing again.
The command line is too long.


Stack Trace

{ Error: Command failed: E:\Projects\repos\elastic-builder\node_modules\.bin\eslint.CMD --fix -- E:\Projects\repos\elastic-builder\src\queries\term-level-queries\wildcard-query.js E:\Projects\repos\elastic-builder\src\queries\term-level-queries\value-term-query-base.js E:\Projects\repos\elastic-builder\src\queries\term-level-queries\type-query.js E:\Projects\repos\elastic-builder\src\queries\term-level-queries\terms-query.js E:\Projects\repos\elastic-builder\src\queries\term-level-queries\term-query.js E:\Projects\repos\elastic-builder\src\queries\term-level-queries\regexp-query.js E:\Projects\repos\elastic-builder\src\queries\term-level-queries\range-query.js E:\Projects\repos\elastic-builder\src\queries\term-level-queries\prefix-query.js E:\Projects\repos\elastic-builder\src\queries\term-level-queries\ids-query.js E:\Projects\repos\elastic-builder\src\queries\term-level-queries\fuzzy-query.js E:\Projects\repos\elastic-builder\src\queries\term-level-queries\exists-query.js E:\Projects\repos\elastic-builder\src\queries\specialized-queries\script-query.js E:\Projects\repos\elastic-builder\src\queries\specialized-queries\percolate-query.js E:\Projects\repos\elastic-builder\src\queries\specialized-queries\more-like-this-query.js E:\Projects\repos\elastic-builder\src\queries\span-queries\span-within-query.js E:\Projects\repos\elastic-builder\src\queries\span-queries\span-term-query.js E:\Projects\repos\elastic-builder\src\queries\span-queries\span-or-query.js E:\Projects\repos\elastic-builder\src\queries\span-queries\span-not-query.js E:\Projects\repos\elastic-builder\src\queries\span-queries\span-near-query.js E:\Projects\repos\elastic-builder\src\queries\span-queries\span-multi-term-query.js E:\Projects\repos\elastic-builder\src\queries\span-queries\span-little-big-base.js E:\Projects\repos\elastic-builder\src\queries\span-queries\span-first-query.js E:\Projects\repos\elastic-builder\src\queries\span-queries\span-field-masing-query.js E:\Projects\repos\elastic-builder\src\queries\span-queries\span-containing-query.js E:\Projects\repos\elastic-builder\src\queries\match-none-query.js E:\Projects\repos\elastic-builder\src\queries\match-all-query.js E:\Projects\repos\elastic-builder\src\queries\joining-queries\parent-id-query.js E:\Projects\repos\elastic-builder\src\queries\joining-queries\nested-query.js E:\Projects\repos\elastic-builder\src\queries\joining-queries\joining-query-base.js E:\Projects\repos\elastic-builder\src\queries\joining-queries\has-parent-query.js E:\Projects\repos\elastic-builder\src\queries\joining-queries\has-child-query.js E:\Projects\repos\elastic-builder\src\queries\geo-queries\geo-shape-query.js E:\Projects\repos\elastic-builder\src\queries\geo-queries\geo-query-base.js E:\Projects\repos\elastic-builder\src\queries\geo-queries\geo-polygon-query.js E:\Projects\repos\elastic-builder\src\queries\geo-queries\geo-distance-query.js E:\Projects\repos\elastic-builder\src\queries\geo-queries\geo-bounding-box-query.js E:\Projects\repos\elastic-builder\src\queries\full-text-queries\simple-query-string-query.js E:\Projects\repos\elastic-builder\src\queries\full-text-queries\query-string-query.js E:\Projects\repos\elastic-builder\src\queries\full-text-queries\query-string-query-base.js E:\Projects\repos\elastic-builder\src\queries\full-text-queries\multi-match-query.js E:\Projects\repos\elastic-builder\src\queries\full-text-queries\mono-field-query-base.js E:\Projects\repos\elastic-builder\src\queries\full-text-queries\match-query.js E:\Projects\repos\elastic-builder\src\queries\full-text-queries\match-phrase-query.js E:\Projects\repos\elastic-builder\src\queries\full-text-queries\match-phrase-query-base.js E:\Projects\repos\elastic-builder\src\queries\full-text-queries\match-phrase-prefix-query.js E:\Projects\repos\elastic-builder\src\queries\full-text-queries\common-terms-query.js E:\Projects\repos\elastic-builder\src\queries\compound-queries\score-functions\script-score-function.js E:\Projects\repos\elastic-builder\src\queries\compound-queries\score-functions\score-function.js E:\Projects\repos\elastic-builder\src\queries\compound-queries\score-functions\random-score-function.js E:\Projects\repos\elastic-builder\src\queries\compound-queries\score-functions\field-value-factor-function.js E:\Projects\repos\elastic-builder\src\queries\compound-queries\score-functions\decay-score-function.js E:\Projects\repos\elastic-builder\src\queries\compound-queries\function-score-query.js E:\Projects\repos\elastic-builder\src\queries\compound-queries\dis-max-query.js E:\Projects\repos\elastic-builder\src\queries\compound-queries\constant-score-query.js E:\Projects\repos\elastic-builder\src\queries\compound-queries\boosting-query.js E:\Projects\repos\elastic-builder\src\queries\compound-queries\bool-query.js E:\Projects\repos\elastic-builder\src\index.js E:\Projects\repos\elastic-builder\src\core\util.js E:\Projects\repos\elastic-builder\src\core\sort.js E:\Projects\repos\elastic-builder\src\core\script.js E:\Projects\repos\elastic-builder\src\core\rescore.js E:\Projects\repos\elastic-builder\src\core\request-body-search.js E:\Projects\repos\elastic-builder\src\core\query.js E:\Projects\repos\elastic-builder\src\core\inner-hits.js E:\Projects\repos\elastic-builder\src\core\indexed-shape.js E:\Projects\repos\elastic-builder\src\core\highlight.js E:\Projects\repos\elastic-builder\src\core\geo-shape.js E:\Projects\repos\elastic-builder\src\core\geo-point.js E:\Projects\repos\elastic-builder\src\core\consts.js E:\Projects\repos\elastic-builder\src\core\aggregation.js E:\Projects\repos\elastic-builder\src\aggregations\pipeline-aggregations\sum-bucket-aggregation.js E:\Projects\repos\elastic-builder\src\aggregations\pipeline-aggregations\stats-bucket-aggregation.js E:\Projects\repos\elastic-builder\src\aggregations\pipeline-aggregations\serial-differencing-aggregation.js E:\Projects\repos\elastic-builder\src\aggregations\pipeline-aggregations\pipeline-aggregation-base.js E:\Projects\repos\elastic-builder\src\aggregations\pipeline-aggregations\percentiles-bucket-aggregation.js E:\Projects\repos\elastic-builder\src\aggregations\pipeline-aggregations\moving-average-aggregation.js E:\Projects\repos\elastic-builder\src\aggregations\pipeline-aggregations\min-bucket-aggregation.js E:\Projects\repos\elastic-builder\src\aggregations\pipeline-aggregations\max-bucket-aggregation.js E:\Projects\repos\elastic-builder\src\aggregations\pipeline-aggregations\extended-stats-bucket-aggregation.js E:\Projects\repos\elastic-builder\src\aggregations\pipeline-aggregations\derivative-aggregation.js E:\Projects\repos\elastic-builder\src\aggregations\pipeline-aggregations\cumulative-sum-aggregation.js E:\Projects\repos\elastic-builder\src\aggregations\pipeline-aggregations\bucket-selector-aggregation.js E:\Projects\repos\elastic-builder\src\aggregations\pipeline-aggregations\bucket-script-aggregation.js E:\Projects\repos\elastic-builder\src\aggregations\pipeline-aggregations\avg-bucket-aggregation.js E:\Projects\repos\elastic-builder\src\aggregations\metrics-aggregations\value-count-aggregation.js E:\Projects\repos\elastic-builder\src\aggregations\metrics-aggregations\top-hits-aggregation.js E:\Projects\repos\elastic-builder\src\aggregations\metrics-aggregations\sum-aggregation.js E:\Projects\repos\elastic-builder\src\aggregations\metrics-aggregations\stats-aggregation.js E:\Projects\repos\elastic-builder\src\aggregations\metrics-aggregations\scripted-metric-aggregation.js E:\Projects\repos\elastic-builder\src\aggregations\metrics-aggregations\percentiles-aggregation.js E:\Projects\repos\elastic-builder\src\aggregations\metrics-aggregations\percentile-ranks-aggregation.js E:\Projects\repos\elastic-builder\src\aggregations\metrics-aggregations\min-aggregation.js E:\Projects\repos\elastic-builder\src\aggregations\metrics-aggregations\metrics-aggregation-base.js E:\Projects\repos\elastic-builder\src\aggregations\metrics-aggregations\max-aggregation.js E:\Projects\repos\elastic-builder\src\aggregations\metrics-aggregations\geo-centroid-aggregation.js E:\Projects\repos\elastic-builder\src\aggregations\metrics-aggregations\geo-bounds-aggregation.js E:\Projects\repos\elastic-builder\src\aggregations\metrics-aggregations\extended-stats-aggregation.js E:\Projects\repos\elastic-builder\src\aggregations\metrics-aggregations\cardinality-aggregation.js E:\Projects\repos\elastic-builder\src\aggregations\metrics-aggregations\avg-aggregation.js E:\Projects\repos\elastic-builder\src\aggregations\matrix-aggregations\matrix-stats-aggregation.js E:\Projects\repos\elastic-builder\src\aggregations\bucket-aggregations\terms-aggregation.js E:\Projects\repos\elastic-builder\src\aggregations\bucket-aggregations\terms-aggregation-base.js E:\Projects\repos\elastic-builder\src\aggregations\bucket-aggregations\significant-terms-aggregation.js E:\Projects\repos\elastic-builder\src\aggregations\bucket-aggregations\sampler-aggregation.js E:\Projects\repos\elastic-builder\src\aggregations\bucket-aggregations\reverse-nested-aggregation.js E:\Projects\repos\elastic-builder\src\aggregations\bucket-aggregations\range-aggregation.js E:\Projects\repos\elastic-builder\src\aggregations\bucket-aggregations\range-aggregation-base.js E:\Projects\repos\elastic-builder\src\aggregations\bucket-aggregations\nested-aggregation.js E:\Projects\repos\elastic-builder\src\aggregations\bucket-aggregations\missing-aggregation.js E:\Projects\repos\elastic-builder\src\aggregations\bucket-aggregations\ip-range-aggregation.js E:\Projects\repos\elastic-builder\src\aggregations\bucket-aggregations\histogram-aggregation.js E:\Projects\repos\elastic-builder\src\aggregations\bucket-aggregations\histogram-aggregation-base.js E:\Projects\repos\elastic-builder\src\aggregations\bucket-aggregations\global-aggregation.js E:\Projects\repos\elastic-builder\src\aggregations\bucket-aggregations\geo-hash-grid-aggregation.js E:\Projects\repos\elastic-builder\src\aggregations\bucket-aggregations\geo-distance-aggregation.js E:\Projects\repos\elastic-builder\src\aggregations\bucket-aggregations\filters-aggregation.js E:\Projects\repos\elastic-builder\src\aggregations\bucket-aggregations\filter-aggregation.js E:\Projects\repos\elastic-builder\src\aggregations\bucket-aggregations\diversified-sampler-aggregation.js E:\Projects\repos\elastic-builder\src\aggregations\bucket-aggregations\date-range-aggregation.js E:\Projects\repos\elastic-builder\src\aggregations\bucket-aggregations\date-histogram-aggregation.js E:\Projects\repos\elastic-builder\src\aggregations\bucket-aggregations\children-aggregation.js E:\Projects\repos\elastic-builder\src\aggregations\bucket-aggregations\bucket-aggregation-base.js
The command line is too long.

    at Promise.all.then.arr (E:\Projects\repos\elastic-builder\node_modules\execa\index.js:210:11)
    at process._tickCallback (internal/process/next_tick.js:103:7)
  code: 1,
  killed: false,
  stdout: '',
  stderr: 'The command line is too long.\r\n',
  failed: true,
  signal: null,
  cmd: 'E:\\Projects\\repos\\elastic-builder\\node_modules\\.bin\\eslint.CMD --fix -- E:\\Projects\\repos\\elastic-builder\\src\\queries\\term-level-queries\\wildcard-query.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\term-level-queries\\value-term-query-base.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\term-level-queries\\type-query.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\term-level-queries\\terms-query.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\term-level-queries\\term-query.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\term-level-queries\\regexp-query.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\term-level-queries\\range-query.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\term-level-queries\\prefix-query.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\term-level-queries\\ids-query.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\term-level-queries\\fuzzy-query.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\term-level-queries\\exists-query.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\specialized-queries\\script-query.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\specialized-queries\\percolate-query.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\specialized-queries\\more-like-this-query.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\span-queries\\span-within-query.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\span-queries\\span-term-query.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\span-queries\\span-or-query.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\span-queries\\span-not-query.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\span-queries\\span-near-query.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\span-queries\\span-multi-term-query.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\span-queries\\span-little-big-base.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\span-queries\\span-first-query.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\span-queries\\span-field-masing-query.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\span-queries\\span-containing-query.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\match-none-query.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\match-all-query.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\joining-queries\\parent-id-query.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\joining-queries\\nested-query.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\joining-queries\\joining-query-base.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\joining-queries\\has-parent-query.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\joining-queries\\has-child-query.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\geo-queries\\geo-shape-query.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\geo-queries\\geo-query-base.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\geo-queries\\geo-polygon-query.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\geo-queries\\geo-distance-query.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\geo-queries\\geo-bounding-box-query.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\full-text-queries\\simple-query-string-query.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\full-text-queries\\query-string-query.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\full-text-queries\\query-string-query-base.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\full-text-queries\\multi-match-query.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\full-text-queries\\mono-field-query-base.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\full-text-queries\\match-query.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\full-text-queries\\match-phrase-query.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\full-text-queries\\match-phrase-query-base.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\full-text-queries\\match-phrase-prefix-query.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\full-text-queries\\common-terms-query.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\compound-queries\\score-functions\\script-score-function.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\compound-queries\\score-functions\\score-function.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\compound-queries\\score-functions\\random-score-function.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\compound-queries\\score-functions\\field-value-factor-function.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\compound-queries\\score-functions\\decay-score-function.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\compound-queries\\function-score-query.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\compound-queries\\dis-max-query.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\compound-queries\\constant-score-query.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\compound-queries\\boosting-query.js E:\\Projects\\repos\\elastic-builder\\src\\queries\\compound-queries\\bool-query.js E:\\Projects\\repos\\elastic-builder\\src\\index.js E:\\Projects\\repos\\elastic-builder\\src\\core\\util.js E:\\Projects\\repos\\elastic-builder\\src\\core\\sort.js E:\\Projects\\repos\\elastic-builder\\src\\core\\script.js E:\\Projects\\repos\\elastic-builder\\src\\core\\rescore.js E:\\Projects\\repos\\elastic-builder\\src\\core\\request-body-search.js E:\\Projects\\repos\\elastic-builder\\src\\core\\query.js E:\\Projects\\repos\\elastic-builder\\src\\core\\inner-hits.js E:\\Projects\\repos\\elastic-builder\\src\\core\\indexed-shape.js E:\\Projects\\repos\\elastic-builder\\src\\core\\highlight.js E:\\Projects\\repos\\elastic-builder\\src\\core\\geo-shape.js E:\\Projects\\repos\\elastic-builder\\src\\core\\geo-point.js E:\\Projects\\repos\\elastic-builder\\src\\core\\consts.js E:\\Projects\\repos\\elastic-builder\\src\\core\\aggregation.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\pipeline-aggregations\\sum-bucket-aggregation.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\pipeline-aggregations\\stats-bucket-aggregation.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\pipeline-aggregations\\serial-differencing-aggregation.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\pipeline-aggregations\\pipeline-aggregation-base.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\pipeline-aggregations\\percentiles-bucket-aggregation.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\pipeline-aggregations\\moving-average-aggregation.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\pipeline-aggregations\\min-bucket-aggregation.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\pipeline-aggregations\\max-bucket-aggregation.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\pipeline-aggregations\\extended-stats-bucket-aggregation.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\pipeline-aggregations\\derivative-aggregation.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\pipeline-aggregations\\cumulative-sum-aggregation.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\pipeline-aggregations\\bucket-selector-aggregation.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\pipeline-aggregations\\bucket-script-aggregation.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\pipeline-aggregations\\avg-bucket-aggregation.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\metrics-aggregations\\value-count-aggregation.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\metrics-aggregations\\top-hits-aggregation.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\metrics-aggregations\\sum-aggregation.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\metrics-aggregations\\stats-aggregation.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\metrics-aggregations\\scripted-metric-aggregation.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\metrics-aggregations\\percentiles-aggregation.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\metrics-aggregations\\percentile-ranks-aggregation.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\metrics-aggregations\\min-aggregation.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\metrics-aggregations\\metrics-aggregation-base.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\metrics-aggregations\\max-aggregation.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\metrics-aggregations\\geo-centroid-aggregation.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\metrics-aggregations\\geo-bounds-aggregation.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\metrics-aggregations\\extended-stats-aggregation.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\metrics-aggregations\\cardinality-aggregation.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\metrics-aggregations\\avg-aggregation.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\matrix-aggregations\\matrix-stats-aggregation.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\bucket-aggregations\\terms-aggregation.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\bucket-aggregations\\terms-aggregation-base.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\bucket-aggregations\\significant-terms-aggregation.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\bucket-aggregations\\sampler-aggregation.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\bucket-aggregations\\reverse-nested-aggregation.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\bucket-aggregations\\range-aggregation.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\bucket-aggregations\\range-aggregation-base.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\bucket-aggregations\\nested-aggregation.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\bucket-aggregations\\missing-aggregation.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\bucket-aggregations\\ip-range-aggregation.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\bucket-aggregations\\histogram-aggregation.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\bucket-aggregations\\histogram-aggregation-base.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\bucket-aggregations\\global-aggregation.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\bucket-aggregations\\geo-hash-grid-aggregation.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\bucket-aggregations\\geo-distance-aggregation.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\bucket-aggregations\\filters-aggregation.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\bucket-aggregations\\filter-aggregation.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\bucket-aggregations\\diversified-sampler-aggregation.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\bucket-aggregations\\date-range-aggregation.js E:\\Projects\\repos\\elastic-builder\\src\\aggregation� eslint --fix found some errors. Please fix them and try committing again.
s\\bucket-aggregations\\date-histogram-aggregation.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\bucket-aggregations\\children-aggregation.js E:\\Projects\\repos\\elastic-builder\\src\\aggregations\\bucket-aggregations\\bucket-aggregation-base.js',
The command line is too long.
  timedOut: false }

released released on @beta

Most helpful comment

Thanks for the logs, @gaborluk! I think you hit a case where the chunks' length was so close to the max arg length that when combined with your actual command, the resulting string was too long. I improved debug logging and halved the maxArgLength so that in your case it now creates four instead of two chunks. Let me know if it helps!

EDIT: This is in v10.0.0-beta.5

All 36 comments

Good one! I think you could solve it by hacking windows. I don't think I can offer a solution. You should probably skip the pre-commit hook for this one. If you find a better solution please let me know.

I did skip it for that one. However, might be worthwhile to fix it though. Would it be possible to split up the task and spawn multiple child processes if the number of files exceeds a certain limit?

Feel free to create a PR and we can discuss it. I'm open for any improvements.

This is what I am thinking. In findBin.js, instead of returning an object, I could return an array of objects which would have chunks of paths created using lodash.chunk. These tasks could be run in parallel in runScript.js and Promise.all would resolve with ✅ ${ linter } passed! or the error message.

Few questions:

  1. Splitting up the task and running it in parallel should be a win right? Although non-windows systems probably won't have the command length issue, they can still benefit from parallelism right? Or is there something that will break when we do this? Tests will probably provide a good safety net.
  2. What should be the size of the chunk? I was thinking 42 - the answer to everything. However this is not bullet proof. Another method would be to calculate the chunk sizes based on actual string length to keep under some limit. For windows systems, it _should_ be 8191
  3. Can we reliably use Promise.all in all node envs? travis will probably asnwer this question definitively.
  4. If we are spawning tasks, how do we control concurrency? I usually use bluebird map for this but adding bluebird as a dependency might be overkill?
  1. Yes, I think it's worth exploring. I think it might be a conflict with concurrent option: https://github.com/okonet/lint-staged/blob/master/src/index.js#L33. See https://github.com/okonet/lint-staged#options But I think we could drop it.
  2. I don't think 42 is a good number here and it should be based on performance/OS limitations. So this max length windows limitation is a good baseline for me. We could even try running tasks in parallel for each file and see if this is faster. But I don't think so.
  3. Don't know please look up for yourself. I believe so.
  4. Listr support that AFAIK so no need in bluebird.

@okonet I am facing issue with execa mocking while I am trying to modify the code. Should I make a pull request with tests failing?

EDIT: I was able to successfully run lint-staged on 147 files with my local copy of lint-staged(using npm link)

Create a PR and let's discuss there.

Uhh, this seems to have been removed again?

Afaik we have a different check now.

The current functionality is to check the length of the string containing all staged filenames, and print a warning: https://github.com/okonet/lint-staged/blob/403f80b74468dd5682f27bfbeabdd779d492f0e8/src/runAll.js#L61

Now that I look at it, it might be inaccurate as the that file list is relative to the git root, but by default the paths are resolved as absolute. It would be better to move this check a bit further in the code.

A function linter can be implemented with custom logic to circumvent too long commands: https://github.com/okonet/lint-staged#example-run-eslint-on-entire-repo-if-more-than-10-staged-files

Yeah I saw that one after I posted it, but I don't really think it's ideal, I feel like it would be more user friendly for lint-staged to handle this as it did before

Had this commit with 288 files

Didn't see a warning, only thing I saw after running it 5 times (didn't notice it before that) is the message in the last line (after 2 newlines) "The command line is too long."

Just got bit by this one as well. Large commit with 200+ changes on Windows. Never had this happen before, when was this change made?

The previous behavior was problematic for functional linter configurations. The change was introduced in v9.0.0.

I supposed it would be possible to chunk the file list and create multiple runs from the function linters as well, but it would be take some refactoring.

PR is welcome, otherwise I can fix this when I have the time. Since I don’t use Windows, a repo reproducing a fail would be convenient.

I think chunking which we had before introduces a lot of complexity to the code base and it was quite hard to maintain because of that. I'd say, since committing big amount of files usually happens after a merge, there is no need to run lint-staged on it usually and users can just skip doing so. We could improve warning message and print better instructions, though.

There are plenty of situations where one might accidentally hit the command line length limit on non-trivial projects, so having builds fail, identify the failure as part of the staged linter, and then having to circumvent it for larger commits is simply not a viable option for us on a growing team of developers.

Our use case is that we're running eslint with airbnb, prettier, and a few custom rules. I reverted to 8.2.1 and the commit was handled fine. I would think that this is one of the most common usage scenarios for lint-staged but I could be wrong.

I am willing to make a PR that ”reverts” this behaviour and goes back to chunking. Since now we generate a list of task from a large array of files, we could instead split the array into chunks and generate tasks for all the chunks. This is, as I can see, the only way to support both the function linters and chunking. For listr instead of the ”running tasks...” step we could show multiple ”running tasks (chunk 1)...”.

What do you think, @okonet?

Having the same issue here. It does not take a lot of files to hit that windows cmd length limit. It has become a nuisance for our developers. Will revert back to 8.2.1 for now.

My team just hit this as well, after only enabling lint-staged for 3 days. It's taken quite a while to track it through various levels and repos to finally find the issue here.

Since this issue is closed, should we open a new issue?

I added this ”back” to the v10 milestone. Testing anything Windows-specific is a bit of a chore, but I’ll manage with Appveyor.

One specific thing I’d like to know though: is this also an issue with WSL, or only on native Windows shells?

It was an issue with Cygwin Bash and PowerShell (😬). We resolved it for now by using 8.2.1.

We are using git-bash that came with https://conemu.github.io/
Screenshot_1

:tada: This issue has been resolved in version 10.0.0-beta.4 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

Maybe someone could find the time to test a commit with a large number of staged files on Windows using 10.0.0-beta.4? I think I implemented a nice chunking to it, but since I don't have an actual Windows environment set up, I can't tell for sure.

Yup, seems to have worked fine

Also yes, ran into this problem today, tested the beta and everything worked great.

I confirm that 10.0.0-beta.4 works fine on Windows with a large monorepo and a big staged files list.

Thanks a lot testing! I think v10 is soon ready to merge, but I’m a bit busy myself until next week.

@iiroj, I'm afraid the issue may still persist, unless I'm messing something up majorly. Trying to commit 180 files at once, I get this even after updating to 10.0.0-beta.4:

√ Preparing...
  > Running tasks (chunk 0/2)...
    > Running tasks for *.{js,jsx}
      × eslint
        cross-env CI=true jest --bail --findRelatedTests
  √ Running tasks (chunk 1/2)...
  ↓ Applying modifications... [skipped]
    → Skipped because of errors from tasks
  √ Reverting to original state...
  √ Cleaning up...

× eslint found some errors. Please fix them and try committing again.

The command line is too long.

Is there anything more useful I can give you for looking into this?

@gaborluk Please post your config, and debug logs by running with lint-staged --debug. Note that the logs might contain absolute file paths.

@iiroj, here's the relevant part of package.json:

"lint-staged": {
  "*.{js,jsx}": [
    "eslint",
    "cross-env CI=true jest --bail --findRelatedTests"
  ]
},
"husky": {
  "hooks": {
    "pre-commit": "lint-staged"
  }
},
...
"devDependencies": {
  ...
  "babel-eslint": "^10.0.3",
  "cross-env": "^6.0.3",
  "cypress": "^3.4.1",
  "eslint": "^6.7.1",
  "eslint-config-standard": "^14.1.0",
  "eslint-config-standard-react": "^9.2.0",
  "eslint-plugin-import": "^2.18.2",
  "eslint-plugin-node": "^10.0.0",
  "eslint-plugin-promise": "^4.2.1",
  "eslint-plugin-react": "^7.14.3",
  "eslint-plugin-react-hooks": "^2.0.1",
  "eslint-plugin-standard": "^4.0.1",
  "husky": "^3.0.8",
  "jest": "^24.9.0",
  "lint-staged": "^10.0.0-beta.4",
  ...
}

And this is .eslintrc.json:

{
  "env": {
    "browser": true,
    "es6": true
  },
  "extends": [
    "standard",
    "standard-react"
  ],
  "globals": {
    "Atomics": "readonly",
    "SharedArrayBuffer": "readonly"
  },
  "ignorePatterns": [
    "cypress/support",
    "dist",
    "node_modules"
  ],
  "overrides": [
    {
      "files": [
        "*.spec.js",
        "*.spec.jsx",
        "*.test.js",
        "*.test.jsx"
      ],
      "env": {
        "jest": true
      },
      "globals": {
        "Cypress": "readonly",
        "cy": "readonly"
      }
    }
  ],
  "parser": "babel-eslint",
  "parserOptions": {
    "ecmaFeatures": {
      "jsx": true
    },
    "ecmaVersion": 2018,
    "sourceType": "module"
  },
  "plugins": [
    "react",
    "react-hooks"
  ],
  "rules": {
    "react/no-did-mount-set-state": "off",
    "react/no-did-update-set-state": "off",
    "react-hooks/rules-of-hooks": "error",
    "react-hooks/exhaustive-deps": "warn"
  }
}

I sent you the debug log via email, hope that's alright. Let me know if you need anything else.

Thanks for the logs, @gaborluk! I think you hit a case where the chunks' length was so close to the max arg length that when combined with your actual command, the resulting string was too long. I improved debug logging and halved the maxArgLength so that in your case it now creates four instead of two chunks. Let me know if it helps!

EDIT: This is in v10.0.0-beta.5

Works like a charm now, @iiroj, thanks a lot for the quick turnaround. Much appreciated.

Cool. I will leave this open until v10 releases.

:tada: This issue has been resolved in version 10.0.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

v10.0.0 has been released so this should be closed from the milestone.

Was this page helpful?
0 / 5 - 0 ratings