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 25, 2024
1 parent 67d7694 commit b3510a6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
3 changes: 2 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ export default [
ignores: [
"**/examples",
"**/coverage",
"**/tests/fixtures"
"**/tests/fixtures",
"dist"
]
},
{
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,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 b3510a6

Please sign in to comment.