Skip to content

Commit

Permalink
Make typescript linter happy
Browse files Browse the repository at this point in the history
  • Loading branch information
muodov committed Jan 10, 2025
1 parent 9b74d0c commit db74257
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 6 additions & 1 deletion scripts/rebuild-filterlist.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ const easylistRevision = fs.readFileSync(path.join(rulesDir, 'filterlists', 'eas

const MAX_DOMAIN_RANK = 100000;

/** @typedef {{ rules: Record<string, string[]>}} FilterlistJSON */

/** @type {Map<string, string>} */
let domainMap;

/**
Expand All @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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) {
Expand Down
5 changes: 3 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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/*"]
}

0 comments on commit db74257

Please sign in to comment.