Skip to content

Commit

Permalink
Add linting to infinity-swap pkg
Browse files Browse the repository at this point in the history
  • Loading branch information
tasiov committed Nov 27, 2023
1 parent e3ea087 commit 95befc2
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 17 deletions.
4 changes: 4 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
root: true,
extends: ['@uju-labs/eslint-config-custom/library'],
};
32 changes: 16 additions & 16 deletions index.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import _ from "lodash"
import path from "path"
import fs from "fs"
import path from 'node:path';
import fs from 'node:fs';
import _ from 'lodash';

export const readChecksumFile = async (): Promise<Record<string, string>> => {
const checksumMap: Record<string, string> = {}
const checksumFilePath = path.resolve(__dirname, "./artifacts/checksums.txt")
const checksumFile = Bun.file(checksumFilePath)
const fileText = await checksumFile.text()
const lines = fileText.split("\n")
const checksumMap: Record<string, string> = {};
const checksumFilePath = path.resolve(__dirname, './artifacts/checksums.txt');
const checksumFile = Bun.file(checksumFilePath);
const fileText = await checksumFile.text();
const lines = fileText.split('\n');
for (const line of lines) {
const [checksum, fileName] = line.split(/\s+/)
const [checksum, fileName] = line.split(/\s+/);
if (!checksum || !fileName) {
continue
continue;
}
checksumMap[checksum] = fileName
checksumMap[checksum] = fileName;
}
return checksumMap
}
return checksumMap;
};

export async function readWasmFile(fileName: string) {
const wasmFile = path.resolve(__dirname, "./artifacts", fileName)
return fs.readFileSync(wasmFile, { encoding: null })
export function readWasmFile(fileName: string): Buffer {
const wasmFile = path.resolve(__dirname, './artifacts', fileName);
return fs.readFileSync(wasmFile, { encoding: null });
}
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"artifacts"
],
"scripts": {
"lint": "eslint --fix .",
"wasm": "cargo build --release --lib --target wasm32-unknown-unknown",
"gen:schema": "./scripts/schema.sh",
"dist": "tsc -p ./tsconfig.json",
Expand All @@ -18,7 +19,10 @@
"test:unit": "cargo test --lib -- --nocapture"
},
"devDependencies": {
"@uju-labs/eslint-config-custom": "workspace:*"
},
"dependencies": {
"lodash": "^4.17.21",
"typescript": "^5.2.2"
"typescript": "5.1.6"
}
}

0 comments on commit 95befc2

Please sign in to comment.