diff --git a/eslint.config.mjs b/eslint.config.mjs index dab0ade006..3e9f3c5bec 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,8 +1,8 @@ import eslint from '@eslint/js'; -import tseslint from 'typescript-eslint'; import tseslintParser from '@typescript-eslint/parser'; import prettier from 'eslint-config-prettier'; import simpleImportSort from 'eslint-plugin-simple-import-sort'; +import tseslint from 'typescript-eslint'; export default tseslint.config( // Base ESLint configuration @@ -64,7 +64,6 @@ export default tseslint.config( eqeqeq: 'error', '@typescript-eslint/no-unused-vars': [ 'error', - // Ignore argument variables starting with _ { argsIgnorePattern: '^_', caughtErrorsIgnorePattern: '^_', diff --git a/tests/end_to_end/http_server/tfjs/src/api.ts b/tests/end_to_end/http_server/tfjs/src/api.ts index 3478cde1ec..aac967b406 100644 --- a/tests/end_to_end/http_server/tfjs/src/api.ts +++ b/tests/end_to_end/http_server/tfjs/src/api.ts @@ -9,10 +9,10 @@ async function init(): Promise { tf.env().platform = { fetch, - now: () => Number(ic.time()), // TODO time probably off (look into nano vs milli) - encode: (text) => Buffer.from(text), - decode: (bytes) => Buffer.from(bytes).toString(), - isTypedArray: ((array: any) => { + now: (): number => Number(ic.time()), // TODO time probably off (look into nano vs milli) + encode: (text: string): Buffer => Buffer.from(text), + decode: (bytes: Uint8Array): string => Buffer.from(bytes).toString(), + isTypedArray: ((array: any): boolean => { return (array instanceof Float32Array || array instanceof Int32Array || array instanceof Uint8Array || diff --git a/type_tests/candid/constructed/opt.ts b/type_tests/candid/constructed/opt.ts index 1a1068e5f5..0fad7376f2 100644 --- a/type_tests/candid/constructed/opt.ts +++ b/type_tests/candid/constructed/opt.ts @@ -20,10 +20,10 @@ import { testCandidType(Opt(float32)); testSerializable(Opt(float32)); -const testTypeMapping = Opt(float32); +const _testTypeMapping = Opt(float32); export type TestTypeMapping = AssertType< NotAnyAndExact< - TypeMapping, + TypeMapping, RequireExactlyOne<{ Some: number; None: null }> > >; @@ -31,10 +31,10 @@ export type TestTypeMapping = AssertType< testCandidType(Opt(Opt(float32))); testSerializable(Opt(Opt(float32))); -const testTypeMappingDouble = Opt(Opt(float32)); +const _testTypeMappingDouble = Opt(Opt(float32)); export type TestTypeMappingDouble = AssertType< NotAnyAndExact< - TypeMapping, + TypeMapping, RequireExactlyOne<{ Some: RequireExactlyOne<{ Some: number; None: null }>; None: null; @@ -45,10 +45,10 @@ export type TestTypeMappingDouble = AssertType< testCandidType(Opt(Opt(Opt(float32)))); testSerializable(Opt(Opt(Opt(float32)))); -const testTypeMappingTriple = Opt(Opt(Opt(float32))); +const _testTypeMappingTriple = Opt(Opt(Opt(float32))); export type TestTypeMappingTriple = AssertType< NotAnyAndExact< - TypeMapping, + TypeMapping, RequireExactlyOne<{ Some: RequireExactlyOne<{ Some: RequireExactlyOne<{ Some: number; None: null }>; diff --git a/type_tests/candid/constructed/vec.ts b/type_tests/candid/constructed/vec.ts index da01c43374..69625eacb2 100644 --- a/type_tests/candid/constructed/vec.ts +++ b/type_tests/candid/constructed/vec.ts @@ -28,25 +28,25 @@ import { testCandidType(Vec(float32)); testSerializable(Vec(float32)); -const testTypeMapping = Vec(float32); +const _testTypeMapping = Vec(float32); export type TestTypeMapping = AssertType< - NotAnyAndExact, number[]> + NotAnyAndExact, number[]> >; testCandidType(Vec(Vec(float32))); testSerializable(Vec(Vec(float32))); -const testTypeMappingDouble = Vec(Vec(float32)); +const _testTypeMappingDouble = Vec(Vec(float32)); export type TestTypeMappingDouble = AssertType< - NotAnyAndExact, number[][]> + NotAnyAndExact, number[][]> >; testCandidType(Vec(Vec(Vec(float32)))); testSerializable(Vec(Vec(Vec(float32)))); -const testTypeMappingTriple = Vec(Vec(Vec(float32))); +const _testTypeMappingTriple = Vec(Vec(Vec(float32))); export type TestTypeMappingTriple = AssertType< - NotAnyAndExact, number[][][]> + NotAnyAndExact, number[][][]> >; // test nat64 @@ -54,9 +54,9 @@ export type TestTypeMappingTriple = AssertType< testCandidType(Vec(nat64)); testSerializable(Vec(nat64)); -const testTypeMappingNat64 = Vec(nat64); +const _testTypeMappingNat64 = Vec(nat64); export type TestTypeMappingNat64 = AssertType< - NotAnyAndExact, BigUint64Array> + NotAnyAndExact, BigUint64Array> >; // test nat32 @@ -64,9 +64,9 @@ export type TestTypeMappingNat64 = AssertType< testCandidType(Vec(nat32)); testSerializable(Vec(nat32)); -const testTypeMappingNat32 = Vec(nat32); +const _testTypeMappingNat32 = Vec(nat32); export type TestTypeMappingNat32 = AssertType< - NotAnyAndExact, Uint32Array> + NotAnyAndExact, Uint32Array> >; // test nat16 @@ -74,9 +74,9 @@ export type TestTypeMappingNat32 = AssertType< testCandidType(Vec(nat16)); testSerializable(Vec(nat16)); -const testTypeMappingNat16 = Vec(nat16); +const _testTypeMappingNat16 = Vec(nat16); export type TestTypeMappingNat16 = AssertType< - NotAnyAndExact, Uint16Array> + NotAnyAndExact, Uint16Array> >; // test nat8 @@ -84,9 +84,9 @@ export type TestTypeMappingNat16 = AssertType< testCandidType(Vec(nat8)); testSerializable(Vec(nat8)); -const testTypeMappingNat8 = Vec(nat8); +const _testTypeMappingNat8 = Vec(nat8); export type TestTypeMappingNat8 = AssertType< - NotAnyAndExact, Uint8Array> + NotAnyAndExact, Uint8Array> >; // test int64 @@ -94,9 +94,9 @@ export type TestTypeMappingNat8 = AssertType< testCandidType(Vec(int64)); testSerializable(Vec(int64)); -const testTypeMappingInt64 = Vec(int64); +const _testTypeMappingInt64 = Vec(int64); export type TestTypeMappingInt64 = AssertType< - NotAnyAndExact, BigInt64Array> + NotAnyAndExact, BigInt64Array> >; // test int32 @@ -104,9 +104,9 @@ export type TestTypeMappingInt64 = AssertType< testCandidType(Vec(int32)); testSerializable(Vec(int32)); -const testTypeMappingInt32 = Vec(int32); +const _testTypeMappingInt32 = Vec(int32); export type TestTypeMappingInt32 = AssertType< - NotAnyAndExact, Int32Array> + NotAnyAndExact, Int32Array> >; // test int16 @@ -114,9 +114,9 @@ export type TestTypeMappingInt32 = AssertType< testCandidType(Vec(int16)); testSerializable(Vec(int16)); -const testTypeMappingInt16 = Vec(int16); +const _testTypeMappingInt16 = Vec(int16); export type TestTypeMappingInt16 = AssertType< - NotAnyAndExact, Int16Array> + NotAnyAndExact, Int16Array> >; // test int8 @@ -124,9 +124,9 @@ export type TestTypeMappingInt16 = AssertType< testCandidType(Vec(int8)); testSerializable(Vec(int8)); -const testTypeMappingInt8 = Vec(int8); +const _testTypeMappingInt8 = Vec(int8); export type TestTypeMappingInt8 = AssertType< - NotAnyAndExact, Int8Array> + NotAnyAndExact, Int8Array> >; // test Vec type diff --git a/type_tests/candid/manual.ts b/type_tests/candid/manual.ts index 2756400122..56bb0ebd7a 100644 --- a/type_tests/candid/manual.ts +++ b/type_tests/candid/manual.ts @@ -4,7 +4,7 @@ import { AssertType, NotAnyAndExact, testCandidType } from '../assert_type'; testCandidType(Manual(text)); -const testTypeMapping = Manual(text); +const _testTypeMapping = Manual(text); export type TestTypeMapping = AssertType< - NotAnyAndExact, void> + NotAnyAndExact, void> >; diff --git a/type_tests/canister_methods/init.ts b/type_tests/canister_methods/init.ts index e71b99c2e5..8ea82088c2 100644 --- a/type_tests/canister_methods/init.ts +++ b/type_tests/canister_methods/init.ts @@ -21,7 +21,7 @@ const Reaction = Variant({ init( [bool, nat, text, User, Reaction], - (param0, param1, param2, param3, param4) => { + (param0, param1, param2, param3, _param4) => { type _Param0 = AssertType>; type _Param1 = AssertType>; type _Param2 = AssertType>; @@ -35,7 +35,7 @@ init( >; type _Param4 = AssertType< NotAnyAndExact< - typeof param4, + typeof _param4, RequireExactlyOne<{ Happy: null; Sad: null; diff --git a/type_tests/canister_methods/post_upgrade.ts b/type_tests/canister_methods/post_upgrade.ts index db43be07b0..44b283d78a 100644 --- a/type_tests/canister_methods/post_upgrade.ts +++ b/type_tests/canister_methods/post_upgrade.ts @@ -21,7 +21,7 @@ const Reaction = Variant({ postUpgrade( [bool, nat, text, User, Reaction], - (param0, param1, param2, param3, param4) => { + (param0, param1, param2, param3, _param4) => { type _Param0 = AssertType>; type _Param1 = AssertType>; type _Param2 = AssertType>; @@ -35,7 +35,7 @@ postUpgrade( >; type _Param4 = AssertType< NotAnyAndExact< - typeof param4, + typeof _param4, RequireExactlyOne<{ Happy: null; Sad: null; diff --git a/type_tests/canister_methods/query.ts b/type_tests/canister_methods/query.ts index 195b53caa1..3079726347 100644 --- a/type_tests/canister_methods/query.ts +++ b/type_tests/canister_methods/query.ts @@ -25,7 +25,7 @@ const Reaction = Variant({ query( [bool, nat, text, User, Reaction], text, - (param0, param1, param2, param3, param4) => { + (param0, param1, param2, param3, _param4) => { type _Param0 = AssertType>; type _Param1 = AssertType>; type _Param2 = AssertType>; @@ -39,7 +39,7 @@ query( >; type _Param4 = AssertType< NotAnyAndExact< - typeof param4, + typeof _param4, RequireExactlyOne<{ Happy: null; Sad: null; diff --git a/type_tests/canister_methods/update.ts b/type_tests/canister_methods/update.ts index 445452b388..df474a88db 100644 --- a/type_tests/canister_methods/update.ts +++ b/type_tests/canister_methods/update.ts @@ -25,7 +25,7 @@ const Reaction = Variant({ update( [bool, nat, text, User, Reaction], text, - (param0, param1, param2, param3, param4) => { + (param0, param1, param2, param3, _param4) => { type _Param0 = AssertType>; type _Param1 = AssertType>; type _Param2 = AssertType>; @@ -39,7 +39,7 @@ update( >; type _Param4 = AssertType< NotAnyAndExact< - typeof param4, + typeof _param4, RequireExactlyOne<{ Happy: null; Sad: null; diff --git a/type_tests/stable_structures/stable_b_tree_map.ts b/type_tests/stable_structures/stable_b_tree_map.ts index f23afb55da..2d77b911d6 100644 --- a/type_tests/stable_structures/stable_b_tree_map.ts +++ b/type_tests/stable_structures/stable_b_tree_map.ts @@ -7,43 +7,43 @@ import { AssertType, NotAnyAndExact } from '../assert_type'; // TODO these tests just make sure that the basic methods are there // TODO we want to maybe test that the type arguments work correctly as well -let mapText = StableBTreeMap(0); +let _mapText = StableBTreeMap(0); export type TestContainsKey = AssertType< - NotAnyAndExact boolean> + NotAnyAndExact boolean> >; export type TestGet = AssertType< - NotAnyAndExact any | null> + NotAnyAndExact any | null> >; export type TestInsert = AssertType< - NotAnyAndExact any | null> + NotAnyAndExact any | null> >; export type TestIsEmpty = AssertType< - NotAnyAndExact boolean> + NotAnyAndExact boolean> >; export type TestItems = AssertType< - NotAnyAndExact [any, any][]> + NotAnyAndExact [any, any][]> >; export type TestKeys = AssertType< - NotAnyAndExact any[]> + NotAnyAndExact any[]> >; export type TestLen = AssertType< - NotAnyAndExact bigint> + NotAnyAndExact bigint> >; export type TestRemove = AssertType< - NotAnyAndExact any | null> + NotAnyAndExact any | null> >; export type TestValues = AssertType< NotAnyAndExact< - typeof mapText.values, + typeof _mapText.values, (startIndex?: number, length?: number) => any[] > >;