Skip to content

Commit

Permalink
Fix lint-staged error when edited multiple files
Browse files Browse the repository at this point in the history
  • Loading branch information
nix6839 committed Jan 11, 2024
1 parent ef1c3ef commit 502deeb
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 14 deletions.
23 changes: 23 additions & 0 deletions lint-staged.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* @param {string[]} filenames
* @returns {string}
*/
const filenamesToAjvOption = (filenames) => filenames.map((filename) => `-d ${filename}`).join(' ');

/** @satisfies {import('lint-staged').Config} */
const config = {
'icons/*.svg': [
'node ./scripts/optimizeStagedSvgs.mjs',
'node ./scripts/generateNextJSAliases.mjs',
],
'icons/*.json': (filenames) => [
`ajv --spec=draft2020 -s icon.schema.json ${filenamesToAjvOption(filenames)}`,
`prettier --write ${filenames.join(' ')}`,
],
'categories/*.json': (filenames) => [
`ajv --spec=draft2020 -s category.schema.json ${filenamesToAjvOption(filenames)}`,
`prettier --write ${filenames.join(' ')}`,
],
};

export default config;
14 changes: 0 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,20 +64,6 @@
"svgo": "^3.1.0",
"svgson": "^5.3.1"
},
"lint-staged": {
"icons/*.svg": [
"node ./scripts/optimizeStagedSvgs.mjs",
"node ./scripts/generateNextJSAliases.mjs"
],
"icons/*.json": [
"ajv --spec=draft2020 -s icon.schema.json -d",
"prettier --write"
],
"categories/*.json": [
"ajv --spec=draft2020 -s category.schema.json -d",
"prettier --write"
]
},
"packageManager": "[email protected]",
"pnpm": {
"peerDependencyRules": {
Expand Down

0 comments on commit 502deeb

Please sign in to comment.