Skip to content

Commit

Permalink
Update eslint-config-haykam to version 1.19.0
Browse files Browse the repository at this point in the history
  • Loading branch information
haykam821 committed Mar 7, 2023
1 parent 9afa4b3 commit ed17eaf
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 34 deletions.
17 changes: 5 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,13 @@
"@types/estree": "^0.0.46",
"@types/fs-extra": "^9.0.8",
"@types/js-beautify": "^1.13.1",
"@types/node": "^13.9.3",
"@types/node": "^18.14.6",
"@types/puppeteer": "^5.4.3",
"@types/string-format": "^2.0.0",
"@typescript-eslint/eslint-plugin": "^4.18.0",
"@typescript-eslint/parser": "^4.18.0",
"eslint": "^7.21.0",
"eslint-config-haykam": "^1.10.0",
"eslint-plugin-extra-rules": "^0.0.0-development",
"eslint-plugin-html": "^6.1.1",
"eslint-plugin-jsdoc": "^32.2.0",
"eslint-plugin-json": "^2.1.2",
"eslint-plugin-markdown": "^2.0.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-unicorn": "^28.0.2",
"@typescript-eslint/eslint-plugin": "^5.54.1",
"@typescript-eslint/parser": "^5.54.1",
"eslint": "^8.35.0",
"eslint-config-haykam": "^1.19.0",
"ts-node-dev": "^1.1.6",
"typescript": "^4.2.3"
},
Expand Down
14 changes: 8 additions & 6 deletions src/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,14 @@ export default async function start(args: RedditDataminerOptions): Promise<strin
}

if (args.hashes) {
await fse.writeJSON(args.hashes, hashes).then(written => {
hashesLog("saved new hashes to %s", args.hashes);
return written;
}).catch(() => {
hashesLog("failed to save new hashes");
});
await fse.writeJSON(args.hashes, hashes)
.then(written => {
hashesLog("saved new hashes to %s", args.hashes);
return written;
})
.catch(() => {
hashesLog("failed to save new hashes");
});
}

// Clean up
Expand Down
2 changes: 1 addition & 1 deletion src/util/dump-scripts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { filter } from "./filter";
import format from "string-format";
import fse from "fs-extra";
import { dumping as log } from "./log";
import path from "path";
import path from "node:path";
import { uaGot } from "./got";

/**
Expand Down
2 changes: 1 addition & 1 deletion src/util/get-hash-objects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default function getHashObjects(program: string, beforeJs = false): Recor
objects.push(convertObjectExpressionToObject(node));
} else if (beforeJs && isJsLiteral(node) && objects.length > 0) {
return [
objects[objects.length - 1],
objects.at(-1),
];
}
}
Expand Down
30 changes: 16 additions & 14 deletions src/util/get-hashes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,21 @@ import { hashes as hashesLog } from "./log";
* @returns The loaded hashes for previously-saved scripts.
*/
export default function getHashes(path: string): Promise<Record<string, string>> {
return fse.readJSON(path).then(json => {
hashesLog("loaded hashes from %s", path);
return json;
}).catch(async error => {
if (path) {
if (error.code === "ENOENT") {
await fse.writeJSON(path, {});
hashesLog("created hashes");
return {};
}
return fse.readJSON(path)
.then(json => {
hashesLog("loaded hashes from %s", path);
return json;
})
.catch(async error => {
if (path) {
if (error.code === "ENOENT") {
await fse.writeJSON(path, {});
hashesLog("created hashes");
return {};
}

hashesLog("failed to load hashes");
}
return {};
});
hashesLog("failed to load hashes");
}
return {};
});
}

0 comments on commit ed17eaf

Please sign in to comment.