Skip to content

Commit

Permalink
ESLint auto-fixes (changed single quotes to double quotes)
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesMessinger committed Dec 10, 2018
1 parent a8a4241 commit f717809
Show file tree
Hide file tree
Showing 10 changed files with 261 additions and 260 deletions.
3 changes: 2 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ root = true
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
end_of_line = lf

# 2 space indentation
indent_style = space
indent_size = 2

# JavaScript-specific settings
[*.js]
quote_type = single
quote_type = double
continuation_indent_size = 2
curly_bracket_next_line = false
indent_brace_style = BSD
Expand Down
4 changes: 2 additions & 2 deletions bin/globify.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env node
'use strict';
"use strict";

const globify = require('../');
const globify = require("../");
globify(process.argv.slice(2));
18 changes: 9 additions & 9 deletions lib/helpers.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict';
"use strict";

const path = require('path');
const mkdirp = require('mkdirp');
const touch = require('touch');
const path = require("path");
const mkdirp = require("mkdirp");
const touch = require("touch");

/**
* Determines the base directory of the given glob pattern.
Expand All @@ -19,7 +19,7 @@ exports.getBaseDir = function getBaseDir (pattern) {
// - dir/subdir/index.js => dir/subdir
// - dir/subdir/index.(js|coffee) => dir/subdir

let wildcard = pattern.indexOf('*');
let wildcard = pattern.indexOf("*");
if (wildcard >= 0) {
pattern = pattern.substr(0, wildcard + 1);
}
Expand All @@ -34,12 +34,12 @@ exports.getBaseDir = function getBaseDir (pattern) {
*/
exports.isDirectory = function isDirectory (pattern) {
let basename = path.basename(pattern);
if (basename.indexOf('*') >= 0) {
if (basename.indexOf("*") >= 0) {
// The pattern includes a filename pattern (e.g. "dist/*.min.js"),
// which counts as a directory path
return true;
}
else if (basename.indexOf('.') === -1) {
else if (basename.indexOf(".") === -1) {
// The pattern has no file extension, so assume it's a directory
return true;
}
Expand Down Expand Up @@ -68,12 +68,12 @@ exports.rename = function rename (prefix, pattern, file, baseDir) {

let patternFileName = path.basename(pattern); // *.min.js
let patternDir;
if (patternFileName.indexOf('*') === -1) {
if (patternFileName.indexOf("*") === -1) {
patternDir = pattern; // dest
}
else {
patternDir = exports.getBaseDir(pattern); // dest
fileExtName = patternFileName.substr(patternFileName.indexOf('*') + 1); // .min.js
fileExtName = patternFileName.substr(patternFileName.indexOf("*") + 1); // .min.js
}

let outputDir = path.join(patternDir, relativeDir); // dest/subdir
Expand Down
10 changes: 5 additions & 5 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';
"use strict";

const childProcess = require('child_process');
const ParsedArgs = require('./parsed-args');
const childProcess = require("child_process");
const ParsedArgs = require("./parsed-args");

module.exports = globify;

Expand Down Expand Up @@ -46,6 +46,6 @@ function globify (args) {
* @param {string[]} args - The command-line arguments to pass
*/
function browserify (cmd, args) {
console.log(cmd, args.join(' '));
childProcess.fork(require.resolve(cmd + '/bin/cmd'), args.slice());
console.log(cmd, args.join(" "));
childProcess.fork(require.resolve(cmd + "/bin/cmd"), args.slice());
}
36 changes: 18 additions & 18 deletions lib/parsed-args.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* eslint complexity:1 */
'use strict';
"use strict";

const glob = require('glob');
const globby = require('globby');
const helpers = require('./helpers');
const glob = require("glob");
const globby = require("globby");
const helpers = require("./helpers");

module.exports = ParsedArgs;

Expand All @@ -18,14 +18,14 @@ function ParsedArgs (args) {
* The command to run ("browserify" or "watchify")
* @type {string}
*/
this.cmd = 'browserify';
this.cmd = "browserify";

/**
* The base directory for the entry-file glob pattern.
* See {@link helpers#getBaseDir} for details.
* @type {string}
*/
this.baseDir = '';
this.baseDir = "";

/**
* Options for how the entry-file glob pattern should be parsed.
Expand Down Expand Up @@ -77,7 +77,7 @@ function ParsedArgs (args) {
* @returns {boolean}
*/
function parseOutfile (args, parsed) {
let arg = parseNameValueArg(args, parsed, '-o', '--outfile');
let arg = parseNameValueArg(args, parsed, "-o", "--outfile");

if (arg) {
if (helpers.isDirectory(arg.value)) {
Expand All @@ -104,7 +104,7 @@ function parseOutfile (args, parsed) {
* @returns {boolean}
*/
function parseExclude (args, parsed) {
let arg = parseNameValueArg(args, parsed, '-u', '--exclude');
let arg = parseNameValueArg(args, parsed, "-u", "--exclude");

if (arg) {
parsed.globOptions.ignore.push(arg.value);
Expand All @@ -124,9 +124,9 @@ function parseExclude (args, parsed) {
function parseWatch (args, parsed) {
let arg = args[0];

if (arg === '-w' || arg === '--watch') {
if (arg === "-w" || arg === "--watch") {
args.shift();
parsed.cmd = 'watchify';
parsed.cmd = "watchify";
return true;
}
}
Expand All @@ -142,8 +142,8 @@ function parseWatch (args, parsed) {
function parseSubArgs (args, parsed) {
let arg = args[0];

if (arg === '[') {
while (arg !== ']') {
if (arg === "[") {
while (arg !== "]") {
arg = args.shift();
parsed.args.push(arg);
}
Expand All @@ -162,7 +162,7 @@ function parseSubArgs (args, parsed) {
function parseDashArgs (args, parsed) {
let arg = args[0];

if (arg[0] === '-') {
if (arg[0] === "-") {
parsed.args.push(args.shift());
return true;
}
Expand All @@ -180,7 +180,7 @@ function parseGlobs (args, parsed) {
let patterns = [];

if (parsed.globIndex === -1 && glob.hasMagic(args[0])) {
while (args[0] && args[0][0] !== '-') {
while (args[0] && args[0][0] !== "-") {
// We found an entry file glob pattern
let pattern = args.shift();
patterns.push(pattern);
Expand Down Expand Up @@ -235,13 +235,13 @@ function parseNameValueArg (args, parsed, shortName, longName) {
* the part before the value (e.g. "--outfile=", "--exclude=", etc.)
* @type {string}
*/
prefix: '',
prefix: "",

/**
* The argument value.
* @type {string}
*/
value: ''
value: ""
};

// Check for space-separated name/value
Expand All @@ -255,8 +255,8 @@ function parseNameValueArg (args, parsed, shortName, longName) {
}

// Check for name/value joined by "="
shortName += '=';
longName += '=';
shortName += "=";
longName += "=";
if (arg.indexOf(shortName) === 0) {
parsedArg.prefix = shortName;
}
Expand Down
22 changes: 11 additions & 11 deletions test/fixtures/helper.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
'use strict';
"use strict";

const expect = require('chai').expect;
const sinon = require('sinon');
const path = require('path');
const childProcess = require('child_process');
const expect = require("chai").expect;
const sinon = require("sinon");
const path = require("path");
const childProcess = require("child_process");

const originalLogMethod = console.log;

module.exports = { assert };

// Run all the tests from the "sample-package" directory
process.chdir(path.join(__dirname, '../', 'sample-package'));
process.chdir(path.join(__dirname, "../", "sample-package"));

beforeEach(() => {
sinon.stub(childProcess, 'fork');
sinon.stub(console, 'log').callsFake(captureLogs);
sinon.stub(childProcess, "fork");
sinon.stub(console, "log").callsFake(captureLogs);
});

afterEach(() => {
Expand All @@ -36,11 +36,11 @@ function assert (cmd, calls) {
let log = console.log.getCall(index);
expect(log.args).to.have.lengthOf(2);
expect(log.args[0]).to.equal(cmd);
expect(log.args[1]).to.equal(args.join(' '));
expect(log.args[1]).to.equal(args.join(" "));

let exec = childProcess.fork.getCall(index);
expect(exec.args).to.have.lengthOf(2);
expect(exec.args[0]).to.equal(require.resolve(cmd + '/bin/cmd'));
expect(exec.args[0]).to.equal(require.resolve(cmd + "/bin/cmd"));
expect(exec.args[1]).to.deep.equal(args);
});
}
Expand All @@ -49,7 +49,7 @@ function assert (cmd, calls) {
* Suppresses certain console logs, to avoid cluttering the test results
*/
function captureLogs () {
if (arguments[0] === 'browserify' || arguments[0] === 'watchify') {
if (arguments[0] === "browserify" || arguments[0] === "watchify") {
// suppress this output, so we don't clutter the test results
}
else {
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/mocha.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict';
"use strict";

// Mocha configuration
beforeEach(function () {
Expand Down

0 comments on commit f717809

Please sign in to comment.