diff --git a/.changeset/five-things-cough.md b/.changeset/five-things-cough.md new file mode 100644 index 00000000..22f384fc --- /dev/null +++ b/.changeset/five-things-cough.md @@ -0,0 +1,5 @@ +--- +"@evolution-sdk/evolution": patch +--- + +Update lint compatibility for the ESLint JavaScript config 10 upgrade. diff --git a/package.json b/package.json index 29153202..64891c54 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "@effect/vitest": "^0.29.0", "@eslint/compat": "^1.3.2", "@eslint/eslintrc": "^3.3.1", - "@eslint/js": "^9.34.0", + "@eslint/js": "^10.0.1", "@turbo/gen": "^2.5.6", "@types/node": "^24.3.0", "@typescript-eslint/eslint-plugin": "^8.40.0", diff --git a/packages/evolution/src/CBOR.ts b/packages/evolution/src/CBOR.ts index 49c209d7..9cb8f29d 100644 --- a/packages/evolution/src/CBOR.ts +++ b/packages/evolution/src/CBOR.ts @@ -322,7 +322,7 @@ const FLOAT64_BYTES = new Uint8Array(FLOAT64_BUF) export const encodeArrayAsDefinite = (items: ReadonlyArray): Uint8Array => { const len = items.length // Compute header length based on array length (major type 4: arrays) - let headerLen = 0 + let headerLen: number if (len < 24) headerLen = 1 else if (len < 256) headerLen = 2 else if (len < 65536) headerLen = 3 @@ -391,7 +391,7 @@ export const encodeTaggedValue = (tag: number, valueBytes: Uint8Array): Uint8Arr if (tag < 0) throw new Error("CBOR.encodeTaggedValue: negative tag") // Compute header length based on tag value (major type 6: tags) - let headerLen = 0 + let headerLen: number if (tag < 24) headerLen = 1 else if (tag < 256) headerLen = 2 else if (tag < 65536) headerLen = 3 @@ -1553,8 +1553,8 @@ const encodeTagSync = (tag: number, value: CBOR, options: CodecOptions, fmt?: CB return out } const useMinimal = options.mode !== "custom" || options.useMinimalEncoding - let headerSize = 0 - let h0 = 0, + let headerSize: number + let h0: number, h1 = 0, h2 = 0 if (tag < 24) { @@ -2431,8 +2431,8 @@ const decodeLengthSync = (data: Uint8Array, offset: number): { length: number; b const firstByte = data[offset] const majorType = (firstByte >> 5) & 0x07 const additionalInfo = firstByte & 0x1f - let length = 0 - let bytesRead = 0 + let length: number + let bytesRead: number if ( majorType !== CBOR_MAJOR_TYPE.BYTE_STRING && majorType !== CBOR_MAJOR_TYPE.TEXT_STRING && diff --git a/packages/evolution/test/SignData.Parity.test.ts b/packages/evolution/test/SignData.Parity.test.ts index 80c77a4c..bc886797 100644 --- a/packages/evolution/test/SignData.Parity.test.ts +++ b/packages/evolution/test/SignData.Parity.test.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ /* eslint-disable @typescript-eslint/no-non-null-asserted-optional-chain */ import * as CML from "@dcspark/cardano-multiplatform-lib-nodejs" import * as M from "@emurgo/cardano-message-signing-nodejs" @@ -52,8 +51,8 @@ export function verifyData( const cose1Address = (() => { try { return toHex(protectedHeaders.header(M.Label.new_text("address"))?.as_bytes()!) - } catch (_e) { - throw new Error("No address found in signature.") + } catch (cause) { + throw new Error("No address found in signature.", { cause }) } })() @@ -62,8 +61,8 @@ export function verifyData( const int = protectedHeaders.algorithm_id()?.as_int() if (int?.is_positive()) return parseInt(int.as_positive()?.to_str()!) return parseInt(int?.as_negative()?.to_str()!) - } catch (_e) { - throw new Error("Failed to retrieve Algorithm Id.") + } catch (cause) { + throw new Error("Failed to retrieve Algorithm Id.", { cause }) } })() @@ -72,8 +71,8 @@ export function verifyData( const int = key.algorithm_id()?.as_int() if (int?.is_positive()) return parseInt(int.as_positive()?.to_str()!) return parseInt(int?.as_negative()?.to_str()!) - } catch (_e) { - throw new Error("Failed to retrieve Algorithm Id.") + } catch (cause) { + throw new Error("Failed to retrieve Algorithm Id.", { cause }) } })() @@ -82,8 +81,8 @@ export function verifyData( const int = key.header(M.Label.new_int(M.Int.new_negative(M.BigNum.from_str("1"))))?.as_int() if (int?.is_positive()) return parseInt(int.as_positive()?.to_str()!) return parseInt(int?.as_negative()?.to_str()!) - } catch (_e) { - throw new Error("Failed to retrieve Curve.") + } catch (cause) { + throw new Error("Failed to retrieve Curve.", { cause }) } })() @@ -92,8 +91,8 @@ export function verifyData( const int = key.key_type().as_int() if (int?.is_positive()) return parseInt(int.as_positive()?.to_str()!) return parseInt(int?.as_negative()?.to_str()!) - } catch (_e) { - throw new Error("Failed to retrieve Key Type.") + } catch (cause) { + throw new Error("Failed to retrieve Key Type.", { cause }) } })() @@ -102,16 +101,16 @@ export function verifyData( return CML.PublicKey.from_bytes( key.header(M.Label.new_int(M.Int.new_negative(M.BigNum.from_str("2"))))?.as_bytes()! ) - } catch (_e) { - throw new Error("No public key found.") + } catch (cause) { + throw new Error("No public key found.", { cause }) } })() const cose1Payload = (() => { try { return toHex(cose1.payload()!) - } catch (_e) { - throw new Error("No payload found.") + } catch (cause) { + throw new Error("No payload found.", { cause }) } })() diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3fd93fee..d4b80493 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -39,8 +39,8 @@ importers: specifier: ^3.3.1 version: 3.3.5 '@eslint/js': - specifier: ^9.34.0 - version: 9.39.4 + specifier: ^10.0.1 + version: 10.0.1(eslint@10.2.1(jiti@2.6.1)) '@turbo/gen': specifier: ^2.5.6 version: 2.9.6(@types/node@24.3.0) @@ -1195,9 +1195,14 @@ packages: resolution: {integrity: sha512-4IlJx0X0qftVsN5E+/vGujTRIFtwuLbNsVUe7TO6zYPDR1O6nFwvwhIKEKSrl6dZchmYBITazxKoUYOjdtjlRg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@eslint/js@9.39.4': - resolution: {integrity: sha512-nE7DEIchvtiFTwBw4Lfbu59PG+kCofhjsKaCWzxTpt4lfRjRMqG6uMBzKXuEcyXhOHoUp9riAm7/aWYGhXZ9cw==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@eslint/js@10.0.1': + resolution: {integrity: sha512-zeR9k5pd4gxjZ0abRoIaxdc7I3nDktoXZk2qOv9gCNWx3mVwEn32VRhyLaRsDiJjTs0xq/T8mfPtyuXu7GWBcA==} + engines: {node: ^20.19.0 || ^22.13.0 || >=24} + peerDependencies: + eslint: ^10.0.0 + peerDependenciesMeta: + eslint: + optional: true '@eslint/object-schema@3.0.5': resolution: {integrity: sha512-vqTaUEgxzm+YDSdElad6PiRoX4t8VGDjCtt05zn4nU810UIx/uNEV7/lZJ6KwFThKZOzOxzXy48da+No7HZaMw==} @@ -7890,7 +7895,9 @@ snapshots: transitivePeerDependencies: - supports-color - '@eslint/js@9.39.4': {} + '@eslint/js@10.0.1(eslint@10.2.1(jiti@2.6.1))': + optionalDependencies: + eslint: 10.2.1(jiti@2.6.1) '@eslint/object-schema@3.0.5': {}