Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

Commit

Permalink
Upgrade eslint-config-google to 0.7.0 (#161)
Browse files Browse the repository at this point in the history
* Upgrade eslint-config-google to 0.7.0

* Update index.js

* Drop var

* Update index.js

* Update .eslintrc.yml

* Update index.js

* Update index.js

* Update fibonacci.js
  • Loading branch information
rarkins committed Oct 26, 2016
1 parent 467580b commit 0928d9f
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 34 deletions.
1 change: 1 addition & 0 deletions .eslintrc.yml
Expand Up @@ -18,6 +18,7 @@ plugins:

env:
node: true
es6: true

rules:
eqeqeq: [error, smart]
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -12,7 +12,7 @@
"dockerfile_lint": "0.2.4",
"doiuse": "2.5.0",
"eslint": "3.8.1",
"eslint-config-google": "0.6.0",
"eslint-config-google": "0.7.0",
"eslint-config-strict": "9.1.0",
"eslint-config-xo-react": "0.10.0",
"eslint-plugin-angular": "1.4.1",
Expand Down
62 changes: 31 additions & 31 deletions src/index.js
@@ -1,21 +1,21 @@
/* eslint-disable no-sync */

var fs = require('fs');
var chalk = require('chalk');
var yaml = require('js-yaml');
var logSymbols = require('log-symbols');
var spawn = require('child_process').spawn;
var pkg = require('/package.json');
const fs = require('fs');
const chalk = require('chalk');
const yaml = require('js-yaml');
const logSymbols = require('log-symbols');
const spawn = require('child_process').spawn;
const pkg = require('/package.json');

var lintPackages = Object.keys(pkg.dependencies).concat(
const lintPackages = Object.keys(pkg.dependencies).concat(
'markdownlint', // npm markdownlint-cli
'yamllint', // pip
'proselint', // pip
'scss-lint' // gem
);

/* eslint-disable no-console */
var logger = {
const logger = {
error: function(msg) {
console.error(chalk.bgRed(msg));
},
Expand All @@ -27,11 +27,26 @@ var logger = {
},
fail: function(msg) {
console.log(logSymbols.error, chalk.red(msg));
}
},
};
/* eslint-enable no-console */

var configFile = null;
function run(command) {
return new Promise(function(resolve) {
logger.info(`\nRunning "${command}"`);
const child = spawn('/bin/sh', ['-c', command], { stdio: 'inherit' });
child.on('error', function(err) {
logger.error(err);
resolve(255); // eslint-disable-line no-magic-numbers
});
child.on('exit', function(code) {
logger.info(`\nFinished "${command}" (code=${code})\n`);
resolve(code);
});
});
}

let configFile = null;
try {
configFile = fs.readFileSync('lint-condo.yaml', 'utf-8');
} catch (err1) {
Expand All @@ -42,11 +57,11 @@ try {
process.exit(1);
}
}
var config = yaml.load(configFile);
const config = yaml.load(configFile);

var queue = Promise.resolve();
var statuses = {};
var exitCode = 0;
let queue = Promise.resolve();
const statuses = {};
let exitCode = 0;

config.linters.forEach(function(linter) {
queue = queue.then(function() {
Expand All @@ -61,8 +76,8 @@ queue
.then(function() {
logger.info('\nSummary:');
Object.keys(statuses).forEach(function(command) {
var printedCommand = command;
var firstWord = command.substr(0, command.indexOf(' '));
let printedCommand = command;
const firstWord = command.substr(0, command.indexOf(' '));
if (lintPackages.indexOf(firstWord) !== -1) {
printedCommand = firstWord;
}
Expand All @@ -78,18 +93,3 @@ queue
logger.error(err.stack);
process.exit(1);
});

function run(command) {
return new Promise(function(resolve) {
logger.info(`\nRunning "${command}"`);
var child = spawn('/bin/sh', ['-c', command], {stdio: 'inherit'});
child.on('error', function(err) {
logger.error(err);
resolve(255); // eslint-disable-line no-magic-numbers
});
child.on('exit', function(code) {
logger.info(`\nFinished "${command}" (code=${code})\n`);
resolve(code);
});
});
}
4 changes: 2 additions & 2 deletions test/fixture/fibonacci.js
@@ -1,10 +1,10 @@

module.exports = function fibonacci(n) {
var fib = []; // Initialize array!
const fib = []; // Initialize array!

fib[0] = 0;
fib[1] = 1;
for (var i = 2; i <= n; i++) {
for (let i = 2; i <= n; i++) {
// Next fibonacci number = previous + one before previous
// Translated to JavaScript:
fib[i] = fib[i - 2] + fib[i - 1];
Expand Down

0 comments on commit 0928d9f

Please sign in to comment.