diff --git a/packages/browser/src/helpers.ts b/packages/browser/src/helpers.ts index 609b21ef6f47..622094d73054 100644 --- a/packages/browser/src/helpers.ts +++ b/packages/browser/src/helpers.ts @@ -193,14 +193,14 @@ export function injectReportDialog(options: ReportDialogOptions = {}): void { if (!options.eventId) { if (isDebugBuild()) { - logger.error(`Missing eventId option in showReportDialog call`); + logger.error('Missing eventId option in showReportDialog call'); } return; } if (!options.dsn) { if (isDebugBuild()) { - logger.error(`Missing dsn option in showReportDialog call`); + logger.error('Missing dsn option in showReportDialog call'); } return; } diff --git a/packages/browser/src/integrations/dedupe.ts b/packages/browser/src/integrations/dedupe.ts index 641823bbde3c..27cc80201694 100644 --- a/packages/browser/src/integrations/dedupe.ts +++ b/packages/browser/src/integrations/dedupe.ts @@ -28,7 +28,7 @@ export class Dedupe implements Integration { // Juuust in case something goes wrong try { if (_shouldDropEvent(currentEvent, self._previousEvent)) { - logger.warn(`Event dropped due to being a duplicate of previously captured event.`); + logger.warn('Event dropped due to being a duplicate of previously captured event.'); return null; } } catch (_oO) { diff --git a/packages/browser/src/stack-parsers.ts b/packages/browser/src/stack-parsers.ts index d05393101843..8f4dc515cdd1 100644 --- a/packages/browser/src/stack-parsers.ts +++ b/packages/browser/src/stack-parsers.ts @@ -72,7 +72,7 @@ export const gecko: StackLineParser = line => { if (subMatch) { // throw out eval line/column and use top-most line number - parts[1] = parts[1] || `eval`; + parts[1] = parts[1] || 'eval'; parts[3] = subMatch[1]; parts[4] = subMatch[2]; parts[5] = ''; // no column when eval diff --git a/packages/browser/src/transports/utils.ts b/packages/browser/src/transports/utils.ts index 5b48c9e93cbc..a6f9cb5a726d 100644 --- a/packages/browser/src/transports/utils.ts +++ b/packages/browser/src/transports/utils.ts @@ -58,7 +58,7 @@ export function getNativeFetchImplementation(): FetchImpl { const document = global.document; let fetchImpl = global.fetch; // eslint-disable-next-line deprecation/deprecation - if (document && typeof document.createElement === `function`) { + if (document && typeof document.createElement === 'function') { try { const sandbox = document.createElement('iframe'); sandbox.hidden = true; diff --git a/packages/browser/test/package/npm-build.js b/packages/browser/test/package/npm-build.js index cf2a85c158c1..ded02ea63a86 100644 --- a/packages/browser/test/package/npm-build.js +++ b/packages/browser/test/package/npm-build.js @@ -41,7 +41,7 @@ webpack( function runTests() { const bundlePath = path.join(__dirname, 'tmp.js'); - const { window } = new JSDOM(``, { runScripts: 'dangerously' }); + const { window } = new JSDOM('', { runScripts: 'dangerously' }); window.onerror = function () { console.error('ERROR thrown in manual test:'); diff --git a/packages/browser/test/unit/tracekit/safari.test.ts b/packages/browser/test/unit/tracekit/safari.test.ts index a2fb96294166..c3b1f1f44bd4 100644 --- a/packages/browser/test/unit/tracekit/safari.test.ts +++ b/packages/browser/test/unit/tracekit/safari.test.ts @@ -149,8 +149,8 @@ describe('Tracekit - Safari Tests', () => { it('should parse exceptions for safari-extension with frames-only stack', () => { const SAFARI_EXTENSION_EXCEPTION = { - message: `undefined is not an object (evaluating 'e.groups.includes')`, - name: `TypeError`, + message: "undefined is not an object (evaluating 'e.groups.includes')", + name: 'TypeError', stack: `isClaimed@safari-extension://com.grammarly.safari.extension.ext2-W8F64X92K3/ee7759dd/Grammarly.js:2:929865 safari-extension://com.grammarly.safari.extension.ext2-W8F64X92K3/ee7759dd/Grammarly.js:2:1588410 promiseReactionJob@[native code]`, @@ -219,8 +219,8 @@ describe('Tracekit - Safari Tests', () => { it('should parse exceptions for safari-web-extension with frames-only stack', () => { const SAFARI_EXTENSION_EXCEPTION = { - message: `undefined is not an object (evaluating 'e.groups.includes')`, - name: `TypeError`, + message: "undefined is not an object (evaluating 'e.groups.includes')", + name: 'TypeError', stack: `p_@safari-web-extension://46434E60-F5BD-48A4-80C8-A422C5D16897/scripts/content-script.js:29:33314 safari-web-extension://46434E60-F5BD-48A4-80C8-A422C5D16897/scripts/content-script.js:29:56027 promiseReactionJob@[native code]`, diff --git a/packages/core/src/transports/noop.ts b/packages/core/src/transports/noop.ts index 0fc2c190f263..8ea66c7b8a4e 100644 --- a/packages/core/src/transports/noop.ts +++ b/packages/core/src/transports/noop.ts @@ -8,7 +8,7 @@ export class NoopTransport implements Transport { */ public sendEvent(_: Event): PromiseLike { return resolvedSyncPromise({ - reason: `NoopTransport: Event has been skipped because no Dsn is configured.`, + reason: 'NoopTransport: Event has been skipped because no Dsn is configured.', status: 'skipped', }); } diff --git a/packages/core/test/lib/request.test.ts b/packages/core/test/lib/request.test.ts index 24e7101c2a81..c740611a5996 100644 --- a/packages/core/test/lib/request.test.ts +++ b/packages/core/test/lib/request.test.ts @@ -14,8 +14,8 @@ const api = initAPIDetails(ingestDsn, { sdk: { integrations: ['AWSLambda'], name: 'sentry.javascript.browser', - version: `12.31.12`, - packages: [{ name: 'npm:@sentry/browser', version: `12.31.12` }], + version: '12.31.12', + packages: [{ name: 'npm:@sentry/browser', version: '12.31.12' }], }, }); @@ -77,8 +77,8 @@ describe('eventToSentryRequest', () => { sdk: { integrations: ['AWSLambda'], name: 'sentry.javascript.browser', - version: `12.31.12`, - packages: [{ name: 'npm:@sentry/browser', version: `12.31.12` }], + version: '12.31.12', + packages: [{ name: 'npm:@sentry/browser', version: '12.31.12' }], }, }), ); @@ -88,7 +88,7 @@ describe('eventToSentryRequest', () => { event.sdk = { integrations: ['Clojure'], name: 'foo', - packages: [{ name: 'npm:@sentry/clj', version: `12.31.12` }], + packages: [{ name: 'npm:@sentry/clj', version: '12.31.12' }], version: '1337', }; @@ -101,8 +101,8 @@ describe('eventToSentryRequest', () => { integrations: ['Clojure', 'AWSLambda'], name: 'foo', packages: [ - { name: 'npm:@sentry/clj', version: `12.31.12` }, - { name: 'npm:@sentry/browser', version: `12.31.12` }, + { name: 'npm:@sentry/clj', version: '12.31.12' }, + { name: 'npm:@sentry/browser', version: '12.31.12' }, ], version: '1337', }, diff --git a/packages/eslint-config-sdk/src/index.js b/packages/eslint-config-sdk/src/index.js index 8f90a2131f5e..347a591832ec 100644 --- a/packages/eslint-config-sdk/src/index.js +++ b/packages/eslint-config-sdk/src/index.js @@ -254,5 +254,7 @@ module.exports = { // `.filter` and `.reduce`. If we are not, we should be using // `.forEach()` or an explicit for loop. 'array-callback-return': ['error', { allowImplicit: true }], + + quotes: ['error', 'single', { avoidEscape: true }], }, }; diff --git a/packages/integrations/src/dedupe.ts b/packages/integrations/src/dedupe.ts index f36e9770b908..62b6ee64427a 100644 --- a/packages/integrations/src/dedupe.ts +++ b/packages/integrations/src/dedupe.ts @@ -28,7 +28,7 @@ export class Dedupe implements Integration { // Juuust in case something goes wrong try { if (_shouldDropEvent(currentEvent, self._previousEvent)) { - logger.warn(`Event dropped due to being a duplicate of previously captured event.`); + logger.warn('Event dropped due to being a duplicate of previously captured event.'); return null; } } catch (_oO) { diff --git a/packages/nextjs/src/config/webpack.ts b/packages/nextjs/src/config/webpack.ts index f3f33281f825..9791b2640148 100644 --- a/packages/nextjs/src/config/webpack.ts +++ b/packages/nextjs/src/config/webpack.ts @@ -221,7 +221,7 @@ function addFilesToExistingEntryPoint( console.error( 'Sentry Logger [Error]:', `Could not inject SDK initialization code into entry point ${entryPointName}, as its current value is not in a recognized format.\n`, - `Expected: string | Array | { [key:string]: any, import: string | Array }\n`, + 'Expected: string | Array | { [key:string]: any, import: string | Array }\n', `Got: ${currentEntryPoint}`, ); } diff --git a/packages/nextjs/test/config.test.ts b/packages/nextjs/test/config.test.ts index 4d6f8871f1c7..6c37465921ad 100644 --- a/packages/nextjs/test/config.test.ts +++ b/packages/nextjs/test/config.test.ts @@ -552,7 +552,7 @@ describe('Sentry webpack plugin config', () => { project: 'simulator', // from user webpack plugin config authToken: 'dogsarebadatkeepingsecrets', // picked up from env stripPrefix: ['webpack://_N_E/'], // default - urlPrefix: `~/_next`, // default + urlPrefix: '~/_next', // default entries: expect.any(Function), // default, tested separately elsewhere release: 'doGsaREgReaT', // picked up from env dryRun: false, // based on buildContext.dev being false diff --git a/packages/node/src/handlers.ts b/packages/node/src/handlers.ts index 1d08dab177ae..ffb2ed966881 100644 --- a/packages/node/src/handlers.ts +++ b/packages/node/src/handlers.ts @@ -139,7 +139,7 @@ function extractExpressTransactionName( info += method; } if (options.method && options.path) { - info += ` `; + info += ' '; } if (options.path && path) { info += path; diff --git a/packages/node/test/transports/http.test.ts b/packages/node/test/transports/http.test.ts index d8463f7418fb..e2e837fee2d3 100644 --- a/packages/node/test/transports/http.test.ts +++ b/packages/node/test/transports/http.test.ts @@ -225,7 +225,7 @@ describe('HTTPTransport', () => { const retryAfterSeconds = 60; mockReturnCode = 429; mockHeaders = { - 'x-sentry-rate-limits': `sgthrthewhertht`, + 'x-sentry-rate-limits': 'sgthrthewhertht', }; const transport = createTransport({ dsn }); const now = Date.now(); diff --git a/packages/serverless/test/google-cloud-http.test.ts b/packages/serverless/test/google-cloud-http.test.ts index 28869ffa6d0c..fced84730b00 100644 --- a/packages/serverless/test/google-cloud-http.test.ts +++ b/packages/serverless/test/google-cloud-http.test.ts @@ -55,7 +55,7 @@ describe('GoogleCloudHttp tracing', () => { 200, '{"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}', ); - const resp = await bigquery.query(`SELECT true AS foo`); + const resp = await bigquery.query('SELECT true AS foo'); expect(resp).toEqual([[{ foo: true }]]); // @ts-ignore see "Why @ts-ignore" note expect(Sentry.fakeTransaction.startChild).toBeCalledWith({ diff --git a/packages/tracing/src/hubextensions.ts b/packages/tracing/src/hubextensions.ts index 5812cfb5052e..f4896572b6b0 100644 --- a/packages/tracing/src/hubextensions.ts +++ b/packages/tracing/src/hubextensions.ts @@ -86,7 +86,7 @@ function sample(transaction: T, options: Options, samplin // Since this is coming from the user (or from a function provided by the user), who knows what we might get. (The // only valid values are booleans or numbers between 0 and 1.) if (!isValidSampleRate(sampleRate)) { - logger.warn(`[Tracing] Discarding transaction because of invalid sample rate.`); + logger.warn('[Tracing] Discarding transaction because of invalid sample rate.'); transaction.sampled = false; return transaction; } diff --git a/packages/tracing/src/idletransaction.ts b/packages/tracing/src/idletransaction.ts index 7e876bb18660..fae901ba5e20 100644 --- a/packages/tracing/src/idletransaction.ts +++ b/packages/tracing/src/idletransaction.ts @@ -251,7 +251,7 @@ export class IdleTransaction extends Transaction { this._prevHeartbeatString = heartbeatString; if (this._heartbeatCounter >= 3) { - logger.log(`[Tracing] Transaction finished because of no change for 3 heart beats`); + logger.log('[Tracing] Transaction finished because of no change for 3 heart beats'); this.setStatus('deadline_exceeded'); this.setTag(FINISH_REASON_TAG, IDLE_TRANSACTION_FINISH_REASONS[0]); this.finish(); diff --git a/packages/tracing/src/integrations/node/mongo.ts b/packages/tracing/src/integrations/node/mongo.ts index 64f606a4c42e..806024872ea5 100644 --- a/packages/tracing/src/integrations/node/mongo.ts +++ b/packages/tracing/src/integrations/node/mongo.ts @@ -189,7 +189,7 @@ export class Mongo implements Integration { namespace: collection.namespace, }; const spanContext: SpanContext = { - op: `db`, + op: 'db', description: operation, data, }; diff --git a/packages/tracing/src/integrations/node/mysql.ts b/packages/tracing/src/integrations/node/mysql.ts index 5498f698f12e..065a5f319175 100644 --- a/packages/tracing/src/integrations/node/mysql.ts +++ b/packages/tracing/src/integrations/node/mysql.ts @@ -39,7 +39,7 @@ export class Mysql implements Integration { const parentSpan = scope?.getSpan(); const span = parentSpan?.startChild({ description: typeof options === 'string' ? options : (options as { sql: string }).sql, - op: `db`, + op: 'db', }); if (typeof callback === 'function') { diff --git a/packages/tracing/src/integrations/node/postgres.ts b/packages/tracing/src/integrations/node/postgres.ts index 9ac51114f9b6..eed4697147d6 100644 --- a/packages/tracing/src/integrations/node/postgres.ts +++ b/packages/tracing/src/integrations/node/postgres.ts @@ -42,7 +42,7 @@ export class Postgres implements Integration { } if (this._usePgNative && !pkg.native?.Client) { - logger.error(`Postgres Integration was unable to access 'pg-native' bindings.`); + logger.error("Postgres Integration was unable to access 'pg-native' bindings."); return; } @@ -61,7 +61,7 @@ export class Postgres implements Integration { const parentSpan = scope?.getSpan(); const span = parentSpan?.startChild({ description: typeof config === 'string' ? config : (config as { text: string }).text, - op: `db`, + op: 'db', }); if (typeof callback === 'function') { diff --git a/packages/tracing/test/browser/browsertracing.test.ts b/packages/tracing/test/browser/browsertracing.test.ts index 5658dd34858c..8db3cc10e41e 100644 --- a/packages/tracing/test/browser/browsertracing.test.ts +++ b/packages/tracing/test/browser/browsertracing.test.ts @@ -372,7 +372,7 @@ describe('BrowserTracing', () => { }); it("doesn't return meta tags other than the one specified", () => { - document.head.innerHTML = ``; + document.head.innerHTML = ''; const metaTagValue = getMetaContent('dogpark'); expect(metaTagValue).toBe(null); @@ -382,7 +382,7 @@ describe('BrowserTracing', () => { const name = 'sentry-trace'; const content = '126de09502ae4e0fb26c6967190756a4-b6e54397b12a2a0f-1'; const sentryTraceMeta = ``; - const otherMeta = ``; + const otherMeta = ''; document.head.innerHTML = `${sentryTraceMeta} ${otherMeta}`; const metaTagValue = getMetaContent(name); @@ -392,7 +392,8 @@ describe('BrowserTracing', () => { describe('getHeaderContext', () => { it('correctly parses a valid sentry-trace meta header', () => { - document.head.innerHTML = ``; + document.head.innerHTML = + ''; const headerContext = getHeaderContext(); @@ -403,7 +404,7 @@ describe('BrowserTracing', () => { }); it('returns undefined if the header is malformed', () => { - document.head.innerHTML = ``; + document.head.innerHTML = ''; const headerContext = getHeaderContext(); @@ -411,7 +412,7 @@ describe('BrowserTracing', () => { }); it("returns undefined if the header isn't there", () => { - document.head.innerHTML = ``; + document.head.innerHTML = ''; const headerContext = getHeaderContext(); @@ -422,7 +423,8 @@ describe('BrowserTracing', () => { describe('using the data', () => { it('uses the data for pageload transactions', () => { // make sampled false here, so we can see that it's being used rather than the tracesSampleRate-dictated one - document.head.innerHTML = ``; + document.head.innerHTML = + ''; // pageload transactions are created as part of the BrowserTracing integration's initialization createBrowserTracing(true); @@ -437,7 +439,8 @@ describe('BrowserTracing', () => { it('ignores the data for navigation transactions', () => { mockChangeHistory = () => undefined; - document.head.innerHTML = ``; + document.head.innerHTML = + ''; createBrowserTracing(true); diff --git a/packages/tracing/test/integrations/node/mongo.test.ts b/packages/tracing/test/integrations/node/mongo.test.ts index 392aa8ed942e..aefaa307df2c 100644 --- a/packages/tracing/test/integrations/node/mongo.test.ts +++ b/packages/tracing/test/integrations/node/mongo.test.ts @@ -73,7 +73,7 @@ describe('patchOperation()', () => { doc: JSON.stringify(doc), namespace: 'mockedNamespace', }, - op: `db`, + op: 'db', description: 'insertOne', }); expect(childSpan.finish).toBeCalled(); @@ -91,7 +91,7 @@ describe('patchOperation()', () => { doc: JSON.stringify(doc), namespace: 'mockedNamespace', }, - op: `db`, + op: 'db', description: 'insertOne', }); expect(childSpan.finish).toBeCalled(); @@ -106,7 +106,7 @@ describe('patchOperation()', () => { dbName: 'mockedDbName', namespace: 'mockedNamespace', }, - op: `db`, + op: 'db', description: 'initializeOrderedBulkOp', }); expect(childSpan.finish).toBeCalled(); diff --git a/packages/utils/src/supports.ts b/packages/utils/src/supports.ts index cfed6319248e..1c55d06e0dee 100644 --- a/packages/utils/src/supports.ts +++ b/packages/utils/src/supports.ts @@ -102,7 +102,7 @@ export function supportsNativeFetch(): boolean { let result = false; const doc = global.document; // eslint-disable-next-line deprecation/deprecation - if (doc && typeof (doc.createElement as unknown) === `function`) { + if (doc && typeof (doc.createElement as unknown) === 'function') { try { const sandbox = doc.createElement('iframe'); sandbox.hidden = true; diff --git a/packages/utils/test/build.test.ts b/packages/utils/test/build.test.ts index 22cdbe5c1798..3f5184a02063 100644 --- a/packages/utils/test/build.test.ts +++ b/packages/utils/test/build.test.ts @@ -1,7 +1,7 @@ import * as fs from 'fs'; import * as path from 'path'; -const testStrings = [`/// `]; +const testStrings = ['/// ']; describe('build', () => { test('not contains types', () => { diff --git a/packages/utils/test/envelope.test.ts b/packages/utils/test/envelope.test.ts index 64cdbe5e39ca..cb4f65335f36 100644 --- a/packages/utils/test/envelope.test.ts +++ b/packages/utils/test/envelope.test.ts @@ -21,7 +21,7 @@ describe('envelope', () => { it('serializes an envelope', () => { const env = createEnvelope({ event_id: 'aa3ff046696b4bc6b609ce6d28fde9e2', sent_at: '123' }, []); expect(serializeEnvelope(env)).toMatchInlineSnapshot( - `"{\\"event_id\\":\\"aa3ff046696b4bc6b609ce6d28fde9e2\\",\\"sent_at\\":\\"123\\"}"`, + '"{\\"event_id\\":\\"aa3ff046696b4bc6b609ce6d28fde9e2\\",\\"sent_at\\":\\"123\\"}"', ); }); }); diff --git a/packages/vue/src/components.ts b/packages/vue/src/components.ts index 20b8bf8023a5..c88b7189c009 100644 --- a/packages/vue/src/components.ts +++ b/packages/vue/src/components.ts @@ -42,7 +42,7 @@ export const formatComponentName = (vm?: ViewModel, includeFile?: boolean): stri } return ( - (name ? `<${classify(name)}>` : ANONYMOUS_COMPONENT_NAME) + (file && includeFile !== false ? ` at ${file}` : ``) + (name ? `<${classify(name)}>` : ANONYMOUS_COMPONENT_NAME) + (file && includeFile !== false ? ` at ${file}` : '') ); };