Skip to content

Commit 889024a

Browse files
authored
chore(eslint): Turn on quotes rules (#4671)
> Enforces the consistent use of either backticks, double, or single quotes. https://eslint.org/docs/rules/quotes Enforces single quotes - which matches our prettier conventions.
1 parent 98d296f commit 889024a

File tree

26 files changed

+49
-44
lines changed

26 files changed

+49
-44
lines changed

packages/browser/src/helpers.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -193,14 +193,14 @@ export function injectReportDialog(options: ReportDialogOptions = {}): void {
193193

194194
if (!options.eventId) {
195195
if (isDebugBuild()) {
196-
logger.error(`Missing eventId option in showReportDialog call`);
196+
logger.error('Missing eventId option in showReportDialog call');
197197
}
198198
return;
199199
}
200200

201201
if (!options.dsn) {
202202
if (isDebugBuild()) {
203-
logger.error(`Missing dsn option in showReportDialog call`);
203+
logger.error('Missing dsn option in showReportDialog call');
204204
}
205205
return;
206206
}

packages/browser/src/integrations/dedupe.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export class Dedupe implements Integration {
2828
// Juuust in case something goes wrong
2929
try {
3030
if (_shouldDropEvent(currentEvent, self._previousEvent)) {
31-
logger.warn(`Event dropped due to being a duplicate of previously captured event.`);
31+
logger.warn('Event dropped due to being a duplicate of previously captured event.');
3232
return null;
3333
}
3434
} catch (_oO) {

packages/browser/src/stack-parsers.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export const gecko: StackLineParser = line => {
7272

7373
if (subMatch) {
7474
// throw out eval line/column and use top-most line number
75-
parts[1] = parts[1] || `eval`;
75+
parts[1] = parts[1] || 'eval';
7676
parts[3] = subMatch[1];
7777
parts[4] = subMatch[2];
7878
parts[5] = ''; // no column when eval

packages/browser/src/transports/utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export function getNativeFetchImplementation(): FetchImpl {
5858
const document = global.document;
5959
let fetchImpl = global.fetch;
6060
// eslint-disable-next-line deprecation/deprecation
61-
if (document && typeof document.createElement === `function`) {
61+
if (document && typeof document.createElement === 'function') {
6262
try {
6363
const sandbox = document.createElement('iframe');
6464
sandbox.hidden = true;

packages/browser/test/package/npm-build.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ webpack(
4141

4242
function runTests() {
4343
const bundlePath = path.join(__dirname, 'tmp.js');
44-
const { window } = new JSDOM(``, { runScripts: 'dangerously' });
44+
const { window } = new JSDOM('', { runScripts: 'dangerously' });
4545

4646
window.onerror = function () {
4747
console.error('ERROR thrown in manual test:');

packages/browser/test/unit/tracekit/safari.test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ describe('Tracekit - Safari Tests', () => {
149149

150150
it('should parse exceptions for safari-extension with frames-only stack', () => {
151151
const SAFARI_EXTENSION_EXCEPTION = {
152-
message: `undefined is not an object (evaluating 'e.groups.includes')`,
153-
name: `TypeError`,
152+
message: "undefined is not an object (evaluating 'e.groups.includes')",
153+
name: 'TypeError',
154154
stack: `isClaimed@safari-extension://com.grammarly.safari.extension.ext2-W8F64X92K3/ee7759dd/Grammarly.js:2:929865
155155
safari-extension://com.grammarly.safari.extension.ext2-W8F64X92K3/ee7759dd/Grammarly.js:2:1588410
156156
promiseReactionJob@[native code]`,
@@ -219,8 +219,8 @@ describe('Tracekit - Safari Tests', () => {
219219

220220
it('should parse exceptions for safari-web-extension with frames-only stack', () => {
221221
const SAFARI_EXTENSION_EXCEPTION = {
222-
message: `undefined is not an object (evaluating 'e.groups.includes')`,
223-
name: `TypeError`,
222+
message: "undefined is not an object (evaluating 'e.groups.includes')",
223+
name: 'TypeError',
224224
stack: `p_@safari-web-extension://46434E60-F5BD-48A4-80C8-A422C5D16897/scripts/content-script.js:29:33314
225225
safari-web-extension://46434E60-F5BD-48A4-80C8-A422C5D16897/scripts/content-script.js:29:56027
226226
promiseReactionJob@[native code]`,

packages/core/src/transports/noop.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export class NoopTransport implements Transport {
88
*/
99
public sendEvent(_: Event): PromiseLike<Response> {
1010
return resolvedSyncPromise({
11-
reason: `NoopTransport: Event has been skipped because no Dsn is configured.`,
11+
reason: 'NoopTransport: Event has been skipped because no Dsn is configured.',
1212
status: 'skipped',
1313
});
1414
}

packages/core/test/lib/request.test.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ const api = initAPIDetails(ingestDsn, {
1414
sdk: {
1515
integrations: ['AWSLambda'],
1616
name: 'sentry.javascript.browser',
17-
version: `12.31.12`,
18-
packages: [{ name: 'npm:@sentry/browser', version: `12.31.12` }],
17+
version: '12.31.12',
18+
packages: [{ name: 'npm:@sentry/browser', version: '12.31.12' }],
1919
},
2020
});
2121

@@ -77,8 +77,8 @@ describe('eventToSentryRequest', () => {
7777
sdk: {
7878
integrations: ['AWSLambda'],
7979
name: 'sentry.javascript.browser',
80-
version: `12.31.12`,
81-
packages: [{ name: 'npm:@sentry/browser', version: `12.31.12` }],
80+
version: '12.31.12',
81+
packages: [{ name: 'npm:@sentry/browser', version: '12.31.12' }],
8282
},
8383
}),
8484
);
@@ -88,7 +88,7 @@ describe('eventToSentryRequest', () => {
8888
event.sdk = {
8989
integrations: ['Clojure'],
9090
name: 'foo',
91-
packages: [{ name: 'npm:@sentry/clj', version: `12.31.12` }],
91+
packages: [{ name: 'npm:@sentry/clj', version: '12.31.12' }],
9292
version: '1337',
9393
};
9494

@@ -101,8 +101,8 @@ describe('eventToSentryRequest', () => {
101101
integrations: ['Clojure', 'AWSLambda'],
102102
name: 'foo',
103103
packages: [
104-
{ name: 'npm:@sentry/clj', version: `12.31.12` },
105-
{ name: 'npm:@sentry/browser', version: `12.31.12` },
104+
{ name: 'npm:@sentry/clj', version: '12.31.12' },
105+
{ name: 'npm:@sentry/browser', version: '12.31.12' },
106106
],
107107
version: '1337',
108108
},

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

+2
Original file line numberDiff line numberDiff line change
@@ -254,5 +254,7 @@ module.exports = {
254254
// `.filter` and `.reduce`. If we are not, we should be using
255255
// `.forEach()` or an explicit for loop.
256256
'array-callback-return': ['error', { allowImplicit: true }],
257+
258+
quotes: ['error', 'single', { avoidEscape: true }],
257259
},
258260
};

packages/integrations/src/dedupe.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export class Dedupe implements Integration {
2828
// Juuust in case something goes wrong
2929
try {
3030
if (_shouldDropEvent(currentEvent, self._previousEvent)) {
31-
logger.warn(`Event dropped due to being a duplicate of previously captured event.`);
31+
logger.warn('Event dropped due to being a duplicate of previously captured event.');
3232
return null;
3333
}
3434
} catch (_oO) {

packages/nextjs/src/config/webpack.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ function addFilesToExistingEntryPoint(
221221
console.error(
222222
'Sentry Logger [Error]:',
223223
`Could not inject SDK initialization code into entry point ${entryPointName}, as its current value is not in a recognized format.\n`,
224-
`Expected: string | Array<string> | { [key:string]: any, import: string | Array<string> }\n`,
224+
'Expected: string | Array<string> | { [key:string]: any, import: string | Array<string> }\n',
225225
`Got: ${currentEntryPoint}`,
226226
);
227227
}

packages/nextjs/test/config.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ describe('Sentry webpack plugin config', () => {
552552
project: 'simulator', // from user webpack plugin config
553553
authToken: 'dogsarebadatkeepingsecrets', // picked up from env
554554
stripPrefix: ['webpack://_N_E/'], // default
555-
urlPrefix: `~/_next`, // default
555+
urlPrefix: '~/_next', // default
556556
entries: expect.any(Function), // default, tested separately elsewhere
557557
release: 'doGsaREgReaT', // picked up from env
558558
dryRun: false, // based on buildContext.dev being false

packages/node/src/handlers.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ function extractExpressTransactionName(
139139
info += method;
140140
}
141141
if (options.method && options.path) {
142-
info += ` `;
142+
info += ' ';
143143
}
144144
if (options.path && path) {
145145
info += path;

packages/node/test/transports/http.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ describe('HTTPTransport', () => {
225225
const retryAfterSeconds = 60;
226226
mockReturnCode = 429;
227227
mockHeaders = {
228-
'x-sentry-rate-limits': `sgthrthewhertht`,
228+
'x-sentry-rate-limits': 'sgthrthewhertht',
229229
};
230230
const transport = createTransport({ dsn });
231231
const now = Date.now();

packages/serverless/test/google-cloud-http.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ describe('GoogleCloudHttp tracing', () => {
5555
200,
5656
'{"kind":"bigquery#getQueryResultsResponse","etag":"0+ToZZTzCJ4lyhNI3v4rGg==","schema":{"fields":[{"name":"foo","type":"BOOLEAN","mode":"NULLABLE"}]},"jobReference":{"projectId":"project-id","jobId":"8874c5d5-9cfe-4daa-8390-b0504b97b429","location":"US"},"totalRows":"1","rows":[{"f":[{"v":"true"}]}],"totalBytesProcessed":"0","jobComplete":true,"cacheHit":false}',
5757
);
58-
const resp = await bigquery.query(`SELECT true AS foo`);
58+
const resp = await bigquery.query('SELECT true AS foo');
5959
expect(resp).toEqual([[{ foo: true }]]);
6060
// @ts-ignore see "Why @ts-ignore" note
6161
expect(Sentry.fakeTransaction.startChild).toBeCalledWith({

packages/tracing/src/hubextensions.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ function sample<T extends Transaction>(transaction: T, options: Options, samplin
8686
// Since this is coming from the user (or from a function provided by the user), who knows what we might get. (The
8787
// only valid values are booleans or numbers between 0 and 1.)
8888
if (!isValidSampleRate(sampleRate)) {
89-
logger.warn(`[Tracing] Discarding transaction because of invalid sample rate.`);
89+
logger.warn('[Tracing] Discarding transaction because of invalid sample rate.');
9090
transaction.sampled = false;
9191
return transaction;
9292
}

packages/tracing/src/idletransaction.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ export class IdleTransaction extends Transaction {
251251
this._prevHeartbeatString = heartbeatString;
252252

253253
if (this._heartbeatCounter >= 3) {
254-
logger.log(`[Tracing] Transaction finished because of no change for 3 heart beats`);
254+
logger.log('[Tracing] Transaction finished because of no change for 3 heart beats');
255255
this.setStatus('deadline_exceeded');
256256
this.setTag(FINISH_REASON_TAG, IDLE_TRANSACTION_FINISH_REASONS[0]);
257257
this.finish();

packages/tracing/src/integrations/node/mongo.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ export class Mongo implements Integration {
189189
namespace: collection.namespace,
190190
};
191191
const spanContext: SpanContext = {
192-
op: `db`,
192+
op: 'db',
193193
description: operation,
194194
data,
195195
};

packages/tracing/src/integrations/node/mysql.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export class Mysql implements Integration {
3939
const parentSpan = scope?.getSpan();
4040
const span = parentSpan?.startChild({
4141
description: typeof options === 'string' ? options : (options as { sql: string }).sql,
42-
op: `db`,
42+
op: 'db',
4343
});
4444

4545
if (typeof callback === 'function') {

packages/tracing/src/integrations/node/postgres.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export class Postgres implements Integration {
4242
}
4343

4444
if (this._usePgNative && !pkg.native?.Client) {
45-
logger.error(`Postgres Integration was unable to access 'pg-native' bindings.`);
45+
logger.error("Postgres Integration was unable to access 'pg-native' bindings.");
4646
return;
4747
}
4848

@@ -61,7 +61,7 @@ export class Postgres implements Integration {
6161
const parentSpan = scope?.getSpan();
6262
const span = parentSpan?.startChild({
6363
description: typeof config === 'string' ? config : (config as { text: string }).text,
64-
op: `db`,
64+
op: 'db',
6565
});
6666

6767
if (typeof callback === 'function') {

packages/tracing/test/browser/browsertracing.test.ts

+10-7
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ describe('BrowserTracing', () => {
372372
});
373373

374374
it("doesn't return meta tags other than the one specified", () => {
375-
document.head.innerHTML = `<meta name="cat-cafe">`;
375+
document.head.innerHTML = '<meta name="cat-cafe">';
376376

377377
const metaTagValue = getMetaContent('dogpark');
378378
expect(metaTagValue).toBe(null);
@@ -382,7 +382,7 @@ describe('BrowserTracing', () => {
382382
const name = 'sentry-trace';
383383
const content = '126de09502ae4e0fb26c6967190756a4-b6e54397b12a2a0f-1';
384384
const sentryTraceMeta = `<meta name="${name}" content="${content}">`;
385-
const otherMeta = `<meta name="cat-cafe">`;
385+
const otherMeta = '<meta name="cat-cafe">';
386386
document.head.innerHTML = `${sentryTraceMeta} ${otherMeta}`;
387387

388388
const metaTagValue = getMetaContent(name);
@@ -392,7 +392,8 @@ describe('BrowserTracing', () => {
392392

393393
describe('getHeaderContext', () => {
394394
it('correctly parses a valid sentry-trace meta header', () => {
395-
document.head.innerHTML = `<meta name="sentry-trace" content="12312012123120121231201212312012-1121201211212012-0">`;
395+
document.head.innerHTML =
396+
'<meta name="sentry-trace" content="12312012123120121231201212312012-1121201211212012-0">';
396397

397398
const headerContext = getHeaderContext();
398399

@@ -403,15 +404,15 @@ describe('BrowserTracing', () => {
403404
});
404405

405406
it('returns undefined if the header is malformed', () => {
406-
document.head.innerHTML = `<meta name="sentry-trace" content="12312012-112120121-0">`;
407+
document.head.innerHTML = '<meta name="sentry-trace" content="12312012-112120121-0">';
407408

408409
const headerContext = getHeaderContext();
409410

410411
expect(headerContext).toBeUndefined();
411412
});
412413

413414
it("returns undefined if the header isn't there", () => {
414-
document.head.innerHTML = `<meta name="dogs" content="12312012123120121231201212312012-1121201211212012-0">`;
415+
document.head.innerHTML = '<meta name="dogs" content="12312012123120121231201212312012-1121201211212012-0">';
415416

416417
const headerContext = getHeaderContext();
417418

@@ -422,7 +423,8 @@ describe('BrowserTracing', () => {
422423
describe('using the data', () => {
423424
it('uses the data for pageload transactions', () => {
424425
// make sampled false here, so we can see that it's being used rather than the tracesSampleRate-dictated one
425-
document.head.innerHTML = `<meta name="sentry-trace" content="12312012123120121231201212312012-1121201211212012-0">`;
426+
document.head.innerHTML =
427+
'<meta name="sentry-trace" content="12312012123120121231201212312012-1121201211212012-0">';
426428

427429
// pageload transactions are created as part of the BrowserTracing integration's initialization
428430
createBrowserTracing(true);
@@ -437,7 +439,8 @@ describe('BrowserTracing', () => {
437439

438440
it('ignores the data for navigation transactions', () => {
439441
mockChangeHistory = () => undefined;
440-
document.head.innerHTML = `<meta name="sentry-trace" content="12312012123120121231201212312012-1121201211212012-0">`;
442+
document.head.innerHTML =
443+
'<meta name="sentry-trace" content="12312012123120121231201212312012-1121201211212012-0">';
441444

442445
createBrowserTracing(true);
443446

packages/tracing/test/integrations/node/mongo.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ describe('patchOperation()', () => {
7373
doc: JSON.stringify(doc),
7474
namespace: 'mockedNamespace',
7575
},
76-
op: `db`,
76+
op: 'db',
7777
description: 'insertOne',
7878
});
7979
expect(childSpan.finish).toBeCalled();
@@ -91,7 +91,7 @@ describe('patchOperation()', () => {
9191
doc: JSON.stringify(doc),
9292
namespace: 'mockedNamespace',
9393
},
94-
op: `db`,
94+
op: 'db',
9595
description: 'insertOne',
9696
});
9797
expect(childSpan.finish).toBeCalled();
@@ -106,7 +106,7 @@ describe('patchOperation()', () => {
106106
dbName: 'mockedDbName',
107107
namespace: 'mockedNamespace',
108108
},
109-
op: `db`,
109+
op: 'db',
110110
description: 'initializeOrderedBulkOp',
111111
});
112112
expect(childSpan.finish).toBeCalled();

packages/utils/src/supports.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export function supportsNativeFetch(): boolean {
102102
let result = false;
103103
const doc = global.document;
104104
// eslint-disable-next-line deprecation/deprecation
105-
if (doc && typeof (doc.createElement as unknown) === `function`) {
105+
if (doc && typeof (doc.createElement as unknown) === 'function') {
106106
try {
107107
const sandbox = doc.createElement('iframe');
108108
sandbox.hidden = true;

packages/utils/test/build.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as fs from 'fs';
22
import * as path from 'path';
33

4-
const testStrings = [`/// <reference types="node" />`];
4+
const testStrings = ['/// <reference types="node" />'];
55

66
describe('build', () => {
77
test('not contains types', () => {

packages/utils/test/envelope.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ describe('envelope', () => {
2121
it('serializes an envelope', () => {
2222
const env = createEnvelope<EventEnvelope>({ event_id: 'aa3ff046696b4bc6b609ce6d28fde9e2', sent_at: '123' }, []);
2323
expect(serializeEnvelope(env)).toMatchInlineSnapshot(
24-
`"{\\"event_id\\":\\"aa3ff046696b4bc6b609ce6d28fde9e2\\",\\"sent_at\\":\\"123\\"}"`,
24+
'"{\\"event_id\\":\\"aa3ff046696b4bc6b609ce6d28fde9e2\\",\\"sent_at\\":\\"123\\"}"',
2525
);
2626
});
2727
});

packages/vue/src/components.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export const formatComponentName = (vm?: ViewModel, includeFile?: boolean): stri
4242
}
4343

4444
return (
45-
(name ? `<${classify(name)}>` : ANONYMOUS_COMPONENT_NAME) + (file && includeFile !== false ? ` at ${file}` : ``)
45+
(name ? `<${classify(name)}>` : ANONYMOUS_COMPONENT_NAME) + (file && includeFile !== false ? ` at ${file}` : '')
4646
);
4747
};
4848

0 commit comments

Comments
 (0)