Allow defining a template for how paths should be passed to the command
See original GitHub issueAt this moment lint-staged will always pass file paths as arguemnts at the end of the string:
npm run-script command -- path/to/staged/file1 path/to/staged/file2
eslint -- path/to/staged/file1 path/to/staged/file2
In order to support exotic cases like #136 and #18 we might want to redefine this. One way of doing this would be to pass a “template” string to how paths should be interpolated. Something like this:
{
"*.jpg": "${ path } | imagemin",
"*.html": "gulp my-task -g ${ paths }",
"*.js": "eslint" // This is the current way of doing "eslint ${ paths }"
}
lint-staged will try to interpolate those strings when running tasks.
- The piping example will require calling
filepath | imagemin
for each path in paths. Not sure how to do that. Different type of token (path
instead ofpaths
?) - Better error handling: since templates may be broken, lint-staged should help users find the mistake
Another use cases: #404
I’m open for a discussion and suggestions on the API of this feature.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:21
- Comments:40 (20 by maintainers)
Top Results From Across the Web
Templates - Azure Pipelines | Microsoft Learn
Templates let you define reusable content, logic, and parameters. ... Template paths should be relative to the file that does the including.
Read more >Development guide for GitLab CI/CD templates
This document explains how to develop GitLab CI/CD templates. Requirements for CI/CD templates. Before submitting a merge request with a new or updated ......
Read more >What is the path that Django uses for locating and loading ...
Your project's TEMPLATES setting describes how Django will load and render templates. The default settings file configures a DjangoTemplates ...
Read more >Use Airflow templates | Astronomer Documentation
Use Airflow templates. Templating allows you to pass dynamic information into task instances at runtime. For example, you can run the following command...
Read more >Templates - Django documentation
DIRS defines a list of directories where the engine should look for template source files, in search order. APP_DIRS tells whether the engine...
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
Small comment here about usecase: being able to do something like:
*.ts: "tsc --noEmit -p tsconfig.json"
would be quite useful to run the Typescript compiler in check mode only if there are staged Typescript files. This is different from running it using Husky, as you only want to check it if you committed TS files, not all the time.
Another important question if implicit syntax
{ "*.js": "eslint" }
should be deprecated in favor of more explicit one i.e.{"*.js": "eslint <paths>" }