enable eqeqeq rule
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Dan Allen · committed by Dan Allen · parent 4c9b4b8 · Browse files · 2 files·+17 added−18 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
2 files+17 added−18 removed
- other:+17 added−18 removed
Provenance
- Commit
cdb7a95- Tree
801bf83- Author
Dan Allen <dan.j.allen@gmail.com>- Committer
Dan Allen <dan.j.allen@gmail.com>- Parent
4c9b4b8
2 files changed+17 added−18 removed
modified:.eslintrc-1 removed
1 {2 "extends": "standard",3 "rules": {4- "eqeqeq": "off",4 "one-var": "off",5 "semi": ["error", "always", { "omitLastInOneLineBlock": true }],6 "space-before-function-paren": ["error", "never"],7 }1 unmodified linemodified:index.js+17 added-17 removed
84 unmodified lines85 * @api private86 */87 88 Option.prototype.is = function(arg) {89- return arg == this.short || arg == this.long;89+ return this.short === arg || this.long === arg;90 };91 92 /**93 * Initialize a new `Command`.282 unmodified lines376 oname = option.name(),377 name = option.attributeName();378 379 // default as 3rd arg380- if (typeof fn != 'function') {380+ if (typeof fn !== 'function') {381 if (fn instanceof RegExp) {382 var regex = fn;383 fn = function(val, def) {384 var m = regex.exec(val);5 unmodified lines390 }391 }392 393 // preassign default value only for --no-*, [optional], or <required>394- if (option.bool == false || option.optional || option.required) {394+ if (!option.bool || option.optional || option.required) {395 // when --no-* we make sure default is true396- if (option.bool == false) defaultValue = true;396+ if (!option.bool) defaultValue = true;397 // preassign only if we have a default398- if (undefined !== defaultValue) {398+ if (defaultValue !== undefined) {399 self[name] = defaultValue;400 option.defaultValue = defaultValue;401 }402 }80 unmodified lines483 return command.alias() === name;484 })[0];485 }486 487- if (this._execs[name] && typeof this._execs[name] != 'function') {487+ if (this._execs[name] && typeof this._execs[name] !== 'function') {488 return this.executeSubCommand(argv, args, parsed.unknown);489 } else if (aliasCommand) {490 // is alias of a subCommand491 args[0] = aliasCommand._name;19 unmodified lines511 Command.prototype.executeSubCommand = function(argv, args, unknown) {512 args = args.concat(unknown);513 514 if (!args.length) this.help();515- if (args[0] == 'help' && args.length === 1) this.help();515+ if (args[0] === 'help' && args.length === 1) this.help();516 517 // <cmd> --help518- if (args[0] == 'help') {518+ if (args[0] === 'help') {519 args[0] = args[1];520 args[1] = '--help';521 }522 52 unmodified lines575 });576 });577 proc.on('close', process.exit.bind(process));578 proc.on('error', function(err) {579- if (err.code == 'ENOENT') {579+ if (err.code === 'ENOENT') {580 console.error('\n %s(1) does not exist, try --help\n', bin);581- } else if (err.code == 'EACCES') {581+ } else if (err.code === 'EACCES') {582 console.error('\n %s(1) not executable. try chmod or run with root\n', bin);583 }584 process.exit(1);585 });29 unmodified lines615 ret = ret.concat(args.slice(i));616 break;617 } else if (lastOpt && lastOpt.required) {618 ret.push(arg);619- } else if (arg.length > 1 && arg[0] == '-' && arg[1] != '-') {619+ } else if (arg.length > 1 && arg[0] === '-' && arg[1] !== '-') {620 arg.slice(1).split('').forEach(function(c) {621 ret.push('-' + c);622 });623 } else if (/^--/.test(arg) && ~(index = arg.indexOf('='))) {84 unmodified lines708 args.push(arg);709 continue;710 }711 712- if (arg == '--') {712+ if (arg === '--') {713 literal = true;714 continue;715 }716 9 unmodified lines726 this.emit('option:' + option.name(), arg);727 // optional arg728 } else if (option.optional) {729 arg = argv[i + 1];730- if (arg == null || (arg[0] == '-' && arg != '-')) {730+ if (arg == null || (arg[0] === '-' && arg !== '-')) {731 arg = null;732 } else {733 ++i;734 }5 unmodified lines740 continue;741 }742 743 // looks like an option744- if (arg.length > 1 && arg[0] == '-') {744+ if (arg.length > 1 && arg[0] === '-') {745 unknownOptions.push(arg);746 747 // If the next argument looks like it might be748 // an argument for this option, we pass it on.749 // If it isn't, then it'll simply be ignored750- if (argv[i + 1] && argv[i + 1][0] != '-') {750+ if (argv[i + 1] && argv[i + 1][0] !== '-') {751 unknownOptions.push(argv[++i]);752 }753 continue;754 }206 unmodified lines961 962 // Append the help information963 return this.options.map(function(option) {964 return pad(option.flags, width) + ' ' + option.description +965- ((option.bool != false && option.defaultValue !== undefined) ? ' (default: ' + option.defaultValue + ')' : '');965+ ((option.bool && option.defaultValue !== undefined) ? ' (default: ' + option.defaultValue + ')' : '');966 }).concat([pad('-h, --help', width) + ' ' + 'output usage information'])967 .join('\n');968 };969 149 unmodified lines1119 1120 function outputHelpIfNecessary(cmd, options) {1121 options = options || [];1122 for (var i = 0; i < options.length; i++) {1123- if (options[i] == '--help' || options[i] == '-h') {1123+ if (options[i] === '--help' || options[i] === '-h') {1124 cmd.outputHelp();1125 process.exit(0);1126 }1127 }28 unmodified lines