Skip to content

Commit 01b3738

Browse files
committed
refactor: add @typescript-eslint/consistent-type-imports rule for consistent type import
1 parent 838041d commit 01b3738

File tree

85 files changed

+267
-290
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+267
-290
lines changed

eslint.config.mjs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
import { FlatCompat } from '@eslint/eslintrc'
2+
import js from '@eslint/js'
13
import globals from 'globals'
24
import path from 'node:path'
35
import { fileURLToPath } from 'node:url'
4-
import js from '@eslint/js'
5-
import { FlatCompat } from '@eslint/eslintrc'
66

77
const __filename = fileURLToPath(import.meta.url)
88
const __dirname = path.dirname(__filename)
@@ -33,5 +33,8 @@ export default [
3333
...globals.node,
3434
},
3535
},
36+
rules: {
37+
'@typescript-eslint/consistent-type-imports': 'error',
38+
},
3639
},
3740
]

examples/calculator/contract.algo.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { assert, BaseContract, Bytes, err, log, op, Txn, uint64, Uint64 } from '@algorandfoundation/algorand-typescript'
1+
import type { uint64 } from '@algorandfoundation/algorand-typescript'
2+
import { assert, BaseContract, Bytes, err, log, op, Txn, Uint64 } from '@algorandfoundation/algorand-typescript'
23

34
const ADD = Uint64(1)
45
const SUB = Uint64(2)

examples/htlc-logicsig/signature.algo.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { Account, Bytes, Global, LogicSig, op, TransactionType, Txn, Uint64, uint64 } from '@algorandfoundation/algorand-typescript'
1+
import type { uint64 } from '@algorandfoundation/algorand-typescript'
2+
import { Account, Bytes, Global, LogicSig, op, TransactionType, Txn, Uint64 } from '@algorandfoundation/algorand-typescript'
23

34
export default class HashedTimeLockedLogicSig extends LogicSig {
45
program(): boolean | uint64 {

examples/scratch-storage/contract.algo.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { arc4, assert, BaseContract, Bytes, op, uint64, Uint64 } from '@algorandfoundation/algorand-typescript'
1+
import type { uint64 } from '@algorandfoundation/algorand-typescript'
2+
import { arc4, assert, BaseContract, Bytes, op, Uint64 } from '@algorandfoundation/algorand-typescript'
23

34
export class ScratchSlotsContract extends arc4.Contract {
45
@arc4.abimethod()

examples/zk-whitelist/contract.algo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { uint64 } from '@algorandfoundation/algorand-typescript'
12
import {
23
abimethod,
34
Account,
@@ -13,7 +14,6 @@ import {
1314
OpUpFeeSource,
1415
TemplateVar,
1516
Txn,
16-
uint64,
1717
} from '@algorandfoundation/algorand-typescript'
1818

1919
const curveMod = 21888242871839275222246405745257275088548364400416034343698204186575808495617n

src/abi-metadata.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { BaseContract, Contract } from '@algorandfoundation/algorand-typescript'
2-
import { AbiMethodConfig, BareMethodConfig, CreateOptions, OnCompleteActionStr } from '@algorandfoundation/algorand-typescript/arc4'
1+
import type { BaseContract, Contract } from '@algorandfoundation/algorand-typescript'
2+
import type { AbiMethodConfig, BareMethodConfig, CreateOptions, OnCompleteActionStr } from '@algorandfoundation/algorand-typescript/arc4'
33
import js_sha512 from 'js-sha512'
4-
import { TypeInfo } from './encoders'
4+
import type { TypeInfo } from './encoders'
55
import { getArc4TypeName as getArc4TypeNameForARC4Encoded } from './impl/encoded-types'
6-
import { DeliberateAny } from './typescript-helpers'
6+
import type { DeliberateAny } from './typescript-helpers'
77

88
export interface AbiMetadata {
99
methodName: string

src/collections/custom-key-map.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import { type Account, internal } from '@algorandfoundation/algorand-typescript'
2-
import { DeliberateAny } from '../typescript-helpers'
1+
import type { Account } from '@algorandfoundation/algorand-typescript'
2+
import { internal } from '@algorandfoundation/algorand-typescript'
3+
import type { DeliberateAny } from '../typescript-helpers'
34
import { asBytesCls, asUint64Cls } from '../util'
45

56
type Primitive = number | bigint | string | boolean

src/context-helpers/context-util.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import { internal, uint64 } from '@algorandfoundation/algorand-typescript'
2-
import { AbiMetadata } from '../abi-metadata'
1+
import type { uint64 } from '@algorandfoundation/algorand-typescript'
2+
import { internal } from '@algorandfoundation/algorand-typescript'
3+
import type { AbiMetadata } from '../abi-metadata'
34
import { ApplicationTransaction } from '../impl/transactions'
45
import { lazyContext } from './internal-context'
56

src/context-helpers/internal-context.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import { type Account, BaseContract, internal } from '@algorandfoundation/algorand-typescript'
2-
import { AccountData, ApplicationData, AssetData } from '../impl/reference'
3-
import { VoterData } from '../impl/voter-params'
4-
import { TransactionGroup } from '../subcontexts/transaction-context'
5-
import { TestExecutionContext } from '../test-execution-context'
1+
import type { Account } from '@algorandfoundation/algorand-typescript'
2+
import { BaseContract, internal } from '@algorandfoundation/algorand-typescript'
3+
import type { AccountData, ApplicationData, AssetData } from '../impl/reference'
4+
import type { VoterData } from '../impl/voter-params'
5+
import type { TransactionGroup } from '../subcontexts/transaction-context'
6+
import type { TestExecutionContext } from '../test-execution-context'
67

78
/**
89
* For accessing implementation specific functions, with a convenient single entry

src/decode-logs.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { bytes, op } from '@algorandfoundation/algorand-typescript'
1+
import type { bytes } from '@algorandfoundation/algorand-typescript'
2+
import { op } from '@algorandfoundation/algorand-typescript'
23
import { ABI_RETURN_VALUE_LOG_PREFIX } from './constants'
34
import { asNumber } from './util'
45

0 commit comments

Comments
 (0)