From 5fc4e4335f56501152bfa339f7e7c1f2c785959c Mon Sep 17 00:00:00 2001 From: Ian Walter Date: Fri, 21 Jun 2019 23:56:28 -0400 Subject: [PATCH 1/5] Moving husky to devDependencies --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 94d847a..65a2a4d 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,6 @@ "detect-indent": "^5.0.0", "he": "^1.1.1", "highlight.js": "^9.12.0", - "husky": "^0.14.3", "min-indent": "^1.0.0", "strip-ansi": "^4.0.0", "strip-indent": "^2.0.0", @@ -36,6 +35,7 @@ "devDependencies": { "ava": "^0.25.0", "coveralls": "^3.0.0", + "husky": "^0.14.3", "nyc": "^11.6.0", "xo": "^0.20.3" }, From c60e2d469d77bc9613bbe93cd50e7a414fe456f3 Mon Sep 17 00:00:00 2001 From: Ian Walter Date: Wed, 18 Sep 2019 21:15:14 -0400 Subject: [PATCH 2/5] Add #4: Adding trailingSpace option --- index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 8aa707c..12644df 100644 --- a/index.js +++ b/index.js @@ -307,7 +307,9 @@ const cropPadAndNumber = (text, opts) => { const plain = stripAnsi(line).replace(/\t/g, '') const linePad = String().padEnd((longestLineLen - plain.length) - tabAdjust, ' ') - const runLengthLine = line + opts.colors.trailingSpace(linePad) + const runLengthLine = opts.trailingSpace + ? line + opts.colors.trailingSpace(linePad) + : line let lineOutput @@ -356,7 +358,8 @@ const procOpts = (opts = {}) => { colors: darkPalette, tabsToSpaces: 4, consoleTabWidth: 8, - arrowKeyword: 'const' + arrowKeyword: 'const', + trailingSpace: true } options = merge(options, opts) From 83d7bd95b242e342ff59c94dd754cc3318f91c12 Mon Sep 17 00:00:00 2001 From: Ian Walter Date: Wed, 18 Sep 2019 21:20:28 -0400 Subject: [PATCH 3/5] Using trailingSpace option in padLine function --- index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 12644df..6827391 100644 --- a/index.js +++ b/index.js @@ -102,9 +102,9 @@ const findLongestLine = (text, opts) => { return max } -const padLine = (line, padding) => { +const padLine = (line, padding, trailingSpace) => { const padStr = String().padStart(padding, ' ') - return padStr + line + padStr + return padStr + line + trailingSpace ? padStr : '' } const getIndentStr = opts => { @@ -318,7 +318,7 @@ const cropPadAndNumber = (text, opts) => { } if (typeof opts.tabsToSpaces === 'number') { - lineOutput = lineNo + padLine(runLengthLine, opts.codePad) + lineOutput = lineNo + padLine(runLengthLine, opts.codePad, opts.trailingSpace) } output += lineOutput + '\n' From ce9d76b924a8bd0409d198e9ed40c462aa1a3dc2 Mon Sep 17 00:00:00 2001 From: Ian Walter Date: Wed, 18 Sep 2019 21:24:45 -0400 Subject: [PATCH 4/5] Fixing string concat typo --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 6827391..a11d11e 100644 --- a/index.js +++ b/index.js @@ -104,7 +104,7 @@ const findLongestLine = (text, opts) => { const padLine = (line, padding, trailingSpace) => { const padStr = String().padStart(padding, ' ') - return padStr + line + trailingSpace ? padStr : '' + return padStr + line + (trailingSpace ? padStr : '') } const getIndentStr = opts => { From 2c5c4fa59df5a293632c6bb94a44ba364fa0615d Mon Sep 17 00:00:00 2001 From: Ian Walter Date: Mon, 6 Jul 2020 16:29:56 -0400 Subject: [PATCH 5/5] Fixing lint issue --- index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index a11d11e..03f30f3 100644 --- a/index.js +++ b/index.js @@ -307,9 +307,9 @@ const cropPadAndNumber = (text, opts) => { const plain = stripAnsi(line).replace(/\t/g, '') const linePad = String().padEnd((longestLineLen - plain.length) - tabAdjust, ' ') - const runLengthLine = opts.trailingSpace - ? line + opts.colors.trailingSpace(linePad) - : line + const runLengthLine = opts.trailingSpace ? + line + opts.colors.trailingSpace(linePad) : + line let lineOutput