diff --git a/.lintstagedrc.js b/.lintstagedrc.js index 8341bdc..8866ba6 100644 --- a/.lintstagedrc.js +++ b/.lintstagedrc.js @@ -1,6 +1,9 @@ +const toRelative = require('./src/utils/relativePath.js'); + module.exports = { '*': 'prettier --check --ignore-unknown', '*.js': 'eslint --cache', '*.{js,ts}': () => 'npm run typescript:check', - '*.{js,ts}': () => 'npm run cspell', -}; + '*': (files) => + `cspell --show-suggestions --quiet --gitignore ${toRelative(files)}`, +}; \ No newline at end of file diff --git a/src/utils/relativePath.js b/src/utils/relativePath.js new file mode 100644 index 0000000..e86cdaa --- /dev/null +++ b/src/utils/relativePath.js @@ -0,0 +1,7 @@ +const path = require('node:path'); + +const toRelative = (files) => + files.map((file) => path.relative(process.cwd(), file)).join(' '); + + +module.exports = toRelative; \ No newline at end of file