Comments (5)
I really like it! Do you want to create a PR for that? @iiroj wdyt?
from lint-staged.
Is the functionality essentially the same as creating a separate Node.js script file, and having that be the linter? What benefit is there for defining it directly in the config?
It sounds doable, but is a separate pipeline to the existing thing being based on spawning processes with execa
.
from lint-staged.
To answer myself: one benefit is that file names would be passed directly so there's less need for escaping etc.
from lint-staged.
This might be a good use of node:worker_threads
so that we can run them in parallel and capture console output similar to execa
.
from lint-staged.
Since we execute the current "function config" functions before running actual tasks and also validate the output to be string | string[]
, the only way to handle this in a backwards-compatible way would be to return more functions:
// lint-staged.config.js
export default {
"*.js": (stagedFiles) => {
return () => lintJsFiles(stagedFiles)
}
}
the syntax of the returned functions could be:
type TaskFunction = (stagedMatchedFiles: string[]) => Promise<void>
but since they're returned from inside a config function, one could of course handle the matched filenames in there as well.
what do you think?
from lint-staged.
Related Issues (20)
- Commits from Github Desktop occur errors HOT 4
- Not all lintstagedrc.json files are found in the rush.js monorepo HOT 4
- Type '(filenames: string[]) => Commands | Promise<Commands>' is not assignable to type 'string' HOT 2
- There is a bug with bracketed folders HOT 5
- Importing a reusable json file to ESM JS config fails HOT 1
- Path for baseConfig HOT 2
- lint-staged is unable to resolve path to module in Monorepo with map imports HOT 9
- Many errors in standard output when using git sparse-checkout HOT 4
- `--all` flag HOT 3
- lint-staged repeat many time ,when commit in windows powershell,cmd HOT 2
- [feat] override the current pattern HOT 1
- Make lint-staged more compatible with git sparse checkout feature HOT 6
- How to `git reset $file` ? HOT 3
- How to output the print content of the script in lint-staged in real time?
- `npx lint-staged --cwd $PWD` for all OS HOT 6
- Hooks to know if the lint staged commands have completed HOT 4
- Prettier breaks when run through lint-staged on files with dollar sign ($) in the name HOT 6
- Is it possible to run 2 different configurations for pre-commit and pre-push? HOT 1
- No staged files found. with command "npx lint-staged"
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lint-staged.