diff --git a/@commitlint/cli/src/cli.js b/@commitlint/cli/src/cli.js index a82724f2b3..3b7bfb7830 100755 --- a/@commitlint/cli/src/cli.js +++ b/@commitlint/cli/src/cli.js @@ -224,21 +224,6 @@ function getEditValue(flags) { if (typeof edit === 'boolean') { return edit; } - // The recommended method to specify -e with husky was `commitlint -e $GIT_PARAMS` - // This does not work properly with win32 systems, where env variable declarations - // use a different syntax - // See https://github.com/marionebl/commitlint/issues/103 for details - // This has been superceded by the `-E GIT_PARAMS` / `-E HUSKY_GIT_PARAMS` - if (edit === '$GIT_PARAMS' || edit === '%GIT_PARAMS%') { - console.warn(`Using environment variable syntax (${edit}) in -e |\ ---edit is deprecated. Use '{-E|--env} GIT_PARAMS instead'`); - if (!('GIT_PARAMS' in process.env)) { - throw new Error( - `Received ${edit} as value for -e | --edit, but GIT_PARAMS is not available globally.` - ); - } - return process.env.GIT_PARAMS; - } return edit; } diff --git a/@commitlint/cli/src/cli.test.js b/@commitlint/cli/src/cli.test.js index 4a5bd64ec2..4c30c31abb 100644 --- a/@commitlint/cli/src/cli.test.js +++ b/@commitlint/cli/src/cli.test.js @@ -109,24 +109,6 @@ test('should work with husky commitmsg hook in sub packages', async () => { await execa('git', ['commit', '-m', '"test: this should work"'], {cwd}); }); -test('should work with husky via commitlint -e $GIT_PARAMS', async () => { - const cwd = await git.bootstrap('fixtures/husky/integration'); - await writePkg({scripts: {commitmsg: `'${bin}' -e $GIT_PARAMS`}}, {cwd}); - - await execa('npm', ['install'], {cwd}); - await execa('git', ['add', 'package.json'], {cwd}); - await execa('git', ['commit', '-m', '"test: this should work"'], {cwd}); -}); - -test('should work with husky via commitlint -e %GIT_PARAMS%', async () => { - const cwd = await git.bootstrap('fixtures/husky/integration'); - await writePkg({scripts: {commitmsg: `'${bin}' -e %GIT_PARAMS%`}}, {cwd}); - - await execa('npm', ['install'], {cwd}); - await execa('git', ['add', 'package.json'], {cwd}); - await execa('git', ['commit', '-m', '"test: this should work"'], {cwd}); -}); - test('should allow reading of environment variables for edit file, succeeding if valid', async t => { const cwd = await git.bootstrap(); await sander.writeFile(cwd, 'commit-msg-file', 'foo');