Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade node and deps #312

Merged
merged 9 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: '14.x'
node-version: '22.13.0'
cache: 'npm'
- name: Install NPM packages
run: npm ci
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: '14.x'
node-version: '22.13.0'
cache: 'yarn'
registry-url: 'https://registry.npmjs.org'
- run: yarn install --frozen-lockfile
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: '18.6.0'
node-version: '22.13.0'
cache: 'yarn'
- name: Install packages
run: yarn
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:18-buster-slim
FROM node:22-bullseye-slim

WORKDIR /usr/src/app

Expand Down
48 changes: 48 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import promise from "eslint-plugin-promise";
import globals from "globals";
import tsParser from "@typescript-eslint/parser";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});

export default [{
ignores: ["**/aion_crypto.js", "**/sjcl.js"],
}, ...compat.extends("eslint:recommended", "plugin:@typescript-eslint/recommended"), {
plugins: {
"@typescript-eslint": typescriptEslint,
promise,
},

languageOptions: {
globals: {
...globals.browser,
},

parser: tsParser,
ecmaVersion: 12,
sourceType: "module",
},

rules: {
"promise/no-return-wrap": "error",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-expressions": "off",
"@typescript-eslint/no-require-imports": "off",

"@typescript-eslint/no-unused-vars": ["error", {
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_",
}],
},
}];
2 changes: 1 addition & 1 deletion lib/av_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { randomKeyPair } from './av_client/generate_key_pair';
import { generateReceipt } from './av_client/generate_receipt';
import { Buffer } from 'buffer'
import * as Crypto from "../lib/av_client/aion_crypto.js"
import jwtDecode, { JwtPayload } from "jwt-decode";
import { JwtPayload, jwtDecode } from "jwt-decode";

import {
fetchLatestConfig,
Expand Down
2 changes: 1 addition & 1 deletion lib/av_client/encoding/point_encoding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const bytesToPoint = (bytes: number[]): any => {
const point = crypto.pointFromBits(pointBits)

return point
} catch (err) {
} catch (_err) {
// increment
x = x.add(INCREMENTER)
}
Expand Down
10 changes: 5 additions & 5 deletions lib/av_client/short_codes.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as base from 'base-x'
import base from 'base-x'
import { InvalidTrackingCodeError } from './errors'
import * as sjcl from './sjcl'

Expand All @@ -9,9 +9,9 @@ const BASE58_PAD = BASE58[0]
const HEX_PAD = '0'

/**
* Converts from hex to base58.
* Converts from hex to base58.
* The returned base58 string is padded to 7 chars.
*
*
* @param hex hex string of 10 chars
* @returns a base58 string of 7 chars
*/
Expand All @@ -32,9 +32,9 @@ export function hexToShortCode(input: string): string {
}

/**
* Converts from base58 to hex.
* Converts from base58 to hex.
* The returned hex string is padded to 10 chars.
*
*
* @param input base58 string of 7 chars
* @returns hex string of 10 chars
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/av_verifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ export class AVVerifier {
let receiptData
try {
receiptData = JSON.parse(atob(encodedReceipt))
} catch (err) {
} catch (_err) {
throw new InvalidReceiptError("Receipt string is invalid")
}

Expand Down
2 changes: 1 addition & 1 deletion lib/util/nist_converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function nistCvrToAvCvr(xml: string): ContestMap<string> {
try {
const content = xmlToJson(xml);
castVoteRecordReport = (content as NistDocument).CastVoteRecordReport;
} catch(error) {
} catch(_error) {
throw new Error('Failure converting malformed NIST CVR');
}

Expand Down
55 changes: 29 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "4.3.3",
"version": "4.4.0",
"name": "@aion-dk/js-client",
"license": "MIT",
"description": "Assembly Voting JS client",
Expand All @@ -24,36 +24,39 @@
"dist/lib/**/*"
],
"engines": {
"node": ">=14"
"node": ">=22"
},
"dependencies": {
"axios": "^1.6.0",
"base-x": "^4.0.0",
"axios": "^1.7.9",
"base-x": "^5.0.0",
"buffer": "^6.0.3",
"jwt-decode": "^3.1.2",
"jwt-decode": "^4.0.0",
"xml-js": "^1.6.11"
},
"devDependencies": {
"@istanbuljs/nyc-config-typescript": "^1.0.1",
"@types/chai": "^4.2.21",
"@types/mocha": "^9.0.0",
"@types/node": "^20.4.1",
"@types/sjcl": "^1.0.30",
"@typescript-eslint/eslint-plugin": "^5.9.1",
"@typescript-eslint/parser": "^5.9.1",
"chai": "^4.3.4",
"dotenv": "^16.0.0",
"eslint": "^8.7.0",
"eslint-plugin-promise": "^6.0.0",
"mocha": "^9.1.3",
"nock": "^13.1.3",
"nyc": "^15.1.0",
"sinon": "^12.0.1",
"source-map-support": "^0.5.20",
"ts-node": "^10.4.0",
"typedoc": "^0.22.4",
"typescript": "^4.5.4",
"webpack": "^5.69.1",
"webpack-cli": "^4.9.2"
"@eslint/eslintrc": "^3.2.0",
"@eslint/js": "^9.18.0",
"@istanbuljs/nyc-config-typescript": "^1.0.2",
"@types/chai": "^5.0.1",
"@types/mocha": "^10.0.10",
"@types/node": "^22.10.7",
"@types/sjcl": "^1.0.34",
"@typescript-eslint/eslint-plugin": "^8.20.0",
"@typescript-eslint/parser": "^8.20.0",
"chai": "^5.1.2",
"dotenv": "^16.4.7",
"eslint": "^9.18.0",
"eslint-plugin-promise": "^7.2.1",
"globals": "^15.14.0",
"mocha": "^11.0.1",
"nock": "^13.5.6",
"nyc": "^17.1.0",
"sinon": "^19.0.2",
"source-map-support": "^0.5.21",
"ts-node": "^10.9.2",
"typedoc": "^0.27.6",
"typescript": "^5.7.3",
"webpack": "^5.97.1",
"webpack-cli": "^6.0.1"
}
}
7 changes: 5 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
"isolatedModules": true,
"declaration": true,
"strictNullChecks": true,
"outDir": "dist"
}
"outDir": "dist",
"skipLibCheck": true,
},
"include": ["lib/**/*", "test/**/*"],
"exclude": ["node_modules"],
}
Loading
Loading