Skip to content

Commit 667c94b

Browse files
committed
Style fixes for new ESLint rules
Signed-off-by: Kevin Locke <[email protected]>
1 parent 107c458 commit 667c94b

File tree

6 files changed

+23
-22
lines changed

6 files changed

+23
-22
lines changed

bin/git-branch-is.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
'use strict';
88

9-
const Command = require('commander').Command;
9+
const {Command} = require('commander');
1010

1111
const gitBranchIs = require('..');
1212
const packageJson = require('../package.json');

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
'use strict';
77

8-
const execFile = require('child_process').execFile;
8+
const {execFile} = require('child_process');
99

1010
/** Options for {@link gitBranchIs}.
1111
*

test-lib/git.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,27 @@
55

66
'use strict';
77

8-
const execFile = require('child_process').execFile;
8+
const {execFile} = require('child_process');
99
const pify = require('pify');
1010

1111
const execFileP = pify(execFile, {multiArgs: true});
1212

1313
/**
1414
* Run git with given arguments and options.
15+
* @param {...string} args Arguments to pass to git. Last argument may be an
16+
* options object.
1517
* @return {Promise} Promise with the process output or Error for non-0 exit.
1618
*/
17-
function git(/* [args...], [options] */) {
19+
function git(...args) {
1820
// Default to redirecting stdin (to prevent unexpected prompts) and
1921
// including any output with test output
2022
const defaultStdio = ['ignore', process.stdout, process.stderr];
2123

22-
let args, options;
23-
if (typeof arguments[arguments.length - 1] === 'object') {
24-
args = Array.prototype.slice.call(arguments);
24+
let options;
25+
if (typeof args[args.length - 1] === 'object') {
2526
options = args.pop();
2627
options.stdio = options.stdio || defaultStdio;
2728
} else {
28-
// Note: execFile/spawn requires Array type for arguments
29-
args = Array.prototype.slice.call(arguments);
3029
options = {
3130
stdio: defaultStdio
3231
};

test/git-branch-is-cmd.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88

99
const assert = require('assert');
10-
const execFile = require('child_process').execFile;
10+
const {execFile} = require('child_process');
1111
const path = require('path');
1212

1313
const assertMatch = require('../test-lib/assert-match');
@@ -18,9 +18,7 @@ const gitBranchIsCmd = require('../bin/git-branch-is');
1818
const ARGS = [process.argv[0], 'git-branch-is'];
1919

2020
// Local copy of shared constants
21-
const BRANCH_CURRENT = constants.BRANCH_CURRENT;
22-
const SUBDIR_NAME = constants.SUBDIR_NAME;
23-
const TEST_REPO_PATH = constants.TEST_REPO_PATH;
21+
const {BRANCH_CURRENT, SUBDIR_NAME, TEST_REPO_PATH} = constants;
2422

2523
const BRANCH_CURRENT_RE = new RegExp(`\\b${constants.BRANCH_CURRENT}\\b`);
2624

test/git-branch-is.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@ const assertMatch = require('../test-lib/assert-match');
1414
const constants = require('../test-lib/constants');
1515

1616
// Local copy of shared constants
17-
const BRANCH_CURRENT = constants.BRANCH_CURRENT;
18-
const BRANCH_NON_EXISTENT = constants.BRANCH_NON_EXISTENT;
19-
const BRANCH_SAME_COMMIT = constants.BRANCH_SAME_COMMIT;
20-
const SUBDIR_NAME = constants.SUBDIR_NAME;
21-
const TEST_REPO_PATH = constants.TEST_REPO_PATH;
17+
const {
18+
BRANCH_CURRENT,
19+
BRANCH_NON_EXISTENT,
20+
BRANCH_SAME_COMMIT,
21+
SUBDIR_NAME,
22+
TEST_REPO_PATH
23+
} = constants;
2224

2325
describe('gitBranchIs', () => {
2426
it('callback true for current branch name', (done) => {

test/global-hooks.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@ const fsP = pify(fs);
1717
const rimrafP = pify(rimraf);
1818

1919
// Local copy of shared constants
20-
const BRANCH_CURRENT = constants.BRANCH_CURRENT;
21-
const BRANCH_SAME_COMMIT = constants.BRANCH_SAME_COMMIT;
22-
const SUBDIR_NAME = constants.SUBDIR_NAME;
23-
const TEST_REPO_PATH = constants.TEST_REPO_PATH;
20+
const {
21+
BRANCH_CURRENT,
22+
BRANCH_SAME_COMMIT,
23+
SUBDIR_NAME,
24+
TEST_REPO_PATH
25+
} = constants;
2426

2527
// Global variables
2628
let origCWD;

0 commit comments

Comments
 (0)