Skip to content

Commit

Permalink
fix: format
Browse files Browse the repository at this point in the history
  • Loading branch information
javadkh2 committed Oct 16, 2023
1 parent 749bdd4 commit 6a059ed
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 19 deletions.
6 changes: 3 additions & 3 deletions packages/libs/client-utils/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ require('@rushstack/eslint-config/patch/modern-module-resolution');
module.exports = {
extends: ['@kadena-dev/eslint-config/profile/lib'],
parserOptions: { tsconfigRootDir: __dirname },
"rules": {
"@typescript-eslint/explicit-function-return-type": "off",
"@rushstack/typedef-var": "off"
rules: {
'@typescript-eslint/explicit-function-return-type': 'off',
'@rushstack/typedef-var': 'off',
},
};
6 changes: 3 additions & 3 deletions packages/libs/client-utils/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<!-- genericHeader start -->

# @kadena/client-examples
# @kadena/client-utils

Test project to verify pactjs-cli and pactjs-generator
Utility functions build as a wrapper around @kadena/client

<picture>
<source srcset="https://raw.githubusercontent.com/kadena-community/kadena.js/main/common/images/Kadena.JS_logo-white.png" media="(prefers-color-scheme: dark)"/>
Expand Down Expand Up @@ -30,4 +30,4 @@ Ideas:
- marmalade
- principles
- namespace
-
-
2 changes: 1 addition & 1 deletion packages/libs/client-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
"src"
],
"scripts": {
"generate-pipe-type": "ts-node src/scripts/create-async-pipe-type.ts 30",
"build": "pnpm run generate-pipe-type && tsc",
"dev:postinstall": "pnpm run pactjs:generate:contract",
"format": "pnpm run /^format:.*/",
"format:lint": "pnpm run lint:src --fix",
"format:md": "remark README.md -o --use @kadena-dev/markdown",
"format:src": "prettier . --cache --write",
"generate-pipe-type": "ts-node src/scripts/create-async-pipe-type.ts 30",
"lint": "pnpm run /^lint:.*/",
"lint:fmt": "prettier . --cache --check",
"lint:pkg": "lint-package",
Expand Down
2 changes: 1 addition & 1 deletion packages/libs/client-utils/src/coin/transfer-create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import {
setMeta,
} from '@kadena/client/fp';

import type { IClientConfig } from '../core/utils/helpers';
import { submitClient } from '../core/rich-client';
import type { IClientConfig } from '../core/utils/helpers';

interface ICreateTransferInput {
sender: { account: string; publicKeys: string[] };
Expand Down
6 changes: 2 additions & 4 deletions packages/libs/client-utils/src/core/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@ import type {
IPactCommand,
ISignFunction,
} from '@kadena/client';
import type { ChainId } from '@kadena/types';
import { isSignedTransaction } from '@kadena/client';
import type { ChainId , ICommand, IUnsignedCommand } from '@kadena/types';

import type { Any } from './types';

import { isSignedTransaction } from '@kadena/client';
import type { ICommand, IUnsignedCommand } from '@kadena/types';

export const inspect =
<T extends Any>(tag: string) =>
(data: T): T => {
Expand Down
4 changes: 3 additions & 1 deletion packages/libs/client-utils/src/core/utils/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ export type First<T extends Any[]> = T extends [infer One]
? HD
: never;

// eslint-disable-next-line @typescript-eslint/no-unused-vars
export type Tail<T extends Any[]> = T extends [infer _]
? []
: T extends [infer _, ...infer TL]
: // eslint-disable-next-line @typescript-eslint/no-unused-vars
T extends [infer _, ...infer TL]
? TL
: never;
6 changes: 3 additions & 3 deletions packages/libs/client-utils/src/core/utils/with-emitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ import type { Any, AnyFunc, First, IfAny, Tail } from './types';

// the default EventTarget does not throw errors when dispatching events
class MyEventTarget {
private _listeners: Record<string, ((data: any) => void)[]> = {};
private _listeners: Record<string, ((data: Any) => void)[]> = {};

public addEventListener(event: string, cb: (event: any) => void) {
public addEventListener(event: string, cb: (event: Any) => void) {
if (this._listeners[event] === undefined) {
this._listeners[event] = [];
}
this._listeners[event].push(cb);
}

public dispatchEvent(event: string, data: any) {
public dispatchEvent(event: string, data: Any) {
if (this._listeners[event] === undefined) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import type { Any } from '../../core/utils/types';

export const withStepFactory = () => {
let step = 0;
return <
Args extends any[],
Rt extends any,
Args extends Any[],
Rt extends Any,
T extends (step: number, ...args: Args) => Rt,
>(
cb: T,
Expand Down
2 changes: 1 addition & 1 deletion packages/libs/client-utils/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "./node_modules/@kadena-dev/heft-rig/tsconfig-base.json",
"compilerOptions": {
"types": [".kadena/pactjs-generated","jest"],
"types": [".kadena/pactjs-generated", "jest"],
"lib": ["es2019", "DOM"]
}
}

0 comments on commit 6a059ed

Please sign in to comment.