Skip to content

Commit 8203e26

Browse files
committed
Update eslint & remove jscs
1 parent 4dfcef3 commit 8203e26

File tree

5 files changed

+30
-25
lines changed

5 files changed

+30
-25
lines changed

.eslintrc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
{
2-
"extends": "gulp"
2+
"root": true,
3+
"extends": [
4+
"gulp",
5+
"standard"
6+
]
37
}

.jscsrc

Lines changed: 0 additions & 3 deletions
This file was deleted.

index.js

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ var nonEnum = ['message', 'name', 'stack'];
88
var ignored = union(nonEnum, ['__safety', '_stack', 'plugin', 'showProperties', 'showStack']);
99
var props = ['fileName', 'lineNumber', 'message', 'name', 'plugin', 'showProperties', 'showStack', 'stack'];
1010

11-
function PluginError(plugin, message, options) {
11+
function PluginError (plugin, message, options) {
1212
if (!(this instanceof PluginError)) {
1313
throw new Error('Call PluginError using new');
1414
}
@@ -22,13 +22,13 @@ function PluginError(plugin, message, options) {
2222
var keys = union(Object.keys(opts.error), nonEnum);
2323

2424
// These properties are not enumerable, so we have to add them explicitly.
25-
keys.forEach(function(prop) {
25+
keys.forEach(function (prop) {
2626
self[prop] = opts.error[prop];
2727
});
2828
}
2929

3030
// Opts object can override
31-
props.forEach(function(prop) {
31+
props.forEach(function (prop) {
3232
if (prop in opts) {
3333
this[prop] = opts[prop];
3434
}
@@ -39,7 +39,6 @@ function PluginError(plugin, message, options) {
3939
this.name = 'Error';
4040
}
4141
if (!this.stack) {
42-
4342
/**
4443
* `Error.captureStackTrace` appends a stack property which
4544
* relies on the toString method of the object it is applied to.
@@ -50,10 +49,11 @@ function PluginError(plugin, message, options) {
5049
*/
5150

5251
var safety = {};
53-
safety.toString = function() {
52+
safety.toString = function () {
5453
return this._messageWithDetails() + '\nStack:';
5554
}.bind(this);
5655

56+
// eslint-disable-next-line no-caller
5757
Error.captureStackTrace(safety, arguments.callee || this.constructor);
5858
this.__safety = safety;
5959
}
@@ -71,7 +71,7 @@ util.inherits(PluginError, Error);
7171
* Output a formatted message with details
7272
*/
7373

74-
PluginError.prototype._messageWithDetails = function() {
74+
PluginError.prototype._messageWithDetails = function () {
7575
var msg = 'Message:\n ' + this.message;
7676
var details = this._messageDetails();
7777
if (details !== '') {
@@ -84,7 +84,7 @@ PluginError.prototype._messageWithDetails = function() {
8484
* Output actual message details
8585
*/
8686

87-
PluginError.prototype._messageDetails = function() {
87+
PluginError.prototype._messageDetails = function () {
8888
if (!this.showProperties) {
8989
return '';
9090
}
@@ -111,8 +111,8 @@ PluginError.prototype._messageDetails = function() {
111111
* Override the `toString` method
112112
*/
113113

114-
PluginError.prototype.toString = function() {
115-
var detailsWithStack = function(stack) {
114+
PluginError.prototype.toString = function () {
115+
var detailsWithStack = function (stack) {
116116
return this._messageWithDetails() + '\nStack:\n' + stack;
117117
}.bind(this);
118118

@@ -121,10 +121,8 @@ PluginError.prototype.toString = function() {
121121
// If there is no wrapped error, use the stack captured in the PluginError ctor
122122
if (this.__safety) {
123123
msg = this.__safety.stack;
124-
125124
} else if (this._stack) {
126125
msg = detailsWithStack(this._stack);
127-
128126
} else {
129127
// Stack from wrapped error
130128
msg = detailsWithStack(this.stack);
@@ -137,7 +135,7 @@ PluginError.prototype.toString = function() {
137135
};
138136

139137
// Format the output message
140-
function message(msg, thisArg) {
138+
function message (msg, thisArg) {
141139
var sig = colors.red(thisArg.name);
142140
sig += ' in plugin ';
143141
sig += '"' + colors.cyan(thisArg.plugin) + '"';
@@ -150,7 +148,7 @@ function message(msg, thisArg) {
150148
* Set default options based on arguments.
151149
*/
152150

153-
function setDefaults(plugin, message, opts) {
151+
function setDefaults (plugin, message, opts) {
154152
if (typeof plugin === 'object') {
155153
return defaults(plugin);
156154
}
@@ -176,10 +174,10 @@ function setDefaults(plugin, message, opts) {
176174
* @return {Object}
177175
*/
178176

179-
function defaults(opts) {
177+
function defaults (opts) {
180178
return extend({
181179
showStack: false,
182-
showProperties: true,
180+
showProperties: true
183181
}, opts);
184182
}
185183

package.json

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
"index.js"
2020
],
2121
"scripts": {
22-
"lint": "eslint . && jscs index.js test/",
23-
"pretest": "npm run lint",
22+
"lint:eslint": "eslint .",
23+
"pretest": "npm-run-all --parallel lint:*",
2424
"test": "mocha --async-only && npm run test-types",
2525
"test-types": "tsc -p test/types",
2626
"cover": "istanbul cover _mocha --report lcovonly",
@@ -33,14 +33,18 @@
3333
"extend-shallow": "^3.0.2"
3434
},
3535
"devDependencies": {
36-
"eslint": "^1.7.3",
36+
"eslint": "^4.16.0",
3737
"eslint-config-gulp": "^2.0.0",
38+
"eslint-config-standard": "^11.0.0-beta.0",
39+
"eslint-plugin-import": "^2.8.0",
40+
"eslint-plugin-node": "^5.2.1",
41+
"eslint-plugin-promise": "^3.6.0",
42+
"eslint-plugin-standard": "^3.0.1",
3843
"expect": "^1.20.2",
3944
"istanbul": "^0.4.3",
4045
"istanbul-coveralls": "^1.0.3",
41-
"jscs": "^2.3.5",
42-
"jscs-preset-gulp": "^1.0.0",
4346
"mocha": "^3.0.0",
47+
"npm-run-all": "^4.1.2",
4448
"typescript": "^2.6.2"
4549
},
4650
"keywords": [

test/.eslintrc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"extends": "gulp/test"
2+
"env": {
3+
"mocha": true
4+
}
35
}

0 commit comments

Comments
 (0)