Skip to content

Commit

Permalink
Merge pull request #67 from initia-labs/chore/cleanse
Browse files Browse the repository at this point in the history
lint: remove some rules
  • Loading branch information
joon9823 authored Jul 30, 2024
2 parents 2bd9c17 + 47a8573 commit 74de32a
Show file tree
Hide file tree
Showing 19 changed files with 63 additions and 143 deletions.
11 changes: 6 additions & 5 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ export default tseslint.config(
},
rules: {
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/unbound-method': 'off',
'@typescript-eslint/unbound-method': [
"error",
{
"ignoreStatic": true
}
],
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/require-await': 'off',
}
},
{
Expand Down
94 changes: 0 additions & 94 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
},
"devDependencies": {
"@eslint/js": "^9.5.0",
"@initia/builder.js": "^0.1.6",
"@types/bn.js": "^5.1.1",
"@types/eslint": "^8.56.10",
"@types/eslint__js": "^8.42.3",
Expand Down
8 changes: 4 additions & 4 deletions src/client/WebSocketClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,11 @@ export class WebSocketClient extends EventEmitter {

if (
this.callback &&
parsedData.result &&
parsedData.result.query === this.queryParams
parsedData.result && // eslint-disable-line @typescript-eslint/no-unsafe-member-access
parsedData.result.query === this.queryParams // eslint-disable-line @typescript-eslint/no-unsafe-member-access
) {
// this.emit('message', parsedData.result.data);
this.callback(parsedData.result.data)
this.callback(parsedData.result.data) // eslint-disable-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
}
} catch (err) {
this.emit('error', err)
Expand Down Expand Up @@ -248,7 +248,7 @@ export class WebSocketClient extends EventEmitter {

public subscribeTx(query: TendermintQuery, callback: Callback): void {
const newCallback: Callback = (d) => {
d.value.TxResult.txhash = hashToHex(d.value.TxResult.tx)
d.value.TxResult.txhash = hashToHex(d.value.TxResult.tx as string) // eslint-disable-line @typescript-eslint/no-unsafe-member-access
return callback(d)
}

Expand Down
4 changes: 2 additions & 2 deletions src/client/lcd/api/TxAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -479,11 +479,11 @@ export class TxAPI extends BaseAPI {
}

if (d.code) {
blockResult.code = d.code
blockResult.code = d.code // eslint-disable-line @typescript-eslint/no-unsafe-member-access
}

if (d.codespace) {
blockResult.codespace = d.codespace
blockResult.codespace = d.codespace // eslint-disable-line @typescript-eslint/no-unsafe-member-access
}

return blockResult
Expand Down
2 changes: 1 addition & 1 deletion src/core/authz/msgs/MsgExecAuthorized.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class MsgExecAuthorized extends JSONSerializable<
type: 'cosmos-sdk/MsgExec',
value: {
grantee,
msgs: msgs.map((msg) => {
msgs: msgs.map((msg): Msg.Amino => {
return msg.toAmino()
}),
},
Expand Down
2 changes: 1 addition & 1 deletion src/core/gov/msgs/MsgSubmitProposal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export class MsgSubmitProposal extends JSONSerializable<
return {
type: 'cosmos-sdk/v1/MsgSubmitProposal',
value: {
messages: messages.map((msg) => msg.toAmino()),
messages: messages.map((msg): Msg.Amino => msg.toAmino()),
initial_deposit: initial_deposit.toAmino(),
proposer,
metadata: metadata && metadata !== '' ? metadata : undefined,
Expand Down
18 changes: 9 additions & 9 deletions src/core/gov/msgs/MsgSubmitProposalLegacy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class MsgSubmitProposalLegacy extends JSONSerializable<
* @param proposer proposer's account address
*/
constructor(
public content: Content,
public content: Content | undefined,
initial_deposit: Coins.Input,
public proposer: AccAddress
) {
Expand All @@ -36,7 +36,7 @@ export class MsgSubmitProposalLegacy extends JSONSerializable<
value: { content, initial_deposit, proposer },
} = data
return new MsgSubmitProposalLegacy(
Content.fromAmino(content),
content ? Content.fromAmino(content) : undefined,
Coins.fromAmino(initial_deposit),
proposer
)
Expand All @@ -47,7 +47,7 @@ export class MsgSubmitProposalLegacy extends JSONSerializable<
return {
type: 'cosmos-sdk/MsgSubmitProposal',
value: {
content: content.toAmino(),
content: content?.toAmino(),
initial_deposit: initial_deposit.toAmino(),
proposer,
},
Expand All @@ -59,7 +59,7 @@ export class MsgSubmitProposalLegacy extends JSONSerializable<
): MsgSubmitProposalLegacy {
const { content, initial_deposit, proposer } = data
return new MsgSubmitProposalLegacy(
Content.fromData(content),
content ? Content.fromData(content) : undefined,
Coins.fromData(initial_deposit),
proposer
)
Expand All @@ -69,7 +69,7 @@ export class MsgSubmitProposalLegacy extends JSONSerializable<
const { content, initial_deposit, proposer } = this
return {
'@type': '/cosmos.gov.v1beta1.MsgSubmitProposal',
content: content.toData(),
content: content?.toData(),
initial_deposit: initial_deposit.toData(),
proposer,
}
Expand All @@ -79,7 +79,7 @@ export class MsgSubmitProposalLegacy extends JSONSerializable<
proto: MsgSubmitProposalLegacy.Proto
): MsgSubmitProposalLegacy {
return new MsgSubmitProposalLegacy(
Content.fromProto(proto.content as any),
proto.content ? Content.fromProto(proto.content) : undefined,
Coins.fromProto(proto.initialDeposit),
proto.proposer
)
Expand All @@ -88,7 +88,7 @@ export class MsgSubmitProposalLegacy extends JSONSerializable<
public toProto(): MsgSubmitProposalLegacy.Proto {
const { content, initial_deposit, proposer } = this
return MsgSubmitProposal_pb.fromPartial({
content: content.packAny(),
content: content?.packAny(),
initialDeposit: initial_deposit.toProto(),
proposer,
})
Expand All @@ -112,15 +112,15 @@ export namespace MsgSubmitProposalLegacy {
export interface Amino {
type: 'cosmos-sdk/MsgSubmitProposal'
value: {
content: Content.Amino
content: Content.Amino | undefined
initial_deposit: Coins.Amino
proposer: AccAddress
}
}

export interface Data {
'@type': '/cosmos.gov.v1beta1.MsgSubmitProposal'
content: Content.Data
content: Content.Data | undefined
initial_deposit: Coins.Data
proposer: AccAddress
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/gov/proposals/Proposal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export class Proposal extends JSONSerializable<

return {
id: id.toString(),
messages: messages.map((msg) => msg.toAmino()),
messages: messages.map((msg): Msg.Amino => msg.toAmino()),
status: proposalStatusToJSON(status),
final_tally_result: {
yes_count: num(final_tally_result.yes_count).toFixed(),
Expand Down
2 changes: 1 addition & 1 deletion src/core/group/GroupProposal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export class GroupProposal extends JSONSerializable<
},
voting_period_end: voting_period_end.toISOString(),
executor_result: proposalExecutorResultToJSON(executor_result),
messages: messages.map((msg) => msg.toAmino()),
messages: messages.map((msg): Msg.Amino => msg.toAmino()),
title,
summary,
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/group/msgs/MsgSubmitGroupProposal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export class MsgSubmitGroupProposal extends JSONSerializable<
group_policy_address,
proposers,
metadata,
messages: messages.map((msg) => msg.toAmino()),
messages: messages.map((msg): Msg.Amino => msg.toAmino()),
exec: execToJSON(exec),
title,
summary,
Expand Down
6 changes: 3 additions & 3 deletions src/core/ibc/core/connection/msgs/MsgConnectionOpenTry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class MsgConnectionOpenTry extends JSONSerializable<
*/
constructor(
public client_id: string,
public client_state: any,
public client_state: Any | undefined,
public counterparty: ConnectionCounterparty | undefined,
public delay_period: number,
public counterparty_versions: IbcVersion[],
Expand Down Expand Up @@ -152,7 +152,7 @@ export class MsgConnectionOpenTry extends JSONSerializable<
} = this
return MsgConnectionOpenTry_pb.fromPartial({
clientId: client_id,
clientState: client_state.toProto(),
clientState: client_state,
counterparty: counterparty?.toProto(),
delayPeriod: Long.fromNumber(delay_period),
counterpartyVersions: counterparty_versions.map((cv) => cv.toProto()),
Expand Down Expand Up @@ -183,7 +183,7 @@ export namespace MsgConnectionOpenTry {
export interface Data {
'@type': '/ibc.core.connection.v1.MsgConnectionOpenTry'
client_id: string
client_state: Any
client_state?: Any
counterparty?: ConnectionCounterparty.Data
delay_period: string
counterparty_versions: IbcVersion.Data[]
Expand Down
Loading

0 comments on commit 74de32a

Please sign in to comment.