From 590203d9ebb5fa8ee5babb63ae8b2ba12859d2c6 Mon Sep 17 00:00:00 2001 From: Charlie Fish Date: Thu, 29 Jul 2021 22:03:21 -0600 Subject: [PATCH] Adding lint rule to disallow whitespace in urls --- scripts/lint.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scripts/lint.js b/scripts/lint.js index b72d219..91b1855 100644 --- a/scripts/lint.js +++ b/scripts/lint.js @@ -59,6 +59,16 @@ const path = require("path"); hasError = true; } } + + // Ensure that the URL doesn't contain whitespace characters + if (line.startsWith("0.0.0.0 ")) { + const lineNoIP = line.replace("0.0.0.0 ", ""); + const url = lineNoIP.split("#")[0].trim(); + if (/\s/gmu.test(url)) { + console.error(`Line ${index + 1} in ${file} url ${url} contains whitespace in the URL.`); + hasError = true; + } + } }); })); -- 2.47.2