From db74257fc7bfefd128dc18b00ad6b42190c615ec Mon Sep 17 00:00:00 2001 From: Maxim Tsoy Date: Fri, 10 Jan 2025 15:46:27 +0100 Subject: [PATCH] Make typescript linter happy --- scripts/rebuild-filterlist.mjs | 7 ++++++- tsconfig.json | 5 +++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/scripts/rebuild-filterlist.mjs b/scripts/rebuild-filterlist.mjs index ad588b24..745fa16c 100644 --- a/scripts/rebuild-filterlist.mjs +++ b/scripts/rebuild-filterlist.mjs @@ -15,6 +15,9 @@ const easylistRevision = fs.readFileSync(path.join(rulesDir, 'filterlists', 'eas const MAX_DOMAIN_RANK = 100000; +/** @typedef {{ rules: Record}} FilterlistJSON */ + +/** @type {Map} */ let domainMap; /** @@ -25,6 +28,7 @@ async function processFilterList(listFileName) { console.log(`Processing ${listFileName}`); const data = fs.readFileSync(path.join(rulesDir, 'filterlists', listFileName), 'utf-8'); const lines = data.split('\n'); + /** @type {FilterlistJSON} */ const filterlistJSON = { rules: {} }; // Remove unsupported rule types @@ -121,6 +125,7 @@ async function loadTrancoList() { if (typeof domainMap !== 'object') { const trancoCSV = fs.readFileSync(path.join(dataDir, 'top-1m.csv'), 'utf-8'); + /** @type {string[][]} */ const records = parse(trancoCSV, { columns: false, skip_empty_lines: true, @@ -136,7 +141,7 @@ async function loadTrancoList() { /** * Convert filter list to ABP format and write to disk - * @param {Object} JSONList + * @param {FilterlistJSON} JSONList * @param {String} fileName */ function convertAndWriteABP(JSONList, fileName) { diff --git a/tsconfig.json b/tsconfig.json index 3a1c4c0b..57b8ada1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,9 +4,10 @@ "allowJs": true, "checkJs": true, "resolveJsonModule": true, - "moduleResolution": "node", + "moduleResolution": "NodeNext", "noImplicitAny": true, - "allowSyntheticDefaultImports": true + "allowSyntheticDefaultImports": true, + "module": "NodeNext" }, "exclude": ["node_modules/*", "dist/*"] }