@@ -92,7 +92,17 @@ function parseEditorConfigContent(content: string): Record<string, any> {
9292 const [ key , ...values ] = line . split ( '=' ) ;
9393 if ( key && values . length > 0 ) {
9494 const trimmedKey = key . trim ( ) ;
95- const value = values . join ( '=' ) . trim ( ) ;
95+ let value : any = values . join ( '=' ) . trim ( ) ;
96+
97+ // Convert boolean-like and numeric values.
98+ if ( value . toLowerCase ( ) === 'true' ) {
99+ value = true ;
100+ } else if ( value . toLowerCase ( ) === 'false' ) {
101+ value = false ;
102+ } else if ( ! isNaN ( Number ( value ) ) ) {
103+ value = Number ( value ) ;
104+ }
105+
96106 if ( currentSection ) {
97107 // Ensure the current section is initialized.
98108 if ( ! config [ currentSection ] ) {
@@ -114,7 +124,7 @@ function getEditorConfig(filePath: string): any {
114124 const rootDir : string = path . parse ( currentDir ) . root ;
115125
116126 // Traverse from the file's directory to the root directory.
117- for ( ; ; ) {
127+ for ( ; ; ) {
118128 const editorConfigPath : string = path . join ( currentDir , '.editorconfig' ) ;
119129 if ( fs . existsSync ( editorConfigPath ) ) {
120130 const configFileContent : string = fs . readFileSync ( editorConfigPath , 'utf-8' ) ;
@@ -139,7 +149,7 @@ function getEditorConfig(filePath: string): any {
139149 } ) ;
140150
141151 // Check if the current .editorconfig is the root.
142- if ( configData [ '*' ] ?. root ?. toLowerCase ( ) === 'true' ) {
152+ if ( configData [ '*' ] ?. root ) {
143153 break ; // Stop searching after processing the root = true file.
144154 }
145155 }
0 commit comments