Skip to content

Commit 001265c

Browse files
committed
tweak eslint settings
Drop the complexity to 32 and use the string constants which are self explanitory rather than the number constants when configuring eslintrc.
1 parent cc0a5fa commit 001265c

File tree

3 files changed

+29
-28
lines changed

3 files changed

+29
-28
lines changed

.eslintrc

+9-9
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@
1616
],
1717
"globals": { "Promise": true },
1818
"rules": {
19-
"strict": 0,
20-
"camelcase": [2, {"properties": "never"}],
21-
"quotes": [2, "single", "avoid-escape"],
22-
"no-underscore-dangle": 0,
23-
"no-useless-escape": 0,
24-
"complexity": [2, { "max": 35 }],
25-
"no-use-before-define": [0, { "functions": false }],
26-
"no-unused-vars": [2, { "argsIgnorePattern": "^_" }],
27-
"no-prototype-builtins": 0
19+
"strict": "off",
20+
"camelcase": ["error", {"properties": "never"}],
21+
"quotes": ["error", "single", "avoid-escape"],
22+
"no-underscore-dangle": "off",
23+
"no-useless-escape": "off",
24+
"complexity": ["error", {"max": 32}],
25+
"no-use-before-define": ["off", { "functions": false }],
26+
"no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
27+
"no-prototype-builtins": "off"
2828
}
2929
}

src/browser/shim.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ function _wrapInternalErr(f) {
77
return f.apply(this, arguments);
88
} catch (e) {
99
try {
10-
/* eslint-disable no-console */
10+
/* eslint-disable-next-line no-console */
1111
console.error('[Rollbar]: Internal error', e);
12-
/* eslint-enable no-console */
1312
} catch (e2) {
1413
// Ignore
1514
}

src/browser/telemetry.js

+19-17
Original file line numberDiff line numberDiff line change
@@ -120,41 +120,46 @@ Instrumenter.prototype.configure = function(options) {
120120
}
121121
};
122122

123-
// eslint-disable-next-line complexity
124123
Instrumenter.prototype.instrument = function(oldSettings) {
125-
if (this.autoInstrument.network && !(oldSettings && oldSettings.network)) {
124+
var network = oldSettings && oldSettings.network;
125+
if (this.autoInstrument.network && !network) {
126126
this.instrumentNetwork();
127-
} else if (!this.autoInstrument.network && oldSettings && oldSettings.network) {
127+
} else if (!this.autoInstrument.network && network) {
128128
this.deinstrumentNetwork();
129129
}
130130

131-
if (this.autoInstrument.log && !(oldSettings && oldSettings.log)) {
131+
var log = oldSettings && oldSettings.log;
132+
if (this.autoInstrument.log && !log) {
132133
this.instrumentConsole();
133-
} else if (!this.autoInstrument.log && oldSettings && oldSettings.log) {
134+
} else if (!this.autoInstrument.log && log) {
134135
this.deinstrumentConsole();
135136
}
136137

137-
if (this.autoInstrument.dom && !(oldSettings && oldSettings.dom)) {
138+
var dom = oldSettings && oldSettings.dom;
139+
if (this.autoInstrument.dom && !dom) {
138140
this.instrumentDom();
139-
} else if (!this.autoInstrument.dom && oldSettings && oldSettings.dom) {
141+
} else if (!this.autoInstrument.dom && dom) {
140142
this.deinstrumentDom();
141143
}
142144

143-
if (this.autoInstrument.navigation && !(oldSettings && oldSettings.navigation)) {
145+
var navigation = oldSettings && oldSettings.navigation;
146+
if (this.autoInstrument.navigation && !navigation) {
144147
this.instrumentNavigation();
145-
} else if (!this.autoInstrument.navigation && oldSettings && oldSettings.navigation) {
148+
} else if (!this.autoInstrument.navigation && navigation) {
146149
this.deinstrumentNavigation();
147150
}
148151

149-
if (this.autoInstrument.connectivity && !(oldSettings && oldSettings.connectivity)) {
152+
var connectivity = oldSettings && oldSettings.connectivity;
153+
if (this.autoInstrument.connectivity && !connectivity) {
150154
this.instrumentConnectivity();
151-
} else if (!this.autoInstrument.connectivity && oldSettings && oldSettings.connectivity) {
155+
} else if (!this.autoInstrument.connectivity && connectivity) {
152156
this.deinstrumentConnectivity();
153157
}
154158

155-
if (this.autoInstrument.contentSecurityPolicy && !(oldSettings && oldSettings.contentSecurityPolicy)) {
159+
var contentSecurityPolicy = oldSettings && oldSettings.contentSecurityPolicy;
160+
if (this.autoInstrument.contentSecurityPolicy && !contentSecurityPolicy) {
156161
this.instrumentContentSecurityPolicy();
157-
} else if (!this.autoInstrument.contentSecurityPolicy && oldSettings && oldSettings.contentSecurityPolicy) {
162+
} else if (!this.autoInstrument.contentSecurityPolicy && contentSecurityPolicy) {
158163
this.deinstrumentContentSecurityPolicy();
159164
}
160165
};
@@ -222,9 +227,7 @@ Instrumenter.prototype.instrumentNetwork = function() {
222227
}, this.replacements, 'network');
223228

224229
replace(xhrp, 'send', function(orig) {
225-
/* eslint-disable no-unused-vars */
226230
return function(data) {
227-
/* eslint-enable no-unused-vars */
228231
var xhr = this;
229232

230233
function onreadystatechangeHandler() {
@@ -331,9 +334,8 @@ Instrumenter.prototype.instrumentNetwork = function() {
331334

332335
if ('fetch' in this._window) {
333336
replace(this._window, 'fetch', function(orig) {
334-
/* eslint-disable no-unused-vars */
337+
/* eslint-disable-next-line no-unused-vars */
335338
return function(fn, t) {
336-
/* eslint-enable no-unused-vars */
337339
var args = new Array(arguments.length);
338340
for (var i=0, len=args.length; i < len; i++) {
339341
args[i] = arguments[i];

0 commit comments

Comments
 (0)