@@ -92,7 +92,17 @@ function parseEditorConfigContent(content: string): Record<string, any> {
92
92
const [ key , ...values ] = line . split ( '=' ) ;
93
93
if ( key && values . length > 0 ) {
94
94
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
+
96
106
if ( currentSection ) {
97
107
// Ensure the current section is initialized.
98
108
if ( ! config [ currentSection ] ) {
@@ -114,7 +124,7 @@ function getEditorConfig(filePath: string): any {
114
124
const rootDir : string = path . parse ( currentDir ) . root ;
115
125
116
126
// Traverse from the file's directory to the root directory.
117
- for ( ; ; ) {
127
+ for ( ; ; ) {
118
128
const editorConfigPath : string = path . join ( currentDir , '.editorconfig' ) ;
119
129
if ( fs . existsSync ( editorConfigPath ) ) {
120
130
const configFileContent : string = fs . readFileSync ( editorConfigPath , 'utf-8' ) ;
@@ -139,7 +149,7 @@ function getEditorConfig(filePath: string): any {
139
149
} ) ;
140
150
141
151
// Check if the current .editorconfig is the root.
142
- if ( configData [ '*' ] ?. root ?. toLowerCase ( ) === 'true' ) {
152
+ if ( configData [ '*' ] ?. root ) {
143
153
break ; // Stop searching after processing the root = true file.
144
154
}
145
155
}
0 commit comments