diff --git a/package.json b/package.json index 14ccfebd..555415e6 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ ], "scripts": { "lint": "eslint .", + "lint:fix": "eslint --fix .", "build:dedupe-types": "node tools/dedupe-types.js dist/esm/index.js", "build": "rollup -c && npm run build:dedupe-types && tsc -p tsconfig.esm.json", "prepare": "node ./npm-prepare.cjs", diff --git a/tools/dedupe-types.js b/tools/dedupe-types.js index ce8b16d1..e6bba030 100644 --- a/tools/dedupe-types.js +++ b/tools/dedupe-types.js @@ -23,21 +23,21 @@ import fs from "node:fs"; const files = process.argv.slice(2); files.forEach(filePath => { - const lines = fs.readFileSync(filePath, "utf8").split(/\r?\n/gu); - const typedefs = new Set(); + const lines = fs.readFileSync(filePath, "utf8").split(/\r?\n/gu); + const typedefs = new Set(); - const remainingLines = lines.filter(line => { - if (!line.startsWith("/** @typedef {import")) { - return true; - } + const remainingLines = lines.filter(line => { + if (!line.startsWith("/** @typedef {import")) { + return true; + } - if (typedefs.has(line)) { - return false; - } + if (typedefs.has(line)) { + return false; + } - typedefs.add(line); - return true; - }); + typedefs.add(line); + return true; + }); - fs.writeFileSync(filePath, remainingLines.join("\n"), "utf8"); + fs.writeFileSync(filePath, remainingLines.join("\n"), "utf8"); });