Skip to content

Commit

Permalink
Fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
nzakas committed Jul 26, 2024
1 parent 5f48e19 commit 08ee506
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
26 changes: 13 additions & 13 deletions tools/dedupe-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
});

0 comments on commit 08ee506

Please sign in to comment.