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

fix: @commitlint/config-nx-scopes not working for nx since version v19 #3978

Closed
1 of 4 tasks
timonmasberg opened this issue Mar 15, 2024 · 0 comments · Fixed by #3979
Closed
1 of 4 tasks

fix: @commitlint/config-nx-scopes not working for nx since version v19 #3978

timonmasberg opened this issue Mar 15, 2024 · 0 comments · Fixed by #3979
Labels

Comments

@timonmasberg
Copy link
Contributor

timonmasberg commented Mar 15, 2024

Steps to Reproduce

1. First step
https://github.com/timonmasberg/commitlint-nx-bug
2. Second step
`git commit -m "chore: oh no"`

Current Behavior

Throws an error, probably due to the ESM changes introduced in v19.

file:///.../commitlint-nx-19/node_modules/@commitlint/cli/lib/cli.js:127
        throw err;
        ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '.../commitlint-nx-19/node_modules/nx/src/generators/utils/project-configuration' imported from.../commitlint-nx-19-bug/commitlint-nx-19/node_modules/@commitlint/config-nx-scopes/index.js
Did you mean to import .../commitlint-nx-19/node_modules/nx/src/generators/utils/project-configuration.js?
    at finalizeResolution (node:internal/modules/esm/resolve:255:11)
    at moduleResolve (node:internal/modules/esm/resolve:908:10)
    at defaultResolve (node:internal/modules/esm/resolve:1121:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:396:12)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:365:25)
    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:240:38)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:85:39)
    at link (node:internal/modules/esm/module_job:84:36) {
  code: 'ERR_MODULE_NOT_FOUND',
  url: 'file:///.../commitlint-nx-19/node_modules/nx/src/generators/utils/project-configuration'
}

Expected Behavior

It should be able to get the configuration and lint the message.

Affected packages

  • cli
  • core
  • prompt
  • config-angular

Possible Solution

Adding file extensions to nx imports (https://nodejs.org/api/esm.html#esm_mandatory_file_extensions)

Context

Migrating to NX 18, bumped commitlint packages manually, error encountered. Probably not related to nx, rather than how you use the nx modules.

commitlint --version

@commitlint/cli@19.2.0

git --version

2.39.2

node --version

20.10.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

1 participant