@@ -49,12 +49,12 @@ resolveFrom.silent = (moduleId, fromDirectory) => {
4949const resolveLocalConfig = name => resolveModule ( normalizePackageName ( name , 'eslint-config' ) , import . meta. url ) ;
5050
5151const nodeVersion = process && process . version ;
52- const cacheLocation = findCacheDir ( { name : CACHE_DIR_NAME } ) || path . join ( os . homedir ( ) || os . tmpdir ( ) , '.xo-cache/' ) ;
52+ const cacheLocation = cwd => findCacheDir ( { name : CACHE_DIR_NAME , cwd } ) || path . join ( os . homedir ( ) || os . tmpdir ( ) , '.xo-cache/' ) ;
5353
5454const DEFAULT_CONFIG = {
5555 useEslintrc : false ,
5656 cache : true ,
57- cacheLocation : path . join ( cacheLocation , 'xo-cache.json' ) ,
57+ cacheLocation : path . join ( cacheLocation ( ) , 'xo-cache.json' ) ,
5858 globInputPaths : false ,
5959 baseConfig : {
6060 extends : [
@@ -131,7 +131,7 @@ const mergeWithFileConfig = options => {
131131 const tsConfigExplorer = cosmiconfigSync ( [ ] , { searchPlaces : [ 'tsconfig.json' ] , loaders : { '.json' : ( _ , content ) => JSON5 . parse ( content ) } } ) ;
132132 const { config : tsConfig , filepath : tsConfigPath } = tsConfigExplorer . search ( options . filePath ) || { } ;
133133
134- options . tsConfigPath = getTsConfigCachePath ( [ options . filePath ] , options . tsConfigPath ) ;
134+ options . tsConfigPath = getTsConfigCachePath ( [ options . filePath ] , options . tsConfigPath , options . cwd ) ;
135135 options . ts = true ;
136136 outputJsonSync ( options . tsConfigPath , makeTSConfig ( tsConfig , tsConfigPath , [ options . filePath ] ) ) ;
137137 }
@@ -187,7 +187,7 @@ const mergeWithFileConfigs = async (files, options, configFiles) => {
187187 await Promise . all ( Object . entries ( groupBy ( groups . filter ( ( { options} ) => Boolean ( options . ts ) ) , group => group . options . tsConfigPath || '' ) ) . map (
188188 ( [ tsConfigPath , groups ] ) => {
189189 const files = groups . flatMap ( group => group . files ) ;
190- const cachePath = getTsConfigCachePath ( files , tsConfigPath ) ;
190+ const cachePath = getTsConfigCachePath ( files , tsConfigPath , options . cwd ) ;
191191
192192 for ( const group of groups ) {
193193 group . options . tsConfigPath = cachePath ;
@@ -206,8 +206,8 @@ const findApplicableConfig = (file, configFiles) => configFiles.find(({filepath}
206206Generate a unique and consistent path for the temporary `tsconfig.json`.
207207Hashing based on https://github.com/eslint/eslint/blob/cf38d0d939b62f3670cdd59f0143fd896fccd771/lib/cli-engine/lint-result-cache.js#L30
208208*/
209- const getTsConfigCachePath = ( files , tsConfigPath ) => path . join (
210- cacheLocation ,
209+ const getTsConfigCachePath = ( files , tsConfigPath , cwd ) => path . join (
210+ cacheLocation ( cwd ) ,
211211 `tsconfig.${ murmur ( `${ pkg . version } _${ nodeVersion } _${ stringify ( { files : files . sort ( ) , tsConfigPath} ) } ` ) . result ( ) . toString ( 36 ) } .json` ,
212212) ;
213213
0 commit comments