Skip to content

Commit c6f9dfe

Browse files
authored
ref: Drop no-plusplus rule & refactor to use ++ / -- (#6327)
1 parent 1a9d0fc commit c6f9dfe

File tree

20 files changed

+24
-36
lines changed

20 files changed

+24
-36
lines changed

packages/browser/src/helpers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ export function shouldIgnoreOnError(): boolean {
2525
*/
2626
export function ignoreNextOnError(): void {
2727
// onerror should trigger before setTimeout
28-
ignoreOnError += 1;
28+
ignoreOnError++;
2929
setTimeout(() => {
30-
ignoreOnError -= 1;
30+
ignoreOnError--;
3131
});
3232
}
3333

packages/browser/test/integration/polyfills/promise.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@
102102
observer.observe(node, { characterData: true });
103103

104104
return function () {
105-
// eslint-disable-next-line no-plusplus
106105
node.data = iterations = ++iterations % 2;
107106
};
108107
}
@@ -468,11 +467,11 @@
468467

469468
var id = 0;
470469
function nextId() {
471-
return (id += 1);
470+
return ++id;
472471
}
473472

474473
function makePromise(promise) {
475-
promise[PROMISE_ID] = id += 1;
474+
promise[PROMISE_ID] = ++id;
476475
promise._state = undefined;
477476
promise._result = undefined;
478477
promise._subscribers = [];
@@ -535,7 +534,7 @@
535534
if (_then === then && entry._state !== PENDING) {
536535
this._settledAt(entry._state, i, entry._result);
537536
} else if (typeof _then !== 'function') {
538-
this._remaining -= 1;
537+
this._remaining--;
539538
this._result[i] = entry;
540539
} else if (c === Promise$2) {
541540
var promise = new c(noop);
@@ -562,7 +561,7 @@
562561
var promise = this.promise;
563562

564563
if (promise._state === PENDING) {
565-
this._remaining -= 1;
564+
this._remaining--;
566565

567566
if (state === REJECTED) {
568567
reject(promise, value);

packages/core/src/baseclient.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -714,14 +714,14 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
714714
* Occupies the client with processing and event
715715
*/
716716
protected _process<T>(promise: PromiseLike<T>): void {
717-
this._numProcessing += 1;
717+
this._numProcessing++;
718718
void promise.then(
719719
value => {
720-
this._numProcessing -= 1;
720+
this._numProcessing--;
721721
return value;
722722
},
723723
reason => {
724-
this._numProcessing -= 1;
724+
this._numProcessing--;
725725
return reason;
726726
},
727727
);

packages/core/test/mocks/transport.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ export function makeFakeTransport(delay: number = 2000): {
1818
let sentCount = 0;
1919
const makeTransport = () =>
2020
createTransport({ recordDroppedEvent: () => undefined, textEncoder: new TextEncoder() }, () => {
21-
sendCalled += 1;
21+
sendCalled++;
2222
return new SyncPromise(async res => {
2323
await sleep(delay);
24-
sentCount += 1;
24+
sentCount++;
2525
res({});
2626
});
2727
});

packages/eslint-config-sdk/src/index.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,6 @@ module.exports = {
196196
],
197197

198198
rules: {
199-
// We want to prevent usage of unary operators outside of for loops
200-
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
201-
202199
// Disallow usage of console and alert
203200
'no-console': 'error',
204201
'no-alert': 'error',

packages/gatsby/test/integration.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ describe('useEffect', () => {
2222
onClientEntry(undefined, {
2323
beforeSend: (event: any) => {
2424
expect(event).not.toBeUndefined();
25-
calls += 1;
25+
calls++;
2626

2727
return null;
2828
},

packages/integration-tests/utils/helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ async function getMultipleRequests(
6969
function requestHandler(request: Request): void {
7070
if (urlRgx.test(request.url())) {
7171
try {
72-
reqCount -= 1;
72+
reqCount--;
7373
requestData.push(requestParser(request));
7474

7575
if (reqCount === 0) {

packages/integration-tests/utils/web-vitals/cls.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ async function moveBy(elem: HTMLParagraphElement, percent: number): Promise<void
2525
if (elem.getAttribute('id') === 'partial') {
2626
const max = Number(elem.getAttribute('max-steps'));
2727
let current = Number(elem.getAttribute('steps'));
28-
current += 1;
28+
current++;
2929
if (current > max) {
3030
return;
3131
}
@@ -52,7 +52,7 @@ function howMany(desiredCls: number): { extraSteps: number; createParagraphs: nu
5252
const extraSteps = Math.round((desiredCls - fullRuns * 0.095) / 0.005);
5353
let create = fullRuns;
5454
if (extraSteps > 0) {
55-
create += 1;
55+
create++;
5656
}
5757

5858
return { extraSteps: extraSteps, createParagraphs: create };

packages/node/src/integrations/http.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ function _createWrappedRequestMethodFactory(
247247

248248
const transaction = parentSpan.transaction;
249249
if (transaction) {
250-
transaction.metadata.propagations += 1;
250+
transaction.metadata.propagations++;
251251
}
252252
}
253253
}

packages/replay/.eslintrc.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ module.exports = {
6565
'@typescript-eslint/no-floating-promises': 'off',
6666
// TODO (medium-prio): Re-enable this after migration
6767
'jsdoc/require-jsdoc': 'off',
68-
// TODO: Do we even want to turn this on? Why not enable ++?
69-
'no-plusplus': 'off',
7068
},
7169
},
7270
{

0 commit comments

Comments
 (0)