question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature: configure maxArgLength from CLI

See original GitHub issue

Description

I’m running tslint in my project. In case of normal commits, all works well but in case of a very large one (merge commit, hundreds of file in staging) tslint task fails. Also my tasks’ list is divided quite strangely (one chunk is around 100 files, another one over 500)

lint-staged:gen-tasks     ... 107 more items
lint-staged:gen-tasks     ... 521 more items

I’m manually changing the maxArgLength in bin/lint-staged.js to a much smaller value (Windows value, 8000). The whole process is divided into 50 chunks and all goes well. Can we add maxArgLength to CLI parameters?

Steps to reproduce

Debug Logs

expand to view
Running tasks (chunk 1/2)... [started]
Running tasks for dgc-ui-core/**/*.{ts,tsx} [started]
npm run lint:fix --prefix dgc-ui-core -- --format verbose [started]
npm run lint:fix --prefix dgc-ui-core -- --format verbose [completed]
Running tasks for dgc-ui-core/**/*.{ts,tsx} [completed]
Running tasks (chunk 1/2)... [completed]
Running tasks (chunk 2/2)... [started]
Running tasks for dgc-ui-core/**/*.{ts,tsx} [started]
npm run lint:fix --prefix dgc-ui-core -- --format verbose [started]
npm run lint:fix --prefix dgc-ui-core -- --format verbose [failed]

Environment

  • OS: macOS Catalinia
  • Node.js: 12
  • lint-staged: 10.0.7

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
chodorowiczcommented, Feb 19, 2020

OK, it works, thanks for help. I will close the issue

const chunkFiles = require('lint-staged/lib/chunkFiles');

// tslint fails for very large lists of files
const MAX_INPUT_LENGTH = 8000;

module.exports = {
  "*.ts": allFiles => {
    const chunkedFiles = chunkFiles({ files: allFiles, maxArgLength: MAX_INPUT_LENGTH, gitDir: "./" });
    return chunkedFiles.map(chunk => `npm run tslint -- ${chunk.join(" ")}`);
  }
}
0reactions
chodorowiczcommented, Feb 17, 2020

Thanks, I will try it out!

Read more comments on GitHub >

github_iconTop Results From Across the Web

get-feature — AWS CLI 1.27.34 Command Reference
The CA certificate bundle to use when verifying SSL certificates. Overrides config/env settings. --cli-read-timeout (int). The maximum socket read time in ...
Read more >
lint-staged: Versions
Full version history for lint-staged including change logs. ... single configuration file (877ab4c). Features. expose --max-arg-length cli option (e8291b0) ...
Read more >
picocli - a mighty tiny command line interface
Kotlin Projects Using Gradle. Kotlin projects should add the kotlin-kapt plugin to enable the Kotlin Annotation processing tool (kapt), then ...
Read more >
Basic functionality
To get a full list of commands available in Ory CLI, run this command: ... -c, --config string Path to the Ory Network...
Read more >
Advanced CLI Features
Provisioning for output files works in the same way and has been tested with S3 output locations. For some file provisioning methods, additional...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found