From c5e7096cdf139ed681cdd2da293dbdb4f01867c0 Mon Sep 17 00:00:00 2001 From: Armano Date: Wed, 9 Dec 2020 23:25:56 +0100 Subject: [PATCH 1/2] refactor(travis-cli): port travis-cli to typescript --- @commitlint/travis-cli/cli.js | 2 + @commitlint/travis-cli/package.json | 25 +- .../src/{cli.test.js => cli.test.ts} | 18 +- @commitlint/travis-cli/src/{cli.js => cli.ts} | 43 ++-- @commitlint/travis-cli/tsconfig.json | 10 + tsconfig.json | 3 +- yarn.lock | 213 +----------------- 7 files changed, 49 insertions(+), 265 deletions(-) create mode 100644 @commitlint/travis-cli/cli.js rename @commitlint/travis-cli/src/{cli.test.js => cli.test.ts} (93%) rename @commitlint/travis-cli/src/{cli.js => cli.ts} (76%) mode change 100755 => 100644 create mode 100644 @commitlint/travis-cli/tsconfig.json diff --git a/@commitlint/travis-cli/cli.js b/@commitlint/travis-cli/cli.js new file mode 100644 index 0000000000..50cba5b2bf --- /dev/null +++ b/@commitlint/travis-cli/cli.js @@ -0,0 +1,2 @@ +#!/usr/bin/env node +require('./lib/cli'); diff --git a/@commitlint/travis-cli/package.json b/@commitlint/travis-cli/package.json index d989d3d1aa..413bf280b5 100644 --- a/@commitlint/travis-cli/package.json +++ b/@commitlint/travis-cli/package.json @@ -3,25 +3,15 @@ "version": "11.0.0", "description": "Lint all relevant commits for a change or PR on Travis CI", "files": [ - "lib/" + "lib/", + "cli.js" ], "bin": { - "commitlint-travis": "./lib/cli.js" + "commitlint-travis": "./cli.js" }, "scripts": { - "build": "cross-env NODE_ENV=production babel src --out-dir lib --source-maps", "deps": "dep-check", - "pkg": "pkg-check --skip-main", - "start": "yarn run watch", - "watch": "babel src --out-dir lib --watch --source-maps" - }, - "babel": { - "presets": [ - "babel-preset-commitlint" - ], - "ignore": [ - "**/*.test.js" - ] + "pkg": "pkg-check --skip-main" }, "engines": { "node": ">=v10.22.1" @@ -45,15 +35,10 @@ }, "license": "MIT", "devDependencies": { - "@babel/cli": "7.12.8", - "@babel/core": "7.12.9", "@commitlint/test": "^11.0.0", - "@commitlint/utils": "^11.0.0", - "babel-preset-commitlint": "^11.0.0", - "cross-env": "7.0.3" + "@commitlint/utils": "^11.0.0" }, "dependencies": { - "@babel/runtime": "^7.11.2", "@commitlint/cli": "^11.0.0", "execa": "^5.0.0" }, diff --git a/@commitlint/travis-cli/src/cli.test.js b/@commitlint/travis-cli/src/cli.test.ts similarity index 93% rename from @commitlint/travis-cli/src/cli.test.js rename to @commitlint/travis-cli/src/cli.test.ts index da60e7b94f..0e0227ac6e 100644 --- a/@commitlint/travis-cli/src/cli.test.js +++ b/@commitlint/travis-cli/src/cli.test.ts @@ -1,14 +1,14 @@ import execa from 'execa'; import {git} from '@commitlint/test'; -const bin = require.resolve('../lib/cli.js'); +const bin = require.resolve('../cli.js'); const TRAVIS_COMMITLINT_BIN = require.resolve('../fixtures/commitlint'); const TRAVIS_COMMITLINT_GIT_BIN = require.resolve('../fixtures/git'); const validBaseEnv = { - TRAVIS: true, - CI: true, + TRAVIS: 'true', + CI: 'true', TRAVIS_COMMIT: 'TRAVIS_COMMIT', TRAVIS_COMMITLINT_BIN: TRAVIS_COMMITLINT_BIN, TRAVIS_COMMITLINT_GIT_BIN: TRAVIS_COMMITLINT_GIT_BIN, @@ -18,7 +18,7 @@ const validBaseEnv = { TRAVIS_PULL_REQUEST_SLUG: 'TRAVIS_PULL_REQUEST_SLUG', }; -const cli = async (config = {}, args = []) => { +const cli = async (config: execa.Options = {}, args: string[] = []) => { try { return await execa(bin, args, config); } catch (err) { @@ -28,8 +28,8 @@ const cli = async (config = {}, args = []) => { test('should throw when not on travis ci', async () => { const env = { - CI: false, - TRAVIS: false, + CI: 'false', + TRAVIS: 'false' }; await expect(cli({env})).rejects.toThrow( @@ -39,8 +39,8 @@ test('should throw when not on travis ci', async () => { test('should throw when on travis ci, but env vars are missing', async () => { const env = { - TRAVIS: true, - CI: true, + TRAVIS: 'true', + CI: 'true' }; await expect(cli({env})).rejects.toThrow( @@ -131,7 +131,7 @@ test('should call git with extra expected args on pull_request', async () => { ]); }); -function getInvocations(stdout) { +function getInvocations(stdout: string): string[][] { const matches = stdout.match(/[^[\]]+/g); const raw = Array.isArray(matches) ? matches : []; diff --git a/@commitlint/travis-cli/src/cli.js b/@commitlint/travis-cli/src/cli.ts old mode 100755 new mode 100644 similarity index 76% rename from @commitlint/travis-cli/src/cli.js rename to @commitlint/travis-cli/src/cli.ts index 1284ba2213..fbb7bd26a8 --- a/@commitlint/travis-cli/src/cli.js +++ b/@commitlint/travis-cli/src/cli.ts @@ -1,10 +1,9 @@ -#!/usr/bin/env node import execa from 'execa'; -import commitlint from '@commitlint/cli'; // Allow to override used bins for testing purposes const GIT = process.env.TRAVIS_COMMITLINT_GIT_BIN || 'git'; -const COMMITLINT = process.env.TRAVIS_COMMITLINT_BIN; +const COMMITLINT = + process.env.TRAVIS_COMMITLINT_BIN || require('@commitlint/cli'); const REQUIRED = [ 'TRAVIS_COMMIT', @@ -14,7 +13,7 @@ const REQUIRED = [ 'TRAVIS_PULL_REQUEST_SLUG', ]; -const COMMIT = process.env.TRAVIS_COMMIT; +const COMMIT = process.env.TRAVIS_COMMIT || ''; const REPO_SLUG = process.env.TRAVIS_REPO_SLUG; const PR_SLUG = process.env.TRAVIS_PULL_REQUEST_SLUG || REPO_SLUG; const RANGE = process.env.TRAVIS_COMMIT_RANGE; @@ -36,7 +35,7 @@ async function main() { () => fetch({name: 'base', url: `https://github.com/${REPO_SLUG}.git`}), IS_PR ? () => fetch({name: 'source', url: `https://github.com/${PR_SLUG}.git`}) - : async () => {}, + : () => Promise.resolve() ]); // Restore stashed changes if any @@ -54,11 +53,14 @@ async function main() { } } -async function git(args, options) { - return execa(GIT, args, Object.assign({}, {stdio: 'inherit'}, options)); +async function git(args: string[], options: execa.Options = {}) { + return execa(GIT, args, { + stdio: 'inherit', + ...options + }); } -async function fetch({name, url}) { +async function fetch({name, url}: {name: string; url: string}) { await git(['remote', 'add', name, url]); await git(['fetch', name, '--quiet']); } @@ -70,28 +72,23 @@ async function isClean() { return !(result.stdout && result.stdout.trim()); } -async function lint(args, options) { - return execa( - COMMITLINT || commitlint, - args, - Object.assign({}, {stdio: ['pipe', 'inherit', 'inherit']}, options) - ); +async function lint(args: string[], options: execa.Options = {}) { + return execa(COMMITLINT, args, { + stdio: ['pipe', 'inherit', 'inherit'], + ...options + }); } -async function log(hash) { - const result = await execa(GIT, [ - 'log', - '-n', - '1', - '--pretty=format:%B', - hash, - ]); +async function log(hash: string) { + const result = await git(['log', '-n', '1', '--pretty=format:%B', hash], { + stdio: 'pipe' + }); return result.stdout; } async function stash() { if (await isClean()) { - return async () => {}; + return () => Promise.resolve(); } await git(['stash', '-k', '-u', '--quiet']); return () => git(['stash', 'pop', '--quiet']); diff --git a/@commitlint/travis-cli/tsconfig.json b/@commitlint/travis-cli/tsconfig.json new file mode 100644 index 0000000000..49479bf34f --- /dev/null +++ b/@commitlint/travis-cli/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "composite": true, + "rootDir": "./src", + "outDir": "./lib" + }, + "include": ["./src"], + "exclude": ["./src/**/*.test.ts", "./lib/**/*"] +} diff --git a/tsconfig.json b/tsconfig.json index fd1d9d995a..cbbd1aa958 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -19,6 +19,7 @@ {"path": "@commitlint/rules"}, {"path": "@commitlint/lint"}, {"path": "@commitlint/core"}, - {"path": "@commitlint/cli"} + {"path": "@commitlint/cli"}, + {"path": "@commitlint/travis-cli"} ] } diff --git a/yarn.lock b/yarn.lock index dbac0f439e..569c9050c8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,23 +2,6 @@ # yarn lockfile v1 -"@babel/cli@7.12.8": - version "7.12.8" - resolved "https://registry.npmjs.org/@babel/cli/-/cli-7.12.8.tgz#3b24ed2fd5da353ee6f19e8935ff8c93b5fe8430" - integrity sha512-/6nQj11oaGhLmZiuRUfxsujiPDc9BBReemiXgIbxc+M5W+MIiFKYwvNDJvBfnGKNsJTKbUfEheKc9cwoPHAVQA== - dependencies: - commander "^4.0.1" - convert-source-map "^1.1.0" - fs-readdir-recursive "^1.1.0" - glob "^7.0.0" - lodash "^4.17.19" - make-dir "^2.1.0" - slash "^2.0.0" - source-map "^0.5.0" - optionalDependencies: - "@nicolo-ribaudo/chokidar-2" "2.1.8-no-fsevents" - chokidar "^3.4.0" - "@babel/cli@^7.11.6": version "7.11.6" resolved "https://registry.npmjs.org/@babel/cli/-/cli-7.11.6.tgz#1fcbe61c2a6900c3539c06ee58901141f3558482" @@ -58,28 +41,6 @@ invariant "^2.2.4" semver "^5.5.0" -"@babel/core@7.12.9": - version "7.12.9" - resolved "https://registry.npmjs.org/@babel/core/-/core-7.12.9.tgz#fd450c4ec10cdbb980e2928b7aa7a28484593fc8" - integrity sha512-gTXYh3M5wb7FRXQy+FErKFAv90BnlOuNn1QkCK2lREoPAjrQCO49+HVSrFoe5uakFAF5eenS75KbO2vQiLrTMQ== - dependencies: - "@babel/code-frame" "^7.10.4" - "@babel/generator" "^7.12.5" - "@babel/helper-module-transforms" "^7.12.1" - "@babel/helpers" "^7.12.5" - "@babel/parser" "^7.12.7" - "@babel/template" "^7.12.7" - "@babel/traverse" "^7.12.9" - "@babel/types" "^7.12.7" - convert-source-map "^1.7.0" - debug "^4.1.0" - gensync "^1.0.0-beta.1" - json5 "^2.1.2" - lodash "^4.17.19" - resolve "^1.3.2" - semver "^5.4.1" - source-map "^0.5.0" - "@babel/core@^7.1.0", "@babel/core@^7.7.5": version "7.8.4" resolved "https://registry.npmjs.org/@babel/core/-/core-7.8.4.tgz#d496799e5c12195b3602d0fddd77294e3e38e80e" @@ -160,24 +121,6 @@ jsesc "^2.5.1" source-map "^0.5.0" -"@babel/generator@^7.12.1": - version "7.12.1" - resolved "https://registry.npmjs.org/@babel/generator/-/generator-7.12.1.tgz#0d70be32bdaa03d7c51c8597dda76e0df1f15468" - integrity sha512-DB+6rafIdc9o72Yc3/Ph5h+6hUjeOp66pF0naQBgUFFuPqzQwIlPTm3xZR7YNvduIMtkDIj2t21LSQwnbCrXvg== - dependencies: - "@babel/types" "^7.12.1" - jsesc "^2.5.1" - source-map "^0.5.0" - -"@babel/generator@^7.12.5": - version "7.12.5" - resolved "https://registry.npmjs.org/@babel/generator/-/generator-7.12.5.tgz#a2c50de5c8b6d708ab95be5e6053936c1884a4de" - integrity sha512-m16TQQJ8hPt7E+OS/XVQg/7U184MLXtvuGbCdA7na61vha+ImkyyNM/9DDA0unYCVZn3ZOhng+qz48/KBOT96A== - dependencies: - "@babel/types" "^7.12.5" - jsesc "^2.5.1" - source-map "^0.5.0" - "@babel/helper-annotate-as-pure@^7.10.4": version "7.10.4" resolved "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.10.4.tgz#5bf0d495a3f757ac3bda48b5bf3b3ba309c72ba3" @@ -311,13 +254,6 @@ dependencies: "@babel/types" "^7.11.0" -"@babel/helper-member-expression-to-functions@^7.12.1": - version "7.12.1" - resolved "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.12.1.tgz#fba0f2fcff3fba00e6ecb664bb5e6e26e2d6165c" - integrity sha512-k0CIe3tXUKTRSoEx1LQEPFU9vRQfqHtl+kf8eNnDqb4AUJEy5pz6aIiog+YWtVm2jpggjS1laH68bPsR+KWWPQ== - dependencies: - "@babel/types" "^7.12.1" - "@babel/helper-module-imports@^7.0.0-beta.44": version "7.8.3" resolved "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.8.3.tgz#7fe39589b39c016331b6b8c3f441e8f0b1419498" @@ -332,13 +268,6 @@ dependencies: "@babel/types" "^7.10.4" -"@babel/helper-module-imports@^7.12.1": - version "7.12.1" - resolved "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.12.1.tgz#1644c01591a15a2f084dd6d092d9430eb1d1216c" - integrity sha512-ZeC1TlMSvikvJNy1v/wPIazCu3NdOwgYZLIkmIyAsGhqkNpiDoQQRmaCK8YP4Pq3GPTLPV9WXaPCJKvx06JxKA== - dependencies: - "@babel/types" "^7.12.1" - "@babel/helper-module-transforms@^7.10.4", "@babel/helper-module-transforms@^7.10.5", "@babel/helper-module-transforms@^7.11.0": version "7.11.0" resolved "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.11.0.tgz#b16f250229e47211abdd84b34b64737c2ab2d359" @@ -352,21 +281,6 @@ "@babel/types" "^7.11.0" lodash "^4.17.19" -"@babel/helper-module-transforms@^7.12.1": - version "7.12.1" - resolved "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.12.1.tgz#7954fec71f5b32c48e4b303b437c34453fd7247c" - integrity sha512-QQzehgFAZ2bbISiCpmVGfiGux8YVFXQ0abBic2Envhej22DVXV9nCFaS5hIQbkyo1AdGb+gNME2TSh3hYJVV/w== - dependencies: - "@babel/helper-module-imports" "^7.12.1" - "@babel/helper-replace-supers" "^7.12.1" - "@babel/helper-simple-access" "^7.12.1" - "@babel/helper-split-export-declaration" "^7.11.0" - "@babel/helper-validator-identifier" "^7.10.4" - "@babel/template" "^7.10.4" - "@babel/traverse" "^7.12.1" - "@babel/types" "^7.12.1" - lodash "^4.17.19" - "@babel/helper-optimise-call-expression@^7.10.4": version "7.10.4" resolved "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.10.4.tgz#50dc96413d594f995a77905905b05893cd779673" @@ -411,16 +325,6 @@ "@babel/traverse" "^7.10.4" "@babel/types" "^7.10.4" -"@babel/helper-replace-supers@^7.12.1": - version "7.12.1" - resolved "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.12.1.tgz#f15c9cc897439281891e11d5ce12562ac0cf3fa9" - integrity sha512-zJjTvtNJnCFsCXVi5rUInstLd/EIVNmIKA1Q9ynESmMBWPWd+7sdR+G4/wdu+Mppfep0XLyG2m7EBPvjCeFyrw== - dependencies: - "@babel/helper-member-expression-to-functions" "^7.12.1" - "@babel/helper-optimise-call-expression" "^7.10.4" - "@babel/traverse" "^7.12.1" - "@babel/types" "^7.12.1" - "@babel/helper-simple-access@^7.10.4": version "7.10.4" resolved "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.10.4.tgz#0f5ccda2945277a2a7a2d3a821e15395edcf3461" @@ -429,13 +333,6 @@ "@babel/template" "^7.10.4" "@babel/types" "^7.10.4" -"@babel/helper-simple-access@^7.12.1": - version "7.12.1" - resolved "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.12.1.tgz#32427e5aa61547d38eb1e6eaf5fd1426fdad9136" - integrity sha512-OxBp7pMrjVewSSC8fXDFrHrBcJATOOFssZwv16F3/6Xtc138GHybBfPbm9kfiqQHKhYQrlamWILwlDCeyMFEaA== - dependencies: - "@babel/types" "^7.12.1" - "@babel/helper-skip-transparent-expression-wrappers@^7.11.0": version "7.11.0" resolved "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.11.0.tgz#eec162f112c2f58d3af0af125e3bb57665146729" @@ -488,15 +385,6 @@ "@babel/traverse" "^7.10.4" "@babel/types" "^7.10.4" -"@babel/helpers@^7.12.5": - version "7.12.5" - resolved "https://registry.npmjs.org/@babel/helpers/-/helpers-7.12.5.tgz#1a1ba4a768d9b58310eda516c449913fe647116e" - integrity sha512-lgKGMQlKqA8meJqKsW6rUnc4MdUk35Ln0ATDqdM1a/UpARODdI4j5Y5lVfUScnSNkJcdCRAaWkspykNoFg9sJA== - dependencies: - "@babel/template" "^7.10.4" - "@babel/traverse" "^7.12.5" - "@babel/types" "^7.12.5" - "@babel/helpers@^7.8.4": version "7.8.4" resolved "https://registry.npmjs.org/@babel/helpers/-/helpers-7.8.4.tgz#754eb3ee727c165e0a240d6c207de7c455f36f73" @@ -539,16 +427,6 @@ resolved "https://registry.npmjs.org/@babel/parser/-/parser-7.11.5.tgz#c7ff6303df71080ec7a4f5b8c003c58f1cf51037" integrity sha512-X9rD8qqm695vgmeaQ4fvz/o3+Wk4ZzQvSHkDBgpYKxpD4qTAUm88ZKtHkVqIOsYFFbIQ6wQYhC6q7pjqVK0E0Q== -"@babel/parser@^7.12.1": - version "7.12.3" - resolved "https://registry.npmjs.org/@babel/parser/-/parser-7.12.3.tgz#a305415ebe7a6c7023b40b5122a0662d928334cd" - integrity sha512-kFsOS0IbsuhO5ojF8Hc8z/8vEIOkylVBrjiZUbLTE3XFe0Qi+uu6HjzQixkFaqr0ZPAMZcBVxEwmsnsLPZ2Xsw== - -"@babel/parser@^7.12.7": - version "7.12.7" - resolved "https://registry.npmjs.org/@babel/parser/-/parser-7.12.7.tgz#fee7b39fe809d0e73e5b25eecaf5780ef3d73056" - integrity sha512-oWR02Ubp4xTLCAqPRiNIuMVgNO5Aif/xpXtabhzW2HWUD47XJsAB4Zd/Rg30+XeQA3juXigV7hlquOTmwqLiwg== - "@babel/plugin-proposal-async-generator-functions@^7.10.4": version "7.10.5" resolved "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.10.5.tgz#3491cabf2f7c179ab820606cec27fed15e0e8558" @@ -1126,15 +1004,6 @@ "@babel/parser" "^7.10.4" "@babel/types" "^7.10.4" -"@babel/template@^7.12.7": - version "7.12.7" - resolved "https://registry.npmjs.org/@babel/template/-/template-7.12.7.tgz#c817233696018e39fbb6c491d2fb684e05ed43bc" - integrity sha512-GkDzmHS6GV7ZeXfJZ0tLRBhZcMcY0/Lnb+eEbXDBfCAcZCjrZKe6p3J4we/D24O9Y8enxWAg1cWwof59yLh2ow== - dependencies: - "@babel/code-frame" "^7.10.4" - "@babel/parser" "^7.12.7" - "@babel/types" "^7.12.7" - "@babel/template@^7.7.4", "@babel/template@^7.8.3": version "7.8.3" resolved "https://registry.npmjs.org/@babel/template/-/template-7.8.3.tgz#e02ad04fe262a657809327f578056ca15fd4d1b8" @@ -1189,51 +1058,6 @@ globals "^11.1.0" lodash "^4.17.19" -"@babel/traverse@^7.12.1": - version "7.12.1" - resolved "https://registry.npmjs.org/@babel/traverse/-/traverse-7.12.1.tgz#941395e0c5cc86d5d3e75caa095d3924526f0c1e" - integrity sha512-MA3WPoRt1ZHo2ZmoGKNqi20YnPt0B1S0GTZEPhhd+hw2KGUzBlHuVunj6K4sNuK+reEvyiPwtp0cpaqLzJDmAw== - dependencies: - "@babel/code-frame" "^7.10.4" - "@babel/generator" "^7.12.1" - "@babel/helper-function-name" "^7.10.4" - "@babel/helper-split-export-declaration" "^7.11.0" - "@babel/parser" "^7.12.1" - "@babel/types" "^7.12.1" - debug "^4.1.0" - globals "^11.1.0" - lodash "^4.17.19" - -"@babel/traverse@^7.12.5": - version "7.12.7" - resolved "https://registry.npmjs.org/@babel/traverse/-/traverse-7.12.7.tgz#572a722408681cef17d6b0bef69ef2e728ca69f1" - integrity sha512-nMWaqsQEeSvMNypswUDzjqQ+0rR6pqCtoQpsqGJC4/Khm9cISwPTSpai57F6/jDaOoEGz8yE/WxcO3PV6tKSmQ== - dependencies: - "@babel/code-frame" "^7.10.4" - "@babel/generator" "^7.12.5" - "@babel/helper-function-name" "^7.10.4" - "@babel/helper-split-export-declaration" "^7.11.0" - "@babel/parser" "^7.12.7" - "@babel/types" "^7.12.7" - debug "^4.1.0" - globals "^11.1.0" - lodash "^4.17.19" - -"@babel/traverse@^7.12.9": - version "7.12.9" - resolved "https://registry.npmjs.org/@babel/traverse/-/traverse-7.12.9.tgz#fad26c972eabbc11350e0b695978de6cc8e8596f" - integrity sha512-iX9ajqnLdoU1s1nHt36JDI9KG4k+vmI8WgjK5d+aDTwQbL2fUnzedNedssA645Ede3PM2ma1n8Q4h2ohwXgMXw== - dependencies: - "@babel/code-frame" "^7.10.4" - "@babel/generator" "^7.12.5" - "@babel/helper-function-name" "^7.10.4" - "@babel/helper-split-export-declaration" "^7.11.0" - "@babel/parser" "^7.12.7" - "@babel/types" "^7.12.7" - debug "^4.1.0" - globals "^11.1.0" - lodash "^4.17.19" - "@babel/types@^7.0.0", "@babel/types@^7.3.0", "@babel/types@^7.8.3": version "7.8.3" resolved "https://registry.npmjs.org/@babel/types/-/types-7.8.3.tgz#5a383dffa5416db1b73dedffd311ffd0788fb31c" @@ -1270,24 +1094,6 @@ lodash "^4.17.19" to-fast-properties "^2.0.0" -"@babel/types@^7.12.1": - version "7.12.1" - resolved "https://registry.npmjs.org/@babel/types/-/types-7.12.1.tgz#e109d9ab99a8de735be287ee3d6a9947a190c4ae" - integrity sha512-BzSY3NJBKM4kyatSOWh3D/JJ2O3CVzBybHWxtgxnggaxEuaSTTDqeiSb/xk9lrkw2Tbqyivw5ZU4rT+EfznQsA== - dependencies: - "@babel/helper-validator-identifier" "^7.10.4" - lodash "^4.17.19" - to-fast-properties "^2.0.0" - -"@babel/types@^7.12.5", "@babel/types@^7.12.7": - version "7.12.7" - resolved "https://registry.npmjs.org/@babel/types/-/types-7.12.7.tgz#6039ff1e242640a29452c9ae572162ec9a8f5d13" - integrity sha512-MNyI92qZq6jrQkXvtIiykvl4WtoRrVV9MPn+ZfsoEENjiWcBQ3ZSHrkxnJWgWtLX3XXqX5hrSQ+X69wkmesXuQ== - dependencies: - "@babel/helper-validator-identifier" "^7.10.4" - lodash "^4.17.19" - to-fast-properties "^2.0.0" - "@bcoe/v8-coverage@^0.2.3": version "0.2.3" resolved "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" @@ -2290,23 +2096,6 @@ call-me-maybe "^1.0.1" glob-to-regexp "^0.3.0" -"@nicolo-ribaudo/chokidar-2@2.1.8-no-fsevents": - version "2.1.8-no-fsevents" - resolved "https://registry.npmjs.org/@nicolo-ribaudo/chokidar-2/-/chokidar-2-2.1.8-no-fsevents.tgz#da7c3996b8e6e19ebd14d82eaced2313e7769f9b" - integrity sha512-+nb9vWloHNNMFHjGofEam3wopE3m1yuambrrd/fnPc+lFOMB9ROTqQlche9ByFWNkdNqfSgR/kkQtQ8DzEWt2w== - dependencies: - anymatch "^2.0.0" - async-each "^1.0.1" - braces "^2.3.2" - glob-parent "^3.1.0" - inherits "^2.0.3" - is-binary-path "^1.0.0" - is-glob "^4.0.0" - normalize-path "^3.0.0" - path-is-absolute "^1.0.0" - readdirp "^2.2.1" - upath "^1.1.1" - "@nodelib/fs.scandir@2.1.3": version "2.1.3" resolved "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.3.tgz#3a582bdb53804c6ba6d146579c46e52130cf4a3b" @@ -3575,7 +3364,7 @@ chokidar@^2.1.8: optionalDependencies: fsevents "^1.2.7" -chokidar@^3.3.0, chokidar@^3.4.0: +chokidar@^3.3.0: version "3.4.3" resolved "https://registry.npmjs.org/chokidar/-/chokidar-3.4.3.tgz#c1df38231448e45ca4ac588e6c79573ba6a57d5b" integrity sha512-DtM3g7juCXQxFVSNPNByEC2+NImtBuxQQvWlHunpJIS5Ocr0lG306cC7FCi7cEA0fzmybPUIl4txBIobk1gGOQ== From 806a2e1f6ab387a31e1ee4f1c88e965377cd4c6e Mon Sep 17 00:00:00 2001 From: Armano Date: Wed, 9 Dec 2020 23:31:12 +0100 Subject: [PATCH 2/2] chore: fix formatting --- @commitlint/travis-cli/src/cli.test.ts | 4 ++-- @commitlint/travis-cli/src/cli.ts | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/@commitlint/travis-cli/src/cli.test.ts b/@commitlint/travis-cli/src/cli.test.ts index 0e0227ac6e..29613ef8d3 100644 --- a/@commitlint/travis-cli/src/cli.test.ts +++ b/@commitlint/travis-cli/src/cli.test.ts @@ -29,7 +29,7 @@ const cli = async (config: execa.Options = {}, args: string[] = []) => { test('should throw when not on travis ci', async () => { const env = { CI: 'false', - TRAVIS: 'false' + TRAVIS: 'false', }; await expect(cli({env})).rejects.toThrow( @@ -40,7 +40,7 @@ test('should throw when not on travis ci', async () => { test('should throw when on travis ci, but env vars are missing', async () => { const env = { TRAVIS: 'true', - CI: 'true' + CI: 'true', }; await expect(cli({env})).rejects.toThrow( diff --git a/@commitlint/travis-cli/src/cli.ts b/@commitlint/travis-cli/src/cli.ts index fbb7bd26a8..22ccea6c87 100644 --- a/@commitlint/travis-cli/src/cli.ts +++ b/@commitlint/travis-cli/src/cli.ts @@ -35,7 +35,7 @@ async function main() { () => fetch({name: 'base', url: `https://github.com/${REPO_SLUG}.git`}), IS_PR ? () => fetch({name: 'source', url: `https://github.com/${PR_SLUG}.git`}) - : () => Promise.resolve() + : () => Promise.resolve(), ]); // Restore stashed changes if any @@ -56,7 +56,7 @@ async function main() { async function git(args: string[], options: execa.Options = {}) { return execa(GIT, args, { stdio: 'inherit', - ...options + ...options, }); } @@ -75,13 +75,13 @@ async function isClean() { async function lint(args: string[], options: execa.Options = {}) { return execa(COMMITLINT, args, { stdio: ['pipe', 'inherit', 'inherit'], - ...options + ...options, }); } async function log(hash: string) { const result = await git(['log', '-n', '1', '--pretty=format:%B', hash], { - stdio: 'pipe' + stdio: 'pipe', }); return result.stdout; }