Skip to content

Commit 17f862f

Browse files
committed
Style fixes for latest ESLint rules
Signed-off-by: Kevin Locke <[email protected]>
1 parent f207eee commit 17f862f

File tree

5 files changed

+31
-27
lines changed

5 files changed

+31
-27
lines changed

bin/git-branch-is.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
'use strict';
88

99
const Command = require('commander').Command;
10+
1011
const gitBranchIs = require('..');
1112
const packageJson = require('../package.json');
1213

@@ -110,28 +111,28 @@ function gitBranchIsCmd(args, callback) {
110111
if (!expectedBranchRegExp.test(currentBranch)) {
111112
callback(null, {
112113
code: 1,
113-
stderr: command.quiet ? '' :
114-
`Error: Current branch "${currentBranch}" does not match "${
114+
stderr: command.quiet ? ''
115+
: `Error: Current branch "${currentBranch}" does not match "${
115116
expectedBranch}".\n`
116117
});
117118
return;
118119
}
119-
} else if (currentBranch !== expectedBranch &&
120-
(!command.ignoreCase ||
121-
currentBranch.toUpperCase() !== expectedBranch.toUpperCase())) {
120+
} else if (currentBranch !== expectedBranch
121+
&& (!command.ignoreCase
122+
|| currentBranch.toUpperCase() !== expectedBranch.toUpperCase())) {
122123
callback(null, {
123124
code: 1,
124-
stderr: command.quiet ? '' :
125-
`Error: Current branch is "${currentBranch}", not "${
125+
stderr: command.quiet ? ''
126+
: `Error: Current branch is "${currentBranch}", not "${
126127
expectedBranch}".\n`
127128
});
128129
return;
129130
}
130131

131132
callback(null, {
132133
code: 0,
133-
stdout: !command.verbose ? '' :
134-
`Current branch is "${currentBranch}".\n`
134+
stdout: !command.verbose ? ''
135+
: `Current branch is "${currentBranch}".\n`
135136
});
136137
});
137138
return undefined;
@@ -148,8 +149,8 @@ if (require.main === module) {
148149
if (errOrResult.stderr) { process.stderr.write(errOrResult.stderr); }
149150
if (err) { process.stderr.write(`${err.name}: ${err.message}\n`); }
150151

151-
const code = typeof errOrResult.code === 'number' ? errOrResult.code :
152-
err ? 1 : 0;
152+
const code = typeof errOrResult.code === 'number' ? errOrResult.code
153+
: err ? 1 : 0;
153154
process.exit(code);
154155
});
155156
}

index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ function gitBranchIs(branchNameOrTest, options, callback) {
7575

7676
let result;
7777
try {
78-
result = currentBranch === branchNameOrTest ||
79-
(typeof branchNameOrTest === 'function' &&
80-
branchNameOrTest(currentBranch));
78+
result = currentBranch === branchNameOrTest
79+
|| (typeof branchNameOrTest === 'function'
80+
&& branchNameOrTest(currentBranch));
8181
} catch (errTest) {
8282
callback(errTest);
8383
return;
@@ -129,9 +129,9 @@ gitBranchIs.getBranch = function getBranch(options, callback) {
129129
combinedOpts[prop] = options[prop];
130130
});
131131

132-
const gitArgs = combinedOpts.gitArgs ?
133-
Array.prototype.slice.call(combinedOpts.gitArgs, 0) :
134-
[];
132+
const gitArgs = combinedOpts.gitArgs
133+
? Array.prototype.slice.call(combinedOpts.gitArgs, 0)
134+
: [];
135135
if (combinedOpts.gitDir) {
136136
gitArgs.unshift(`--git-dir=${combinedOpts.gitDir}`);
137137
}

test/git-branch-is-cmd.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,18 @@
55

66
'use strict';
77

8-
const gitBranchIsCmd = require('../bin/git-branch-is');
98

109
const BBPromise = require('bluebird').Promise;
1110
// eslint-disable-next-line no-undef
1211
const PPromise = typeof Promise === 'function' ? Promise : BBPromise;
1312
const assert = require('assert');
14-
const assertMatch = require('../test-lib/assert-match');
15-
const constants = require('../test-lib/constants');
1613
const execFile = require('child_process').execFile;
1714
const path = require('path');
1815

16+
const assertMatch = require('../test-lib/assert-match');
17+
const constants = require('../test-lib/constants');
18+
const gitBranchIsCmd = require('../bin/git-branch-is');
19+
1920
/** Initial command arguments. */
2021
const ARGS = [process.argv[0], 'git-branch-is'];
2122

@@ -106,8 +107,8 @@ describe('git-branch-is', () => {
106107
});
107108

108109
it('exit 0 silently for matching i regex branch name', (done) => {
109-
const args =
110-
ARGS.concat('-i', '-r', `^${BRANCH_CURRENT.toUpperCase()}$`);
110+
const args
111+
= ARGS.concat('-i', '-r', `^${BRANCH_CURRENT.toUpperCase()}$`);
111112
gitBranchIsCmd(args, (err, result) => {
112113
assert.ifError(err);
113114
assert.strictEqual(result.code, 0);
@@ -370,8 +371,8 @@ describe('git-branch-is', () => {
370371
() => {
371372
gitBranchIsCmd(ARGS.concat(BRANCH_CURRENT));
372373
},
373-
(err) => err instanceof TypeError &&
374-
/\bcallback\b/.test(err.message)
374+
(err) => err instanceof TypeError
375+
&& /\bcallback\b/.test(err.message)
375376
);
376377
});
377378
});

test/git-branch-is.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ const BBPromise = require('bluebird').Promise;
1111
// eslint-disable-next-line no-undef
1212
const PPromise = typeof Promise === 'function' ? Promise : BBPromise;
1313
const assert = require('assert');
14+
const path = require('path');
15+
1416
const assertMatch = require('../test-lib/assert-match');
1517
const constants = require('../test-lib/constants');
16-
const path = require('path');
1718

1819
// Local copy of shared constants
1920
const BRANCH_CURRENT = constants.BRANCH_CURRENT;

test/global-hooks.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@
88
const BBPromise = require('bluebird').Promise;
99
// eslint-disable-next-line no-undef
1010
const PPromise = typeof Promise === 'function' ? Promise : BBPromise;
11-
const constants = require('../test-lib/constants');
1211
const fs = require('fs');
13-
const git = require('../test-lib/git');
1412
const path = require('path');
1513
const pify = require('pify');
1614
const rimraf = require('rimraf');
1715

16+
const git = require('../test-lib/git');
17+
const constants = require('../test-lib/constants');
18+
1819
const fsP = pify(fs, PPromise);
1920
const rimrafP = pify(rimraf, PPromise);
2021

0 commit comments

Comments
 (0)