@@ -3,7 +3,6 @@ import fs from 'fs';
3
3
import path from 'path' ;
4
4
import { getPackageJsons } from './get-package-json.js' ;
5
5
import { getNodeModule } from './get-node-module.js' ;
6
- import { getFilename } from './compat.js' ;
7
6
import { createCache } from './cache.js' ;
8
7
import { VERSION as SVELTE_VERSION } from 'svelte/compiler' ;
9
8
@@ -122,7 +121,7 @@ const svelteKitContextCache = createCache<Pick<
122
121
function getSvelteKitContext (
123
122
context : RuleContext
124
123
) : Pick < SvelteContext , 'svelteKitFileType' | 'svelteKitVersion' > {
125
- const filePath = getFilename ( context ) ;
124
+ const filePath = context . filename ;
126
125
127
126
const cached = svelteKitContextCache . get ( filePath ) ;
128
127
if ( cached ) return cached ;
@@ -151,7 +150,7 @@ function getSvelteKitContext(
151
150
context . settings ?. svelte ?. kit ?. files ?. routes ??
152
151
context . sourceCode . parserServices . svelteParseContext ?. svelteConfig ?. kit ?. files ?. routes
153
152
) ?. replace ( / ^ \/ / , '' ) ?? 'src/routes' ;
154
- const projectRootDir = getProjectRootDir ( getFilename ( context ) ) ?? '' ;
153
+ const projectRootDir = getProjectRootDir ( context . filename ) ?? '' ;
155
154
156
155
if ( ! filePath . startsWith ( path . join ( projectRootDir , routes ) ) ) {
157
156
const result : Pick < SvelteContext , 'svelteKitFileType' | 'svelteKitVersion' > = {
@@ -288,7 +287,7 @@ const svelteContextCache = createCache<SvelteContext | null>();
288
287
export function getSvelteContext ( context : RuleContext ) : SvelteContext | null {
289
288
const { parserServices } = context . sourceCode ;
290
289
const { svelteParseContext } = parserServices ;
291
- const filePath = getFilename ( context ) ;
290
+ const filePath = context . filename ;
292
291
293
292
const cached = svelteContextCache . get ( filePath ) ;
294
293
if ( cached ) return cached ;
0 commit comments