Trigger a linter once without passing files?
See original GitHub issueHello, and thanks for a great project!
I’d like to use lint-staged to run the flow
typechecker if a commit would contain .js files. flow
does not expect to be passed individual files, and does not need to run once per file; instead, no matter how many .js files are in the commit, flow
only needs to run once.
I saw #174 - the reason I would like to use lint-staged is because I have other linters (stylelint, eslint) that should also run. Currently, I’m getting this to work with the following config:
{
"scripts": {
"precommit": "lint-staged && flow"
},
"lint-staged": {
"*.css": "stylelint",
"*.scss": "stylelint --syntax=scss",
"*.js": "eslint"
}
}
but this makes flow run after all linters, instead of potentially letting it run in parallel. It also feels cleaner to have “precommit” just be “lint-staged”, instead of a shell-chained list of commands.
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Command Line Interface
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >lint-staged: Lint Your Staged Files | Karuppiah's Blog
lint -staged will take care of passing the file path of the staged files as it's the one that knows which files are...
Read more >lint-staged
Linter commands work on a subset of all staged files, defined by a glob pattern. lint-staged uses micromatch for matching files with the ......
Read more >Configuration
Linter (s) to run when a triggered file is modified. Targets(s) to pass to the linters (can be files or directories). An example...
Read more >A Complete Guide to Linting Go Programs - freshman.tech
You can also choose which directories and files to analyse by passing one or more directories or paths to files. $ golangci-lint run...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
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
BTW when #138 is done it should be possible to run commands without arguments.
For people landing here, this is now possible with functions as linter commands: https://github.com/okonet/lint-staged#using-js-functions-to-customize-linter-commands