Skip to content

Commit eb74d9f

Browse files
committed
tweak eslint settings
Use the default complexity of 20 across the codebase, but exempt the four functions that push it above 20, prefer eslint-disable-next-line when linting is disabled for a single line, and use the string constants which are self explanitory rather than the number constants when configuring eslintrc.
1 parent cc0a5fa commit eb74d9f

File tree

5 files changed

+15
-16
lines changed

5 files changed

+15
-16
lines changed

.eslintrc

Lines changed: 9 additions & 9 deletions
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"],
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

Lines changed: 1 addition & 2 deletions
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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ Instrumenter.prototype.configure = function(options) {
120120
}
121121
};
122122

123-
// eslint-disable-next-line complexity
123+
/* eslint-disable-next-line complexity */
124124
Instrumenter.prototype.instrument = function(oldSettings) {
125125
if (this.autoInstrument.network && !(oldSettings && oldSettings.network)) {
126126
this.instrumentNetwork();
@@ -222,11 +222,10 @@ Instrumenter.prototype.instrumentNetwork = function() {
222222
}, this.replacements, 'network');
223223

224224
replace(xhrp, 'send', function(orig) {
225-
/* eslint-disable no-unused-vars */
226225
return function(data) {
227-
/* eslint-enable no-unused-vars */
228226
var xhr = this;
229227

228+
/* eslint-disable-next-line complexity */
230229
function onreadystatechangeHandler() {
231230
if (xhr.__rollbar_xhr) {
232231
if (xhr.__rollbar_xhr.status_code === null) {
@@ -331,9 +330,8 @@ Instrumenter.prototype.instrumentNetwork = function() {
331330

332331
if ('fetch' in this._window) {
333332
replace(this._window, 'fetch', function(orig) {
334-
/* eslint-disable no-unused-vars */
333+
/* eslint-disable-next-line no-unused-vars */
335334
return function(fn, t) {
336-
/* eslint-enable no-unused-vars */
337335
var args = new Array(arguments.length);
338336
for (var i=0, len=args.length; i < len; i++) {
339337
args[i] = arguments[i];

src/browser/transforms.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ function addBodyTrace(item, options, callback) {
210210
}
211211
}
212212

213+
/* eslint-disable-next-line complexity */
213214
function buildTrace(item, stackInfo, options) {
214215
var description = item && item.data.description;
215216
var custom = item && item.custom;

src/utility.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@ function wrapCallback(logger, f) {
379379
};
380380
}
381381

382+
/* eslint-disable-next-line complexity */
382383
function createItem(args, logger, notifier, requestKeys, lambdaContext) {
383384
var message, err, custom, callback, request;
384385
var arg;

0 commit comments

Comments
 (0)