Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

commitlint >= 19 breaks the extension #753

Closed
paduszyk opened this issue Feb 29, 2024 · 6 comments · Fixed by #785
Closed

commitlint >= 19 breaks the extension #753

paduszyk opened this issue Feb 29, 2024 · 6 comments · Fixed by #785
Labels
bug Something isn't working

Comments

@paduszyk
Copy link

Hi!

My .commitlintrc.js:

/**
 * Commitlint
 * https://commitlint.js.org/#/reference-configuration
 */

const Configuration = {
  extends: ["@commitlint/config-conventional"],
};

module.exports = Configuration;

Everything went smoothly until I upgraded commitlint to v19 (19.0.3, to be more specific).

Now my output (as I am typing anything into commit message field of the Git panel) is as follows:1

loading @commitlint/parse dynamically via /Users/kamil/GitHub/reactor/node_modules/@commitlint/parse/lib/index.js
Uncaught exception: Error: require() of ES Module /Users/kamil/GitHub/reactor/node_modules/@commitlint/parse/lib/index.js from /Users/kamil/.vscode/extensions/joshbolduc.commitlint-2.4.7/dist/extension.js not supported.
Instead change the require of index.js in /Users/kamil/.vscode/extensions/joshbolduc.commitlint-2.4.7/dist/extension.js to a dynamic import() which is available in all CommonJS modules.
Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/kamil/GitHub/reactor/node_modules/@commitlint/parse/lib/index.js from /Users/kamil/.vscode/extensions/joshbolduc.commitlint-2.4.7/dist/extension.js not supported.
Instead change the require of index.js in /Users/kamil/.vscode/extensions/joshbolduc.commitlint-2.4.7/dist/extension.js to a dynamic import() which is available in all CommonJS modules.
    at Function.<anonymous> (node:electron/js2c/node_init:2:13357)
    at h._load (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:173:5634)
    at n._load (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:170:29786)
    at t._load (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:135:35289)
    at Module.require (/Users/kamil/.vscode/extensions/github.copilot-chat-0.13.0/dist/extension.js:9:42349)
    at h (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/loader.js:4:647)
    at pt (/Users/kamil/.vscode/extensions/joshbolduc.commitlint-2.4.7/dist/extension.js:1:3186)
    at j (/Users/kamil/.vscode/extensions/joshbolduc.commitlint-2.4.7/dist/extension.js:1:3289)
    at xt (/Users/kamil/.vscode/extensions/joshbolduc.commitlint-2.4.7/dist/extension.js:1:3665)
    at wt (/Users/kamil/.vscode/extensions/joshbolduc.commitlint-2.4.7/dist/extension.js:4:1249)
    at re (/Users/kamil/.vscode/extensions/joshbolduc.commitlint-2.4.7/dist/extension.js:6:1234)
    at async ne (/Users/kamil/.vscode/extensions/joshbolduc.commitlint-2.4.7/dist/extension.js:6:629)
    at async Rt (/Users/kamil/.vscode/extensions/joshbolduc.commitlint-2.4.7/dist/extension.js:6:1510)

Footnotes

  1. I have checked that downgrading to cli==18.6.1 and conventional-config==18.6.2 fixes the problem.

@paduszyk
Copy link
Author

paduszyk commented Mar 1, 2024

Potentially related to alessandrojcm/commitlint-pre-commit-hook#152.

@joshbolduc joshbolduc added the bug Something isn't working label Mar 3, 2024
@joshbolduc
Copy link
Owner

Thanks for the report! Yes, it looks like this is due to commitlint v19 supporting ESM only. The fix seems straightforward; I'll look to have this fixed in the next day or so.

@joshbolduc
Copy link
Owner

Unfortunately this did not work the way I thought it did and I had to revert it due to the issue raised in #755. I have an idea to resolve this again, but will require some more work.

@joshbolduc
Copy link
Owner

2.6.0 is now out and should take care of this. Thanks for your patience!

@skwde
Copy link

skwde commented Apr 23, 2024

@joshbolduc, I hate to bring the bad news, but it still seems broken for v19. #784 still doesn't work with extension version 2.6.0

# npm list -g
/opt/conda/lib
├── @commitlint/[email protected]
├── @commitlint/[email protected]

And the extension output:

loading @commitlint/parse dynamically via /opt/conda/lib/node_modules/@commitlint/cli/node_modules/@commitlint/parse/lib/index.js
loading @commitlint/load dynamically via /opt/conda/lib/node_modules/@commitlint/cli/node_modules/@commitlint/load/lib/load.js
loading @commitlint/lint dynamically via /opt/conda/lib/node_modules/@commitlint/cli/node_modules/@commitlint/lint/lib/lint.js
Load config error stack:
Error: Cannot find module "@commitlint/config-conventional" from "/workspaces/docs"

The downgrade to v18.6.3 still works.

@ChristopherBull
Copy link

ChristopherBull commented Apr 23, 2024

I wanted to add that it worked for me. I checked the extension had updated to v2.6.0, restarted it under the Extensions tab, updated my commitlint dependencies to v19.x.x, and it started working. I then updated my repo config to a module (details here: ChristopherBull/demo-semantic-release/issues/2) and that also worked.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants