Skip to content
This repository has been archived by the owner on Jun 16, 2021. It is now read-only.

Commit

Permalink
style: 💄️ fix lerna errors, update eslint to not !prettier
Browse files Browse the repository at this point in the history
`space-before-function-paren` turned off

 🤔️ have the sneaky suspicion that there is prettier rewrites then
eslint rewrites happening
  • Loading branch information
JeromeFitz committed Feb 28, 2021
1 parent 895b7c7 commit 0231a55
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 17 deletions.
6 changes: 5 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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': [
Expand Down
10 changes: 5 additions & 5 deletions lib/LimitedInputPrompt.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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--;
Expand All @@ -37,7 +37,7 @@ class LimitedInputPrompt extends InputPrompt {
this.render();
}

getCharsLeftText () {
getCharsLeftText() {
const chars = this.remainingChar();

if (chars > 15) {
Expand All @@ -49,7 +49,7 @@ class LimitedInputPrompt extends InputPrompt {
}
}

render (error) {
render(error) {
let bottomContent = '';
let message = this.getQuestion();
let appendContent = '';
Expand Down
2 changes: 1 addition & 1 deletion lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion lib/cz.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion lib/formatCommitMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion lib/questions/scope.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
);
Expand Down
2 changes: 1 addition & 1 deletion lib/questions/type.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion lib/runInteractiveQuestions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
});
Expand Down
1 change: 1 addition & 0 deletions lib/util/lerna.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions test/cli.test.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
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();

expect(result).toMatchSnapshot();
});

test('git-cz --version', async () => {
test('git-cz --version', async() => {
const {getResult} = runCLI(['--version']);

const result = await getResult();

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();
Expand Down
4 changes: 2 additions & 2 deletions test/testUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ exports.runCLI = (args = []) => {

const {promise, stdin} = spawn('node', [CLI_PATH, ...args]);

const getResult = async () => {
const getResult = async() => {
const {stdout} = await promise;

return stdout;
};

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();
Expand Down

0 comments on commit 0231a55

Please sign in to comment.