Skip to content

Commit

Permalink
add XO
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Oct 31, 2015
1 parent 2c2c775 commit fcbd65e
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 31 deletions.
16 changes: 0 additions & 16 deletions .jshintrc

This file was deleted.

2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
sudo: false
language: node_js
node_js:
- 'iojs'
- 'stable'
- '0.12'
- '0.10'
before_script:
Expand Down
4 changes: 2 additions & 2 deletions lib/message.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ Object.keys(chalk.styles).forEach(function (style) {
});

exports.get = function (message, data) {
var fileTemplate = fs.readFileSync(path.join(__dirname, '/messages', message + '.twig'), 'utf8');
return Twig.twig({data: fileTemplate}).render(data);
var fileTemplate = fs.readFileSync(path.join(__dirname, 'messages', message + '.twig'), 'utf8');
return Twig.twig({data: fileTemplate}).render(data);
};
1 change: 1 addition & 0 deletions lib/rules/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable dot-notation */
'use strict';
exports['bowerrc-home'] = require('./bowerrc-home');
exports['global_config'] = require('./global_config');
Expand Down
7 changes: 4 additions & 3 deletions lib/rules/node_path.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@ function fixPath(filepath) {
}

exports.verify = function (cb) {
if (process.env.NODE_PATH == null) {
return cb(null);
if (process.env.NODE_PATH === undefined) {
cb(null);
return;
}

var nodePaths = (process.env.NODE_PATH || '').split(path.delimiter).map(fixPath);

childProcess.exec('npm -g root --silent', function (err, stdout, stderr) {
childProcess.exec('npm -g root --silent', function (err, stdout) {
if (err) {
cb(errors.npmFailure());
return;
Expand Down
15 changes: 11 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"name": "yeoman-doctor",
"version": "1.4.0",
"main": "lib/index.js",
"description": "Detect potential issues with users system that could prevent Yeoman from working correctly",
"license": "BSD-2-Clause",
"author": "Yeoman",
"repository": "yeoman/doctor",
"main": "lib/index.js",
"bin": {
"yodoctor": "lib/cli.js"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "jshint **/*.js && mocha test/** -R spec"
"test": "xo && mocha test/** -R spec"
},
"files": [
"lib"
Expand All @@ -40,8 +40,15 @@
"user-home": "^2.0.0"
},
"devDependencies": {
"jshint": "^2.5.6",
"mocha": "^2.0.1",
"sinon": "^1.12.1"
"sinon": "^1.12.1",
"xo": "*"
},
"xo": {
"space": true,
"envs": [
"node",
"mocha"
]
}
}
2 changes: 1 addition & 1 deletion test/rule-bowerrc-home.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe('global .bowerrc rule', function () {
var mock = this.sandbox.mock(fs);
mock.expects('exists').once().withArgs(rule.bowerrcPath).yields(true);

rule.verify(function(error) {
rule.verify(function (error) {
assert.equal(error, rule.errors.fileExists());
mock.verify();
done();
Expand Down
8 changes: 4 additions & 4 deletions test/rule-node_path.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
var assert = require('assert');
var path = require('path');
var sinon = require('sinon');
var child_process = require('child_process');
var childProcess = require('child_process');
var rule = require('../lib/rules/node_path');

describe('NODE_PATH rule', function () {
Expand All @@ -17,7 +17,7 @@ describe('NODE_PATH rule', function () {
});

it('pass if npm root is contained in NODE_PATH', function (done) {
this.sandbox.stub(child_process, 'exec').yields(null, ' node-fake-path/foo\n');
this.sandbox.stub(childProcess, 'exec').yields(null, ' node-fake-path/foo\n');

process.env.NODE_PATH = 'node-fake-path/foo';
rule.verify(function (error) {
Expand All @@ -36,7 +36,7 @@ describe('NODE_PATH rule', function () {

it('fail if the npm call throw', function (done) {
process.env.NODE_PATH = 'some-path';
this.sandbox.stub(child_process, 'exec').yields(new Error());
this.sandbox.stub(childProcess, 'exec').yields(new Error());

rule.verify(function (error) {
assert.equal(error, rule.errors.npmFailure());
Expand All @@ -45,7 +45,7 @@ describe('NODE_PATH rule', function () {
});

it('fail if the paths mismatch', function (done) {
this.sandbox.stub(child_process, 'exec').yields(null, 'node-fake-path/foo');
this.sandbox.stub(childProcess, 'exec').yields(null, 'node-fake-path/foo');

process.env.NODE_PATH = 'node-fake-path/bar';

Expand Down

0 comments on commit fcbd65e

Please sign in to comment.