@@ -43,10 +43,10 @@ import ignore from "ignore";
4343import stripJsonComments from "strip-json-comments" ;
4444
4545// Cache for gitignore patterns to avoid repeatedly parsing .gitignore files
46- let gitignoreCache : Map < string , ReturnType < typeof ignore > > = new Map ( ) ;
46+ const gitignoreCache : Map < string , ReturnType < typeof ignore > > = new Map ( ) ;
4747
4848// Cache for workspace root detection to avoid repeated filesystem calls
49- let workspaceRootCache : Map < string , string | null > = new Map ( ) ;
49+ const workspaceRootCache : Map < string , string | null > = new Map ( ) ;
5050
5151interface HtmlHintSettings {
5252 configFile : string ;
@@ -75,7 +75,7 @@ let linter: {
7575 * A value of null means a .htmlhintrc object didn't exist at the given path.
7676 * A value of undefined means the file at this path hasn't been loaded yet, or should be reloaded because it changed
7777 */
78- let htmlhintrcOptions : Record < string , HtmlHintConfig | null | undefined > = { } ;
78+ const htmlhintrcOptions : Record < string , HtmlHintConfig | null | undefined > = { } ;
7979
8080/**
8181 * Given an htmlhint.Error type return a VS Code server Diagnostic object
@@ -219,7 +219,7 @@ function findConfigForHtmlFile(base: string): HtmlHintConfig | undefined {
219219 }
220220
221221 // Move to parent directory
222- let parentBase = path . dirname ( base ) ;
222+ const parentBase = path . dirname ( base ) ;
223223 if ( parentBase === base ) {
224224 // Reached root directory, stop searching
225225 break ;
@@ -246,7 +246,7 @@ function loadConfigurationFile(configFile: string): HtmlHintConfig | null {
246246 if ( fs . existsSync ( configFile ) ) {
247247 trace ( `[HTMLHint Debug] Config file exists, reading: ${ configFile } ` ) ;
248248 try {
249- let config = fs . readFileSync ( configFile , "utf8" ) ;
249+ const config = fs . readFileSync ( configFile , "utf8" ) ;
250250 ruleset = JSON . parse ( stripJsonComments ( config ) ) ;
251251 trace (
252252 `[HTMLHint Debug] Successfully parsed config: ${ JSON . stringify ( ruleset ) } ` ,
@@ -385,8 +385,8 @@ function validateTextDocument(
385385 }
386386}
387387
388- let connection : Connection = createConnection ( ) ;
389- let documents : TextDocuments < TextDocument > = new TextDocuments ( TextDocument ) ;
388+ const connection : Connection = createConnection ( ) ;
389+ const documents : TextDocuments < TextDocument > = new TextDocuments ( TextDocument ) ;
390390documents . listen ( connection ) ;
391391
392392function trace ( message : string , verbose ?: string ) : void {
@@ -2596,7 +2596,7 @@ connection.onInitialize(
25962596 htmlhint . HTMLHint ||
25972597 htmlhint ) as typeof linter ;
25982598
2599- let result : InitializeResult = {
2599+ const result : InitializeResult = {
26002600 capabilities : {
26012601 textDocumentSync : TextDocumentSyncKind . Incremental ,
26022602 codeActionProvider : {
@@ -2651,16 +2651,16 @@ function doValidate(connection: Connection, document: TextDocument): void {
26512651 return ;
26522652 }
26532653
2654- let uri = document . uri ;
2654+ const uri = document . uri ;
26552655 // Convert URI to file path using vscode-uri
2656- let fsPath = URI . parse ( uri ) . fsPath ;
2656+ const fsPath = URI . parse ( uri ) . fsPath ;
26572657
26582658 trace ( `[DEBUG] doValidate called for: ${ fsPath } ` ) ;
26592659
26602660 // Check if file should be ignored based on .gitignore
26612661 if ( settings . htmlhint . ignoreGitignore ) {
26622662 // Find workspace root by looking for .git directory or .gitignore file
2663- let workspaceRoot = findWorkspaceRoot ( fsPath ) ;
2663+ const workspaceRoot = findWorkspaceRoot ( fsPath ) ;
26642664 if ( workspaceRoot && shouldIgnoreFile ( fsPath , workspaceRoot ) ) {
26652665 trace (
26662666 `[DEBUG] File ${ fsPath } is ignored by .gitignore, skipping validation` ,
@@ -2671,15 +2671,15 @@ function doValidate(connection: Connection, document: TextDocument): void {
26712671 }
26722672 }
26732673
2674- let contents = document . getText ( ) ;
2674+ const contents = document . getText ( ) ;
26752675
2676- let config = getConfiguration ( fsPath ) ;
2676+ const config = getConfiguration ( fsPath ) ;
26772677 trace ( `[DEBUG] Loaded config: ${ JSON . stringify ( config ) } ` ) ;
26782678
2679- let errors : htmlhint . Error [ ] = linter . verify ( contents , config ) ;
2679+ const errors : htmlhint . Error [ ] = linter . verify ( contents , config ) ;
26802680 trace ( `[DEBUG] HTMLHint found ${ errors . length } errors` ) ;
26812681
2682- let diagnostics : Diagnostic [ ] = [ ] ;
2682+ const diagnostics : Diagnostic [ ] = [ ] ;
26832683 if ( errors . length > 0 ) {
26842684 errors . forEach ( ( each ) => {
26852685 trace ( `[DEBUG] Error found: ${ each . rule . id } - ${ each . message } ` ) ;
@@ -2766,8 +2766,8 @@ connection.onDidChangeWatchedFiles((params) => {
27662766
27672767 for ( let i = 0 ; i < params . changes . length ; i ++ ) {
27682768 // Convert URI to file path using vscode-uri
2769- let uri = params . changes [ i ] . uri ;
2770- let fsPath = URI . parse ( uri ) . fsPath ;
2769+ const uri = params . changes [ i ] . uri ;
2770+ const fsPath = URI . parse ( uri ) . fsPath ;
27712771
27722772 trace ( `[DEBUG] Processing config file change: ${ fsPath } ` ) ;
27732773 trace ( `[DEBUG] Change type: ${ params . changes [ i ] . type } ` ) ;
0 commit comments