add option to stop passing paths to the linters
See original GitHub issueDescription
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:
- Created 6 years ago
- Reactions:14
- Comments:6 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We support function syntax for exactly this: https://github.com/okonet/lint-staged#example-run-tsc-on-changes-to-typescript-files-but-do-not-pass-any-filename-arguments
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 onprecommit
without lint-staged, or remove-p
option.