opengovsg/mockpass

Pre-push hook is failing

Closed this issue · 1 comments

Describe the bug
Attempting to push current main branch results in the pre-push hook failing

% git push origin main
/Users/cflee/projects/mockpass/node_modules/ts-node/dist/index.js:851
            return old(m, filename);
                   ^
Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/cflee/projects/mockpass/node_modules/@commitlint/config-conventional/lib/index.js from /Users/cflee/projects/mockpass/node_modules/@commitlint/resolve-extends/lib/index.js not supported.
Instead change the require of /Users/cflee/projects/mockpass/node_modules/@commitlint/config-conventional/lib/index.js in /Users/cflee/projects/mockpass/node_modules/@commitlint/resolve-extends/lib/index.js to a dynamic import() which is available in all CommonJS modules.
    at require.extensions.<computed> [as .js] (/Users/cflee/projects/mockpass/node_modules/ts-node/dist/index.js:851:20)
    at /Users/cflee/projects/mockpass/node_modules/@commitlint/resolve-extends/lib/index.js:48:19
    at Array.reduce (<anonymous>)
    at loadExtends (/Users/cflee/projects/mockpass/node_modules/@commitlint/resolve-extends/lib/index.js:45:16)
    at resolveExtends (/Users/cflee/projects/mockpass/node_modules/@commitlint/resolve-extends/lib/index.js:25:22)
    at load (/Users/cflee/projects/mockpass/node_modules/@commitlint/load/lib/load.js:42:52)
    at async main (/Users/cflee/projects/mockpass/node_modules/@commitlint/cli/lib/cli.js:194:20) {
  code: 'ERR_REQUIRE_ESM'
}
husky - pre-push script failed (code 1)
error: failed to push some refs to 'github.com:cflee/mockpass.git'

Bisected that it can be reproduced with v4.1.1, and does not reproduce with v4.1.0 and earlier, so this arises from something in #625

To Reproduce
Steps to reproduce the behavior:

  1. Check out current main branch, or v4.1.1 tag
  2. Try to git push. Or, run .husky/pre-push script

Fixed in #639