From 0231a55c34fb7a0227ff1e50b4cfa9d10ed9dcac Mon Sep 17 00:00:00 2001 From: Jerome Fitzgerald Date: Sun, 28 Feb 2021 11:50:46 -0500 Subject: [PATCH] =?UTF-8?q?style:=20=F0=9F=92=84=EF=B8=8F=20=20fix=20lerna?= =?UTF-8?q?=20errors,=20update=20eslint=20to=20not=20!prettier?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `space-before-function-paren` turned off 🤔️ have the sneaky suspicion that there is prettier rewrites then eslint rewrites happening --- .eslintrc.js | 6 +++++- lib/LimitedInputPrompt.js | 10 +++++----- lib/cli.js | 2 +- lib/cz.js | 2 +- lib/formatCommitMessage.js | 2 +- lib/questions/scope.js | 2 +- lib/questions/type.js | 2 +- lib/runInteractiveQuestions.js | 2 +- lib/util/lerna.js | 1 + test/cli.test.js | 6 +++--- test/testUtils.js | 4 ++-- 11 files changed, 22 insertions(+), 17 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 872c00ed..bcb75479 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -484,7 +484,11 @@ module.exports = { ], 'sort-vars': 2, 'space-before-blocks': [2, 'always'], - 'space-before-function-paren': [2, 'always'], + + // @question this contradicts prettier + // 'space-before-function-paren': [2, 'always'], + 'space-before-function-paren': [2, 'never'], + 'space-in-parens': [2, 'never'], 'space-infix-ops': 2, 'space-unary-ops': [ diff --git a/lib/LimitedInputPrompt.js b/lib/LimitedInputPrompt.js index 97d63aad..f7f6eaf5 100644 --- a/lib/LimitedInputPrompt.js +++ b/lib/LimitedInputPrompt.js @@ -2,7 +2,7 @@ const chalk = require('chalk'); const InputPrompt = require('inquirer/lib/prompts/input'); class LimitedInputPrompt extends InputPrompt { - constructor (...args) { + constructor(...args) { super(...args); if (!this.opt.maxLength) { @@ -24,11 +24,11 @@ class LimitedInputPrompt extends InputPrompt { this.leadingLength = this.leadingLabel.length; } - remainingChar () { + remainingChar() { return this.opt.maxLength - this.leadingLength - this.rl.line.length; } - onKeypress () { + onKeypress() { if (this.rl.line.length > this.opt.maxLength - this.leadingLength) { this.rl.line = this.rl.line.slice(0, this.opt.maxLength - this.leadingLength); this.rl.cursor--; @@ -37,7 +37,7 @@ class LimitedInputPrompt extends InputPrompt { this.render(); } - getCharsLeftText () { + getCharsLeftText() { const chars = this.remainingChar(); if (chars > 15) { @@ -49,7 +49,7 @@ class LimitedInputPrompt extends InputPrompt { } } - render (error) { + render(error) { let bottomContent = ''; let message = this.getQuestion(); let appendContent = ''; diff --git a/lib/cli.js b/lib/cli.js index 4eb057b1..632ed0fe 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -25,7 +25,7 @@ const executeCommand = (command, env = process.env) => { }; // eslint-disable-next-line complexity -const main = async () => { +const main = async() => { try { const {cliAnswers, cliOptions, passThroughParams} = parseArgs(); diff --git a/lib/cz.js b/lib/cz.js index 1db932ec..fcbaa073 100644 --- a/lib/cz.js +++ b/lib/cz.js @@ -3,7 +3,7 @@ const runInteractiveQuestions = require('./runInteractiveQuestions'); const formatCommitMessage = require('./formatCommitMessage'); exports.prompter = (cz, commit) => { - const run = async () => { + const run = async() => { const state = createState(); await runInteractiveQuestions(state); diff --git a/lib/formatCommitMessage.js b/lib/formatCommitMessage.js index 11a991bd..56836cf4 100644 --- a/lib/formatCommitMessage.js +++ b/lib/formatCommitMessage.js @@ -4,7 +4,7 @@ const wrap = require('word-wrap'); const MAX_LINE_WIDTH = 72; -const makeAffectsLine = function (answers) { +const makeAffectsLine = function(answers) { const selectedPackages = answers.packages; if (selectedPackages && selectedPackages.length) { diff --git a/lib/questions/scope.js b/lib/questions/scope.js index b0826718..a5e044c3 100644 --- a/lib/questions/scope.js +++ b/lib/questions/scope.js @@ -6,7 +6,7 @@ const fuzzy = require('fuzzy'); * @param {string} substring Substring to search with. * @param {string[]} scopes Scopes list. */ -const findScope = function (substring, scopes) { +const findScope = function(substring, scopes) { return Promise.resolve( fuzzy.filter(substring || '', scopes).map(({original: scope}) => scope), ); diff --git a/lib/questions/type.js b/lib/questions/type.js index 7571d78c..61f6ac48 100644 --- a/lib/questions/type.js +++ b/lib/questions/type.js @@ -16,7 +16,7 @@ const typeToListItem = ({types, disableEmoji}, type) => { * @param {string} substring Substring to search with. * @param {string[]} config The whole config. */ -const findType = function (substring, config) { +const findType = function(substring, config) { const types = config.list; return Promise.resolve( diff --git a/lib/runInteractiveQuestions.js b/lib/runInteractiveQuestions.js index e403be55..d3cf5675 100644 --- a/lib/runInteractiveQuestions.js +++ b/lib/runInteractiveQuestions.js @@ -13,7 +13,7 @@ inquirer.registerPrompt('autocomplete', AutocompletePrompt); // promptQuestions = promptQuestions.concat(createPackagesQuestion(allPackages, changedPackages)); // } -const runInteractiveQuestions = async (state, cliAnswers) => { +const runInteractiveQuestions = async(state, cliAnswers) => { Object.keys(cliAnswers).forEach((key) => { state.answers[key] = cliAnswers[key]; }); diff --git a/lib/util/lerna.js b/lib/util/lerna.js index a1aa7cca..f266b2a9 100755 --- a/lib/util/lerna.js +++ b/lib/util/lerna.js @@ -23,6 +23,7 @@ const getPackageDirectory = (state) => { if (fs.existsSync(pkgFilename)) { try { + // eslint-disable-next-line global-require, import/no-dynamic-require const packagesDirectory = require(pkgFilename).workspaces.packages; if (packagesDirectory) { diff --git a/test/cli.test.js b/test/cli.test.js index 7877cbc0..16f5efc5 100644 --- a/test/cli.test.js +++ b/test/cli.test.js @@ -1,7 +1,7 @@ const pkg = require('../package.json'); const {runCLI} = require('./testUtils'); -test('git-cz --help', async () => { +test('git-cz --help', async() => { const {getResult} = runCLI(['--help']); const result = await getResult(); @@ -9,7 +9,7 @@ test('git-cz --help', async () => { expect(result).toMatchSnapshot(); }); -test('git-cz --version', async () => { +test('git-cz --version', async() => { const {getResult} = runCLI(['--version']); const result = await getResult(); @@ -17,7 +17,7 @@ test('git-cz --version', async () => { expect(result.trim()).toBe(pkg.version); }); -test('git-cz --non-interactive', async () => { +test('git-cz --non-interactive', async() => { const {getResult} = runCLI(['--non-interactive', '--dry-run']); const result = await getResult(); diff --git a/test/testUtils.js b/test/testUtils.js index 4e67c38f..c4d84ea2 100644 --- a/test/testUtils.js +++ b/test/testUtils.js @@ -12,7 +12,7 @@ exports.runCLI = (args = []) => { const {promise, stdin} = spawn('node', [CLI_PATH, ...args]); - const getResult = async () => { + const getResult = async() => { const {stdout} = await promise; return stdout; @@ -20,7 +20,7 @@ exports.runCLI = (args = []) => { const delay = () => new Promise((resolve) => setTimeout(resolve, 500)); - const write = async (inputs = []) => { + const write = async(inputs = []) => { for (const input of inputs) { stdin.write(input); await delay();