Skip to content

Commit

Permalink
[Dev Deps] update eslint, @ljharb/eslint-config, eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Dec 6, 2021
1 parent bd3fac2 commit b3bd23a
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 112 deletions.
17 changes: 1 addition & 16 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
{
"root": true,

"extends": "@ljharb",

"env": {
"node": true
},
"extends": "@ljharb/eslint-config/node/4",

"rules": {
"complexity": 0,
"dot-notation": [2, { "allowKeywords": true }],
"func-name-matching": 1,
"func-style": 0,
"global-require": 1,
Expand All @@ -20,19 +15,9 @@
"max-statements": [2, 14],
"max-statements-per-line": [2, { "max": 2 }],
"new-cap": [2, { "capIsNewExceptions": ["Range"] }],
"no-console": 0,
"no-magic-numbers": 0,
"no-use-before-define": 1,
"operator-linebreak": [2, "before"],
"sort-keys": 0,
},

"overrides": [
{
"files": "bin/**",
"rules": {
"no-process-exit": 0,
},
},
],
}
26 changes: 13 additions & 13 deletions bin/salita
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@

'use strict';

var forEach = require('for-each');
const forEach = require('for-each');

var FALSE = Object(false);
var TRUE = Object(true);
const FALSE = Object(false);
const TRUE = Object(true);

var boolishToBool = function boolishToBool(value) {
const boolishToBool = function boolishToBool(value) {
if (value === FALSE) { return false; }
if (value === TRUE) { return true; }
return value;
};

/* eslint newline-per-chained-call: 0 */
var options = require('yargs')
const options = require('yargs')
.boolean('color').default('color', TRUE).describe('color', 'colorizes output')
.describe('no-color', 'prevents colorized output')
.boolean('json').describe('json', 'provides parseable JSON output (implies --no-color)')
Expand Down Expand Up @@ -51,7 +51,7 @@ var options = require('yargs')
})
.argv;

forEach(options, function (value, key) {
forEach(options, (value, key) => {
options[key] = boolishToBool(value);
});

Expand All @@ -65,19 +65,19 @@ if (options['dry-run'] || !options.update || options.check) {
}
if (options.json) { options.color = false; }

var salita = require('../');
const salita = require('../');

if (!options.update) {
console.warn('Running in dry-run mode. Use --update to persist changes to package.json.');
}

salita(process.cwd(), options, function (countsPromise) {
countsPromise.then(function (counts) {
var sums = counts.reduce(function (acc, category) { return [acc[0] + category[0], acc[1] + category[1]]; }, [0, 0]);
var total = sums[0];
var changed = sums[1];
salita(process.cwd(), options, (countsPromise) => {
countsPromise.then((counts) => {
const sums = counts.reduce((acc, category) => [acc[0] + category[0], acc[1] + category[1]], [0, 0]);
const total = sums[0];
const changed = sums[1];
if (!options.json) {
console.error('\n' + changed + ' updated out of ' + total + ' total dependencies.');
console.error(`\n${changed} updated out of ${total} total dependencies.`);
}
if (options.check) { process.exit(changed); }
});
Expand Down
Loading

0 comments on commit b3bd23a

Please sign in to comment.