alessandrojcm / commitlint-pre-commit-hook

A pre-commit hook for commitlint
MIT License
151 stars 17 forks source link

Failure to find config #140

Closed Goldziher closed 10 months ago

Goldziher commented 10 months ago

Hi there,

I am using Python 3.12, Node v21.3.0 with pre-commit v3.5.0 and have the following .pre-commit-config.yaml file:

default_stages: [commit]
repos:
    - repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
      rev: 'v9.10.0'
      hooks:
          - id: commitlint
            stages: [commit-msg]
            additional_dependencies: [ '@commitlint/config-conventional' ]

I am getting the following error:

/Users/naamanhirschfeld/.cache/pre-commit/repoe0pf8fjt/node_env-default/lib/node_modules/commitlint-pre-commit-hook/node_modules/@commitlint/cli/lib/cli.js:123
        throw err;
        ^

Error: Cannot find module "conventional-changelog-lint-config-,@commitlint/config-conventional" from "/Users/naamanhirschfeld/workspace/basemind/monorepo"
    at resolveId (/Users/naamanhirschfeld/.cache/pre-commit/repoe0pf8fjt/node_env-default/lib/node_modules/commitlint-pre-commit-hook/node_modules/@commitlint/resolve-extends/lib/index.js:104:17)
    at resolveConfig (/Users/naamanhirschfeld/.cache/pre-commit/repoe0pf8fjt/node_env-default/lib/node_modules/commitlint-pre-commit-hook/node_modules/@commitlint/resolve-extends/lib/index.js:88:26)
    at /Users/naamanhirschfeld/.cache/pre-commit/repoe0pf8fjt/node_env-default/lib/node_modules/commitlint-pre-commit-hook/node_modules/@commitlint/resolve-extends/lib/index.js:47:26
    at Array.reduce (<anonymous>)
    at loadExtends (/Users/naamanhirschfeld/.cache/pre-commit/repoe0pf8fjt/node_env-default/lib/node_modules/commitlint-pre-commit-hook/node_modules/@commitlint/resolve-extends/lib/index.js:45:16)
    at resolveExtends (/Users/naamanhirschfeld/.cache/pre-commit/repoe0pf8fjt/node_env-default/lib/node_modules/commitlint-pre-commit-hook/node_modules/@commitlint/resolve-extends/lib/index.js:25:22)
    at load (/Users/naamanhirschfeld/.cache/pre-commit/repoe0pf8fjt/node_env-default/lib/node_modules/commitlint-pre-commit-hook/node_modules/@commitlint/load/lib/load.js:42:52)
    at async main (/Users/naamanhirschfeld/.cache/pre-commit/repoe0pf8fjt/node_env-default/lib/node_modules/commitlint-pre-commit-hook/node_modules/@commitlint/cli/lib/cli.js:189:20) {
  code: 'MODULE_NOT_FOUND'
}

I tried the following:

  1. Removed the cache with pre-commit clean
  2. Reinstall pre-commit
  3. Switch Python versions - I tried both Python 3.11 and Python 3.12

The issue remains on my end.

Goldziher commented 10 months ago

Issue was caused by a typo in my config file (note the comma):

{ "extends": [",@commitlint/config-conventional"] }