6
6
*/
7
7
8
8
import * as fs from 'fs' ;
9
- import { homedir } from 'os' ;
10
9
import * as path from 'path' ;
11
10
import { TextDocument } from 'vscode-languageserver' ;
12
11
import ejs from 'ejs' ;
@@ -76,27 +75,6 @@ export const updateForceIgnoreFile = async (forceignorePath: string, addTsConfig
76
75
await fs . promises . writeFile ( forceignorePath , forceignoreContent . trim ( ) ) ;
77
76
} ;
78
77
79
- const getESLintToolVersion = async ( ) : Promise < string > => {
80
- const eslintToolDir = path . join ( homedir ( ) , 'tools' , 'eslint-tool' ) ;
81
- const packageJsonPath = path . join ( eslintToolDir , 'package.json' ) ;
82
- if ( fs . existsSync ( packageJsonPath ) ) {
83
- const packageJson = JSON . parse ( await fs . promises . readFile ( packageJsonPath , 'utf8' ) ) ;
84
- return packageJson . version ;
85
- }
86
- return '1.0.3' ;
87
- } ;
88
-
89
- const findCoreESLint = async ( ) : Promise < string > => {
90
- const eslintToolDir = path . join ( homedir ( ) , 'tools' , 'eslint-tool' ) ;
91
- if ( ! fs . existsSync ( eslintToolDir ) ) {
92
- console . warn ( 'core eslint-tool not installed: ' + eslintToolDir ) ;
93
- // default
94
- return '~/tools/eslint-tool/1.0.3/node_modules' ;
95
- }
96
- const eslintToolVersion = await getESLintToolVersion ( ) ;
97
- return path . join ( eslintToolDir , eslintToolVersion , 'node_modules' ) ;
98
- } ;
99
-
100
78
// exported for testing
101
79
export const processTemplate = ( template : string , data : any ) : string => ejs . render ( template , data ) ;
102
80
@@ -416,15 +394,11 @@ export abstract class BaseWorkspaceContext {
416
394
folders : this . workspaceRoots . map ( ( root ) => ( { path : root } ) ) ,
417
395
settings : { } ,
418
396
} ;
419
- const eslintPath = await findCoreESLint ( ) ;
420
- await this . updateCoreCodeWorkspace ( workspace . settings , eslintPath ) ;
397
+ await this . updateCoreCodeWorkspace ( workspace . settings ) ;
421
398
return workspace ;
422
399
}
423
400
424
401
private async updateCoreSettings ( settings : any ) : Promise < void > {
425
- // Get eslint path once to avoid multiple warnings
426
- const eslintPath = await findCoreESLint ( ) ;
427
-
428
402
try {
429
403
// Load core settings template
430
404
const coreSettingsTemplate = await fs . promises . readFile ( utils . getCoreResource ( 'settings-core.json' ) , 'utf8' ) ;
@@ -435,7 +409,6 @@ export abstract class BaseWorkspaceContext {
435
409
436
410
// Update eslint settings
437
411
settings [ 'eslint.workingDirectories' ] = this . workspaceRoots ;
438
- settings [ 'eslint.nodePath' ] = eslintPath ;
439
412
settings [ 'eslint.validate' ] = [ 'javascript' , 'typescript' ] ;
440
413
settings [ 'eslint.options' ] = {
441
414
overrideConfigFile : path . join ( this . workspaceRoots [ 0 ] , '.eslintrc.json' ) ,
@@ -449,17 +422,15 @@ export abstract class BaseWorkspaceContext {
449
422
console . error ( 'updateCoreSettings: Error loading core settings template:' , error ) ;
450
423
// Fallback to basic settings
451
424
settings [ 'eslint.workingDirectories' ] = this . workspaceRoots ;
452
- settings [ 'eslint.nodePath' ] = eslintPath ;
453
425
settings [ 'eslint.validate' ] = [ 'javascript' , 'typescript' ] ;
454
426
settings [ 'eslint.options' ] = {
455
427
overrideConfigFile : path . join ( this . workspaceRoots [ 0 ] , '.eslintrc.json' ) ,
456
428
} ;
457
429
}
458
430
}
459
431
460
- private async updateCoreCodeWorkspace ( settings : any , eslintPath : string ) : Promise < void > {
432
+ private async updateCoreCodeWorkspace ( settings : any ) : Promise < void > {
461
433
settings [ 'eslint.workingDirectories' ] = this . workspaceRoots ;
462
- settings [ 'eslint.nodePath' ] = eslintPath ;
463
434
settings [ 'eslint.validate' ] = [ 'javascript' , 'typescript' ] ;
464
435
settings [ 'eslint.options' ] = {
465
436
overrideConfigFile : path . join ( this . workspaceRoots [ 0 ] , '.eslintrc.json' ) ,
0 commit comments