Skip to content

Commit b8b37c0

Browse files
authored
Merge pull request #4 from jerone/bugfix/linter
2 parents a2f2ffd + be9dc7f commit b8b37c0

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

.config/cspell-words.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1+
Dsonar
12
fileoverview
23
issuetracker
34
Jeroen
5+
jerone
46
linkify
57
pjax
68
setext
9+
sonarcloud
10+
sonarlint
11+
sonarsource
712
sublist
13+
temurin
814
Warmerdam

scripts/lint/index.cjs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ const {
2424

2525
const enableDebug = false;
2626

27+
let hasError = false;
28+
2729
function assert(linter, condition, output) {
2830
if (condition) {
2931
warn(`Linter ${linter} unexpectedly failed. Maybe changed it's output.`);
@@ -40,6 +42,8 @@ function assert(linter, condition, output) {
4042
* @param {string} output Command output.
4143
*/
4244
function unsuccessful(linter, exception, output) {
45+
hasError = true;
46+
4347
if (enableDebug) {
4448
console.log(`${linter} exception:`, exception);
4549
}
@@ -80,7 +84,7 @@ function header(linter) {
8084
}
8185

8286
function footer() {
83-
console.log("");
87+
console.log(" ");
8488
}
8589

8690
/**
@@ -204,4 +208,8 @@ async function eslint() {
204208
await editorconfigChecker();
205209
await cspell();
206210
await eslint();
211+
212+
if (hasError) {
213+
process.exit(1);
214+
}
207215
})();

scripts/lint/utils.cjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"use strict";
99

1010
const path = require("node:path");
11+
const { fileURLToPath } = require("node:url");
1112

1213
/**
1314
* ANSI colors.
@@ -116,7 +117,9 @@ exports.pluralize = function (word, count) {
116117
* @returns Relative file path.
117118
*/
118119
exports.toRelativePath = function (filePath, root) {
119-
const uri = filePath.replace("file:///", "");
120+
const uri = filePath.startsWith("file:///")
121+
? fileURLToPath(filePath)
122+
: filePath;
120123
const rel = path.relative(root, uri);
121124
if (rel.startsWith("..")) return uri;
122125
return "." + path.sep + rel;

0 commit comments

Comments
 (0)