Skip to content

Allow running globally installed commitlint and config-angular from anywhere #126

@zanona

Description

@zanona

Expected Behavior

I expect to run echo 'hello world' | commitlint under any directory where that will be analysed against the config-angular preset which was globally installed.

Current Behavior

  $  echo 'hello' | commitlint
/usr/local/lib/node_modules/@commitlint/cli/lib/cli.js:67
		throw err;
		^

Error: Cannot find module '@commitlint/config-angular'
    at Function.Module._resolveFilename (module.js:527:15)
    at resolveFileName (/usr/local/lib/node_modules/@commitlint/cli/node_modules/resolve-from/index.js:17:39)
    at resolveFrom (/usr/local/lib/node_modules/@commitlint/cli/node_modules/resolve-from/index.js:31:9)
    at module.exports (/usr/local/lib/node_modules/@commitlint/cli/node_modules/resolve-from/index.js:34:41)
    at resolveId (/usr/local/lib/node_modules/@commitlint/cli/node_modules/@commitlint/core/lib/library/resolve-extends.js:108:35)
    at resolveConfig (/usr/local/lib/node_modules/@commitlint/cli/node_modules/@commitlint/core/lib/library/resolve-extends.js:99:18)
    at /usr/local/lib/node_modules/@commitlint/cli/node_modules/@commitlint/core/lib/library/resolve-extends.js:50:18
    at Array.reduce (<anonymous>)
    at loadExtends (/usr/local/lib/node_modules/@commitlint/cli/node_modules/@commitlint/core/lib/library/resolve-extends.js:48:32)
    at resolveExtends (/usr/local/lib/node_modules/@commitlint/cli/node_modules/@commitlint/core/lib/library/resolve-extends.js:31:17)

Affected packages

  • cli
  • core
  • prompt
  • config-angular

Possible Solution

Follow Less or ESLint which offer options to run their plugins also installed globally.

Steps to Reproduce (for bugs)

  1. npm install -g @commitlint/cli @commitlint/config-angular
  2. echo "module.exports = {extends: ['@commitlint/config-angular']}" > ~/commitlint.config.js
  3. echo 'hello world' | commitlint
commitlint.config.js
module.exports = {extends: ['@commitlint/config-angular']}

Context

Being able to run commintlint globally without the need to have a config file on every repo I want to run it.

Your Environment

Executable Version
commitlint --version 5.0.0
git --version 2.13.5
node --version v8.7.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions