usmanyunusov / nano-staged

Tiny tool to run commands for modified, staged, and committed files in a GIT repository.
https://npm.im/nano-staged
MIT License
416 stars 12 forks source link

Invalid config on lambda #39

Open ai opened 1 year ago

ai commented 1 year ago

Describe the bug

module.exports = {
  '*.{ts,tsx}': [
    'pnpm prettier --write',
    () => 'pnpm tsc -p tsconfig.json',
    'pnpm eslint --fix'
  ],
  '*.css': ['pnpm prettier --write', 'pnpm stylelint --fix']
};

Leads to:

./node_modules/.bin/nano-staged --config ./.nano-staged.cjs
× Nano Staged config invalid

Reproduction

mkdir test
cd test
git init
pnpm add .nano-staged.cjs
nano .nano-staged.cjs # copy config from above
pnpm nano-staged -c .nano-staged.cjs

System Info

System:
    OS: Linux 6.2 Fedora Linux 38 (Workstation Edition)
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz
    Memory: 5.24 GB / 15.31 GB
    Container: Yes
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.1.0 - ~/.asdf/installs/nodejs/20.1.0/bin/node
    Yarn: 1.22.19 - ~/.asdf/shims/yarn
    npm: 9.6.4 - ~/.asdf/plugins/nodejs/shims/npm
  Browsers:
    Chrome: 112.0.5615.165
    Firefox: 112.0.2

Used Package Manager

pnpm