Skip to content

Commit f37ffbd

Browse files
authored
Merge pull request #379 from htmlhint/dev/coliff/update-mocha-typescript
Update mocha & typescript
2 parents b5658f8 + e0244b8 commit f37ffbd

11 files changed

Lines changed: 143 additions & 678 deletions

File tree

.github/workflows/test.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ name: Tests
22

33
on:
44
push:
5-
branches:
6-
- main
7-
- "!dependabot/**"
5+
branches-ignore:
6+
- dependabot/**
87
pull_request:
98
workflow_dispatch:
109

eslint.config.js

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ const tsparser = require("@typescript-eslint/parser");
44
const prettier = require("eslint-config-prettier");
55
const globals = require("globals");
66

7+
const strictRules = {
8+
curly: "error",
9+
eqeqeq: "error",
10+
"no-var": "error",
11+
"prefer-const": "error",
12+
};
13+
714
module.exports = [
815
{
916
ignores: [
@@ -39,10 +46,9 @@ module.exports = [
3946
},
4047
rules: {
4148
...tseslint.configs.recommended.rules,
49+
...strictRules,
4250
"no-console": "error",
4351
"no-empty": "off",
44-
"no-var": "off",
45-
"prefer-const": "off",
4652
"@typescript-eslint/explicit-module-boundary-types": "off",
4753
"@typescript-eslint/no-empty-interface": "off",
4854
"@typescript-eslint/no-explicit-any": "off",
@@ -71,10 +77,9 @@ module.exports = [
7177
},
7278
},
7379
rules: {
80+
...strictRules,
7481
"no-console": "error",
7582
"no-empty": "off",
76-
"no-var": "off",
77-
"prefer-const": "off",
7883
"no-unused-vars": [
7984
"error",
8085
{
@@ -85,5 +90,14 @@ module.exports = [
8590
],
8691
},
8792
},
93+
{
94+
files: ["htmlhint/server/server.js"],
95+
rules: {
96+
curly: "off",
97+
eqeqeq: "off",
98+
"no-var": "off",
99+
"prefer-const": "off",
100+
},
101+
},
88102
prettier,
89103
];

htmlhint-server/package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

htmlhint-server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
},
1717
"devDependencies": {
1818
"@types/node": "22.19.17",
19-
"typescript": "5.8.3"
19+
"typescript": "5.9.3"
2020
},
2121
"engines": {
2222
"node": "*"

htmlhint-server/src/server.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ import ignore from "ignore";
4343
import 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

5151
interface 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);
390390
documents.listen(connection);
391391

392392
function 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}`);

htmlhint/extension.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,20 @@ export function activate(context: vscode.ExtensionContext) {
1919
context.subscriptions.push(outputChannel);
2020

2121
// Register the create config command
22-
let createConfigCommand = vscode.commands.registerCommand(
22+
const createConfigCommand = vscode.commands.registerCommand(
2323
"htmlhint.createConfig",
2424
createHtmlHintConfig,
2525
);
2626
context.subscriptions.push(createConfigCommand);
2727

2828
// We need to go one level up since an extension compile the js code into
2929
// the output folder.
30-
let serverModulePath = path.join(__dirname, "..", "server", "server.js");
31-
let debugOptions = {
30+
const serverModulePath = path.join(__dirname, "..", "server", "server.js");
31+
const debugOptions = {
3232
execArgv: ["--nolazy", "--inspect=6010"],
3333
cwd: process.cwd(),
3434
};
35-
let serverOptions: ServerOptions = {
35+
const serverOptions: ServerOptions = {
3636
run: { module: serverModulePath, transport: TransportKind.ipc },
3737
debug: {
3838
module: serverModulePath,
@@ -42,15 +42,15 @@ export function activate(context: vscode.ExtensionContext) {
4242
};
4343

4444
// Get file types to lint from user settings
45-
let config = vscode.workspace.getConfiguration("htmlhint");
46-
let languages: string[] = config.get("documentSelector") || ["html", "htm"];
47-
let documentSelector = languages.map((language) => ({
45+
const config = vscode.workspace.getConfiguration("htmlhint");
46+
const languages: string[] = config.get("documentSelector") || ["html", "htm"];
47+
const documentSelector = languages.map((language) => ({
4848
language,
4949
scheme: "file",
5050
}));
5151

5252
// Set options
53-
let clientOptions: LanguageClientOptions = {
53+
const clientOptions: LanguageClientOptions = {
5454
documentSelector,
5555
diagnosticCollectionName: "htmlhint",
5656
synchronize: {

htmlhint/package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

htmlhint/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
"@types/node": "^22.19.17",
9595
"@types/vscode": "^1.101.0",
9696
"@vscode/test-electron": "^2.5.2",
97-
"typescript": "5.8.3"
97+
"typescript": "5.9.3"
9898
},
9999
"dependencies": {
100100
"htmlhint": "1.9.2",

0 commit comments

Comments
 (0)