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.

add option to stop passing paths to the linters

See original GitHub issue

Description

We want to do a full TypeScript type check of the project before any .tsx? files is committed, typically we use tsc -p . --noEmit.

However if we integrate this command into lint-staged like this:

{
  "lint-staged": {
     "*.{ts,tsx}": "tsc -p . --noEmit"
  }
}

we got an error from tsc:

git commit
husky > npm run -s precommit (node v8.9.4)

 ❯ Running tasks for *.{ts,tsx}
   ✖ tsc -p . --noEmit
     → error TS5042: Option 'project' cannot be mixed with source files on a command line.
✖ tsc -p . --noEmit found some errors. Please fix them and try committing again.
error TS5042: Option 'project' cannot be mixed with source files on a command line.

husky > pre-commit hook failed (add --no-verify to bypass)

Environment

  • OS: macOS High Sierra
  • Node.js: v8.9.4
  • lint-staged: v6.0.0

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:14
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
okonetcommented, Mar 18, 2018

lint-staged adds staged files as argument to your command, so there is a conflict of . and how lint-staged works. This is why you see this error. You should either do -p . and run it on precommit without lint-staged, or remove -p option.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ignoring Code - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
Configuration - golangci-lint
GolangCI-Lint looks for config files in the following paths from the ... You can configure specific linters' options only within the config file...
Read more >
Linter Settings — SublimeLinter 3.4.24 documentation
This setting specifies the linter working directory. The value must be a string, corresponding to a valid directory path. ... With the above...
Read more >
A Complete Guide to Linting Go Programs - freshman.tech
Here's an example that uses command-line options to disable all linters and configure the specific linters that should be run:.
Read more >
Configuration — Molecule Documentation
Unlike the other dependency managers, options are ignored and not passed to shell . Additional flags/subcommands should simply be added to the command...
Read more >

github_iconTop Related Medium Post

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