You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe my config should work. According to the documentation, I should be able to have an array of functions assigned to a matcher e.g. '*.{ts,tsx,cjs,js}'. It seems the current lint-staged types don't allow this.
lint-staged.config.js
importpathfrom"path";/** @type {import("lint-staged").ConfigFn} */functionlint(filenames){if(filenames.length>10)return'next lint --fix';return`next lint --fix --file ${filenames.map((f)=>path.relative(process.cwd(),f)).join(' --file ')}`;}/** @type {import("lint-staged").ConfigFn} */functionprettier(filenames){if(filenames.length>10)return'prettier --write';return`prettier --write ${filenames.map((f)=>path.relative(process.cwd(),f)).join(' ')}`;}/** @type {import("lint-staged").Config} */constconfig={'*.{ts,tsx,cjs,js}': [lint],// Type '(filenames: string[]) => Commands | Promise<Commands>' is not assignable to type 'string'// '*.{ts,tsx,cjs,js}': lint // This works};exportdefaultconfig;
Description
I believe my config should work. According to the documentation, I should be able to have an array of functions assigned to a matcher e.g.
'*.{ts,tsx,cjs,js}'
. It seems the currentlint-staged
types don't allow this.lint-staged.config.js
index.d.ts
As shown, this only allows a string, an array of strings or a single function in
{ [key: string]: Commands | ConfigFn }
.I think this could easily fixed by changing
to
Steps to reproduce
bun add --dev lint-staged @types/lint-staged
lint-staged.config.js
Environment
v18.18.0
lint-staged
:^15.2.0
@types/lint-staged
:^13.2.2
The text was updated successfully, but these errors were encountered: