Permalink
Browse files

make eslint happy

  • Loading branch information...
1 parent 16c9b8b commit 513048617d6c02be4a5bc4a31f8e9a26a1aef65d @fgnass committed May 30, 2016
Showing with 12 additions and 14 deletions.
  1. +7 −4 lib/hook.js
  2. +3 −2 package.json
  3. +1 −1 test/fixture/uncaughtExceptionHandler.js
  4. +1 −7 test/index.js
View
@@ -22,7 +22,10 @@ module.exports = function (cfg, wrapper, callback) {
if (!orig) return;
obj[method] = function () {
var opts = arguments[optionsArgIndex];
- var file = typeof opts == 'string' ? opts : opts.filename;
+ var file = null;
+ if (opts) {
+ file = typeof opts == 'string' ? opts : opts.filename;
+ }
if (file) callback(file);
return orig.apply(this, arguments);
};
@@ -32,12 +35,12 @@ module.exports = function (cfg, wrapper, callback) {
* (Re-)install hooks for all registered file extensions.
*/
function updateHooks() {
- for (var ext in require.extensions) {
+ Object.keys(require.extensions).forEach(function (ext) {
var fn = require.extensions[ext];
- if (fn.name !== 'nodeDevHook') {
+ if (typeof fn === 'function' && fn.name !== 'nodeDevHook') {
require.extensions[ext] = createHook(fn);
}
- }
+ });
}
/**
View
@@ -1,6 +1,6 @@
{
"name": "node-dev",
- "version": "3.1.1",
+ "version": "3.1.2",
"description": "Restarts your app when files are modified",
"keywords": [
"restart",
@@ -40,7 +40,8 @@
"devDependencies": {
"coffee-script": "^1.8.0",
"eslint": "^2.0.0",
- "eslint-config-airbnb": "^8.0.0",
+ "eslint-config-airbnb-base": "^3.0.1",
+ "eslint-plugin-import": "^1.8.1",
"tap": "^5.2.0",
"touch": "^1.0.0"
}
@@ -4,5 +4,5 @@ process.on('uncaughtException', function (e) {
}, 100);
});
-/* eslint-disable no-undef */
+// eslint-disable-next-line no-undef
foo(); // undefined / throws exception
View
@@ -1,21 +1,15 @@
-var fs = require('fs');
var child = require('child_process');
var test = require('tap').test;
var touch = require('touch');
var dir = __dirname + '/fixture';
var bin = __dirname + '/../bin/node-dev';
var msgFile = dir + '/message.js';
-var ignoredFile = dir + '/ignoredModule.js';
-
-
-// Constants
-var MESSAGE = fs.readFileSync(msgFile).toString();
// Helpers
function touchFile(file) {
return function () {
- touch.sync(file ? file : msgFile);
+ touch.sync(file || msgFile);
};
}

0 comments on commit 5130486

Please sign in to comment.