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)
- Hard to understand stashing behavior HOT 2
- Case sensitivity in finding .git root folder HOT 3
- firebase emulator is not running by lint-staged HOT 8
- SyntaxError: Named export 'getStreamAsBuffer' not found HOT 2
- "No files matching the pattern ... was found" when using ESLint flat configuration file format HOT 2
- No staged files found HOT 2
- Script fails when using grouped layouts in Next.js HOT 5
- lint-staged does not detect changed files, skips scripts HOT 4
- High vulnerability in 'braces' dependency HOT 3
- Add flag to simplify testing `lint-staged` integration HOT 2
- Silent failure of configuration loading HOT 2
- 'lint-staged' will not restore changes if there's an error or the script is halted HOT 4
- Monorepo and different `.lintstagedrc.json` configuration files HOT 2
- WSL incorrect resolveGitRepo: Current directory is not a git directory HOT 5
- Issue: Targeted files skip tsconfig HOT 1
- Failing to get staged files on 15.2.6 HOT 11
- Version 12+ results in exit code 1 instead of working HOT 2
- Fail to find git dir with git "rev-parse" HOT 1
- The 'File Ignored' warning is still a big problem
- 'Integrate with Next.js' not working properly without '--dir' in monorepo.
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.