Skip to content

Commit f0445e7

Browse files
committed
fix various linter errors
1 parent 21d63cc commit f0445e7

File tree

6 files changed

+16
-12
lines changed

6 files changed

+16
-12
lines changed

packages/sveltekit/.eslintrc.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ module.exports = {
1818
},
1919
},
2020
{
21-
files: ['./src/vite/**', './src/server/**'],
22-
'@sentry-internal/sdk/no-optional-chaining': 'off',
21+
files: ['src/vite/**', 'src/server/**'],
22+
rules: {
23+
'@sentry-internal/sdk/no-optional-chaining': 'off',
24+
},
2325
},
2426
],
2527
extends: ['../../.eslintrc.js'],

packages/sveltekit/src/server/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export function rewriteFramesIteratee(frame: StackFrame): StackFrame {
6565

6666
let strippedFilename;
6767
if (svelteKitBuildOutDir) {
68-
strippedFilename = filename.replace(new RegExp(`^.*${escapeStringForRegex(svelteKitBuildOutDir)}\/server\/`), '');
68+
strippedFilename = filename.replace(new RegExp(`^.*${escapeStringForRegex(svelteKitBuildOutDir)}/server/`), '');
6969
} else {
7070
strippedFilename = basename(filename);
7171
}

packages/sveltekit/src/vite/sourceMaps.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export async function makeCustomSentryVitePlugin(options?: CustomSentryVitePlugi
7272
const sentryPlugin: Plugin = sentryVitePlugin(mergedOptions);
7373

7474
const { debug } = mergedOptions;
75-
const { buildStart, resolveId, transform, renderChunk } = sentryPlugin;
75+
const { buildStart, resolveId, renderChunk } = sentryPlugin;
7676

7777
let isSSRBuild = true;
7878

@@ -114,10 +114,10 @@ export async function makeCustomSentryVitePlugin(options?: CustomSentryVitePlugi
114114

115115
transform: async (code, id) => {
116116
let modifiedCode = code;
117-
const isServerHooksFile = new RegExp(`\/${escapeStringForRegex(serverHooksFile)}(.(js|ts|mjs|mts))?`).test(id);
117+
const isServerHooksFile = new RegExp(`/${escapeStringForRegex(serverHooksFile)}(.(js|ts|mjs|mts))?`).test(id);
118118

119119
if (isServerHooksFile) {
120-
let injectedCode = `global.__sentry_sveltekit_output_dir = "${outputDir || 'undefined'}";\n`;
120+
const injectedCode = `global.__sentry_sveltekit_output_dir = "${outputDir || 'undefined'}";\n`;
121121
modifiedCode = `${code}\n${injectedCode}`;
122122
}
123123
// @ts-ignore - this hook exists on the plugin!

packages/sveltekit/src/vite/svelteConfig.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import type { Builder, Config } from '@sveltejs/kit';
44
import * as fs from 'fs';
55
import * as path from 'path';
66
import * as url from 'url';
7-
import { SupportedSvelteKitAdapters } from './detectAdapter';
7+
8+
import type { SupportedSvelteKitAdapters } from './detectAdapter';
89

910
/**
1011
* Imports the svelte.config.js file and returns the config object.
@@ -40,7 +41,7 @@ export async function loadSvelteConfig(): Promise<Config> {
4041
* Reads a custom hooks directory from the SvelteKit config. In case no custom hooks
4142
* directory is specified, the default directory is returned.
4243
*/
43-
export function getHooksFileName(svelteConfig: Config, hookType: 'client' | 'server') {
44+
export function getHooksFileName(svelteConfig: Config, hookType: 'client' | 'server'): string {
4445
return svelteConfig.kit?.files?.hooks?.[hookType] || `src/hooks.${hookType}`;
4546
}
4647

packages/sveltekit/test/server/utils.test.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import { RewriteFrames } from '@sentry/integrations';
22
import type { StackFrame } from '@sentry/types';
33
import { basename } from '@sentry/utils';
44

5-
import { getTracePropagationData, GlobalWithSentryValues, rewriteFramesIteratee } from '../../src/server/utils';
5+
import type { GlobalWithSentryValues } from '../../src/server/utils';
6+
import { getTracePropagationData, rewriteFramesIteratee } from '../../src/server/utils';
67

78
const MOCK_REQUEST_EVENT: any = {
89
request: {
@@ -107,7 +108,7 @@ describe('rewriteFramesIteratee', () => {
107108
])(
108109
'removes the absolut path to the server output dir, if the output dir is available (%s)',
109110
(_, outputDir, frameFilename, modifiedFilename) => {
110-
(global as GlobalWithSentryValues).__sentry_sveltekit_output_dir = outputDir;
111+
(globalThis as GlobalWithSentryValues).__sentry_sveltekit_output_dir = outputDir;
111112

112113
const frame: StackFrame = {
113114
filename: frameFilename,
@@ -124,7 +125,7 @@ describe('rewriteFramesIteratee', () => {
124125
colno: 1,
125126
});
126127

127-
delete (global as GlobalWithSentryValues).__sentry_sveltekit_output_dir;
128+
delete (globalThis as GlobalWithSentryValues).__sentry_sveltekit_output_dir;
128129
},
129130
);
130131
});

packages/sveltekit/test/vite/svelteConfig.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { vi } from 'vitest';
2-
import { SupportedSvelteKitAdapters } from '../../src/vite/detectAdapter';
32

3+
import type { SupportedSvelteKitAdapters } from '../../src/vite/detectAdapter';
44
import { getAdapterOutputDir, getHooksFileName, loadSvelteConfig } from '../../src/vite/svelteConfig';
55

66
let existsFile;

0 commit comments

Comments
 (0)