Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ts-node examples and introduce improved typescript eslint rules #619

Merged
merged 3 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .changeset/little-singers-try.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@colony/colony-js": patch
"@colony/events": patch
"@colony/tokens": patch
"@colony/core": patch
"@colony/sdk": patch
---

Introduce `tsx` instead of `ts-node` for esm compatibility reasons. This required some changes to how we import and export types from .ts files, so a lint rule was added for this.
15 changes: 15 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"sourceType": "module"
},
"extends": [
"plugin:@typescript-eslint/recommended",
"@colony/eslint-config-colony"
Expand All @@ -23,6 +26,18 @@
"@typescript-eslint/no-shadow": [
"error"
],
"@typescript-eslint/consistent-type-imports": [
"error",
{
"fixStyle": "inline-type-imports"
}
],
"@typescript-eslint/consistent-type-exports": [
"error",
{
"fixMixedExportsWithInlineTypeSpecifier": true
}
],
"import/prefer-default-export": "off",
"import/no-unresolved": "off",
"import/extensions": [
Expand Down
6 changes: 6 additions & 0 deletions packages/colony-js/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
{
"parserOptions": {
"project": "./tsconfig.json"
},
"rules": {
"@typescript-eslint/no-explicit-any": "off"
},
"overrides": [
{
"files": [
Expand Down
12 changes: 8 additions & 4 deletions packages/colony-js/src/clients/ColonyNetworkClient.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { ContractTransaction, BigNumber, Overrides } from 'ethers';
import {
type ContractTransaction,
type BigNumber,
type Overrides,
} from 'ethers';
import {
type SignerOrProvider,
ColonyNetworkAddress,
Expand All @@ -7,16 +11,16 @@ import {
} from '@colony/core';
import {
getTokenLockingClient,
TokenLockingClient,
type TokenLockingClient,
ColonyTokenFactory,
} from '@colony/tokens';

import {
IColonyNetwork,
type IColonyNetwork,
IColonyNetwork__factory as IColonyNetworkFactory,
} from '../contracts/index.js';
import { ClientType } from '../constants.js';
import { AnyColonyClient } from '../clients/Core/exports.js';
import { type AnyColonyClient } from '../clients/Core/exports.js';
import { getColonyClient } from './Core/exports.js';

type NetworkEstimate = IColonyNetwork['estimateGas'];
Expand Down
4 changes: 2 additions & 2 deletions packages/colony-js/src/clients/Core/ColonyClientV10.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { SignerOrProvider } from '@colony/core';

import { IColony__factory as IColonyFactory } from '../../contracts/IColony/10/factories/IColony__factory.js';
import { ColonyNetworkClient } from '../ColonyNetworkClient.js';
import { UnknownIColonyClient } from './augments/commonAugments.js';
import { type ColonyNetworkClient } from '../ColonyNetworkClient.js';
import { type UnknownIColonyClient } from './augments/commonAugments.js';
import { addAugments } from './augments/augmentsV7.js';
import { addAugmentsB as addAddDomainAugments } from './augments/AddDomain.js';
import { addAugmentsB as addMoveFundsBetweenPotsAugments } from './augments/MoveFundsBetweenPots.js';
Expand Down
4 changes: 2 additions & 2 deletions packages/colony-js/src/clients/Core/ColonyClientV11.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { SignerOrProvider } from '@colony/core';

import { IColony__factory as IColonyFactory } from '../../contracts/IColony/11/factories/IColony__factory.js';
import { ColonyNetworkClient } from '../ColonyNetworkClient.js';
import { UnknownIColonyClient } from './augments/commonAugments.js';
import { type ColonyNetworkClient } from '../ColonyNetworkClient.js';
import { type UnknownIColonyClient } from './augments/commonAugments.js';
import { addAugments } from './augments/augmentsV7.js';
import { addAugmentsB as addAddDomainAugments } from './augments/AddDomain.js';
import { addAugmentsB as addMoveFundsBetweenPotsAugments } from './augments/MoveFundsBetweenPots.js';
Expand Down
28 changes: 14 additions & 14 deletions packages/colony-js/src/clients/Core/ColonyClientV12.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
import type { SignerOrProvider } from '@colony/core';

import { IColony__factory as IColonyFactory } from '../../contracts/IColony/12/factories/IColony__factory.js';
import { IColony } from '../../contracts/IColony/12/IColony.js';
import { ColonyNetworkClient } from '../ColonyNetworkClient.js';
import { type IColony } from '../../contracts/IColony/12/IColony.js';
import { type ColonyNetworkClient } from '../ColonyNetworkClient.js';
import {
AugmentedIColony,
AugmentedEstimate,
type AugmentedIColony,
type AugmentedEstimate,
} from './augments/commonAugments.js';
import { ColonyAugmentsV3 } from './augments/augmentsV3.js';
import { ColonyAugmentsV4 } from './augments/augmentsV4.js';
import { ColonyAugmentsV5 } from './augments/augmentsV5.js';
import { ColonyAugmentsV6 } from './augments/augmentsV6.js';
import { type ColonyAugmentsV3 } from './augments/augmentsV3.js';
import { type ColonyAugmentsV4 } from './augments/augmentsV4.js';
import { type ColonyAugmentsV5 } from './augments/augmentsV5.js';
import { type ColonyAugmentsV6 } from './augments/augmentsV6.js';
import {
addAugments,
ColonyAugmentsV7,
AugmentedEstimateV7,
type ColonyAugmentsV7,
type AugmentedEstimateV7,
} from './augments/augmentsV7.js';
import {
AddDomainAugmentsB,
AddDomainEstimateGasB,
type AddDomainAugmentsB,
type AddDomainEstimateGasB,
addAugmentsB as addAddDomainAugments,
} from './augments/AddDomain.js';
import {
MoveFundsBetweenPotsAugmentsB,
MoveFundsBetweenPotsEstimateGasB,
type MoveFundsBetweenPotsAugmentsB,
type MoveFundsBetweenPotsEstimateGasB,
addAugmentsB as addMoveFundsBetweenPotsAugments,
} from './augments/MoveFundsBetweenPots.js';

Expand Down
30 changes: 15 additions & 15 deletions packages/colony-js/src/clients/Core/ColonyClientV13.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
import { SignerOrProvider } from '@colony/core';
import { type SignerOrProvider } from '@colony/core';

import { IColony__factory as IColonyFactory } from '../../contracts/IColony/13/factories/IColony__factory.js';
import { IColony } from '../../contracts/IColony/13/IColony.js';
import { ColonyNetworkClient } from '../ColonyNetworkClient.js';
import { type IColony } from '../../contracts/IColony/13/IColony.js';
import { type ColonyNetworkClient } from '../ColonyNetworkClient.js';
import {
AugmentedIColony,
AugmentedEstimate,
type AugmentedIColony,
type AugmentedEstimate,
} from './augments/commonAugments.js';
import { ColonyAugmentsV3 } from './augments/augmentsV3.js';
import { ColonyAugmentsV4 } from './augments/augmentsV4.js';
import { ColonyAugmentsV5 } from './augments/augmentsV5.js';
import { ColonyAugmentsV6 } from './augments/augmentsV6.js';
import { type ColonyAugmentsV3 } from './augments/augmentsV3.js';
import { type ColonyAugmentsV4 } from './augments/augmentsV4.js';
import { type ColonyAugmentsV5 } from './augments/augmentsV5.js';
import { type ColonyAugmentsV6 } from './augments/augmentsV6.js';
import {
addAugments,
ColonyAugmentsV7,
AugmentedEstimateV7,
type ColonyAugmentsV7,
type AugmentedEstimateV7,
} from './augments/augmentsV7.js';
import {
AddDomainAugmentsB,
AddDomainEstimateGasB,
type AddDomainAugmentsB,
type AddDomainEstimateGasB,
addAugmentsB as addAddDomainAugments,
} from './augments/AddDomain.js';
import {
MoveFundsBetweenPotsAugmentsB,
MoveFundsBetweenPotsEstimateGasB,
type MoveFundsBetweenPotsAugmentsB,
type MoveFundsBetweenPotsEstimateGasB,
addAugmentsB as addMoveFundsBetweenPotsAugments,
} from './augments/MoveFundsBetweenPots.js';

Expand Down
30 changes: 15 additions & 15 deletions packages/colony-js/src/clients/Core/ColonyClientV14.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
import { SignerOrProvider } from '@colony/core';
import { type SignerOrProvider } from '@colony/core';

import { IColony__factory as IColonyFactory } from '../../contracts/IColony/14/factories/IColony__factory.js';
import { IColony } from '../../contracts/IColony/14/IColony.js';
import { ColonyNetworkClient } from '../ColonyNetworkClient.js';
import { type IColony } from '../../contracts/IColony/14/IColony.js';
import { type ColonyNetworkClient } from '../ColonyNetworkClient.js';
import {
AugmentedIColony,
AugmentedEstimate,
type AugmentedIColony,
type AugmentedEstimate,
} from './augments/commonAugments.js';
import { ColonyAugmentsV3 } from './augments/augmentsV3.js';
import { ColonyAugmentsV4 } from './augments/augmentsV4.js';
import { ColonyAugmentsV5 } from './augments/augmentsV5.js';
import { ColonyAugmentsV6 } from './augments/augmentsV6.js';
import { type ColonyAugmentsV3 } from './augments/augmentsV3.js';
import { type ColonyAugmentsV4 } from './augments/augmentsV4.js';
import { type ColonyAugmentsV5 } from './augments/augmentsV5.js';
import { type ColonyAugmentsV6 } from './augments/augmentsV6.js';
import {
addAugments,
ColonyAugmentsV7,
AugmentedEstimateV7,
type ColonyAugmentsV7,
type AugmentedEstimateV7,
} from './augments/augmentsV7.js';
import {
AddDomainAugmentsB,
AddDomainEstimateGasB,
type AddDomainAugmentsB,
type AddDomainEstimateGasB,
addAugmentsB as addAddDomainAugments,
} from './augments/AddDomain.js';
import {
MoveFundsBetweenPotsAugmentsB,
MoveFundsBetweenPotsEstimateGasB,
type MoveFundsBetweenPotsAugmentsB,
type MoveFundsBetweenPotsEstimateGasB,
addAugmentsB as addMoveFundsBetweenPotsAugments,
} from './augments/MoveFundsBetweenPots.js';

Expand Down
30 changes: 15 additions & 15 deletions packages/colony-js/src/clients/Core/ColonyClientV15.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
import { SignerOrProvider } from '@colony/core';
import { type SignerOrProvider } from '@colony/core';

import { IColony__factory as IColonyFactory } from '../../contracts/IColony/15/factories/IColony__factory.js';
import { IColony } from '../../contracts/IColony/15/IColony.js';
import { ColonyNetworkClient } from '../ColonyNetworkClient.js';
import { type IColony } from '../../contracts/IColony/15/IColony.js';
import { type ColonyNetworkClient } from '../ColonyNetworkClient.js';
import {
AugmentedIColony,
AugmentedEstimate,
type AugmentedIColony,
type AugmentedEstimate,
} from './augments/commonAugments.js';
import { ColonyAugmentsV3 } from './augments/augmentsV3.js';
import { ColonyAugmentsV4 } from './augments/augmentsV4.js';
import { ColonyAugmentsV5 } from './augments/augmentsV5.js';
import { ColonyAugmentsV6 } from './augments/augmentsV6.js';
import { type ColonyAugmentsV3 } from './augments/augmentsV3.js';
import { type ColonyAugmentsV4 } from './augments/augmentsV4.js';
import { type ColonyAugmentsV5 } from './augments/augmentsV5.js';
import { type ColonyAugmentsV6 } from './augments/augmentsV6.js';
import {
addAugments,
ColonyAugmentsV7,
AugmentedEstimateV7,
type ColonyAugmentsV7,
type AugmentedEstimateV7,
} from './augments/augmentsV7.js';
import {
AddDomainAugmentsB,
AddDomainEstimateGasB,
type AddDomainAugmentsB,
type AddDomainEstimateGasB,
addAugmentsB as addAddDomainAugments,
} from './augments/AddDomain.js';
import {
MoveFundsBetweenPotsAugmentsB,
MoveFundsBetweenPotsEstimateGasB,
type MoveFundsBetweenPotsAugmentsB,
type MoveFundsBetweenPotsEstimateGasB,
addAugmentsB as addMoveFundsBetweenPotsAugments,
} from './augments/MoveFundsBetweenPots.js';

Expand Down
30 changes: 15 additions & 15 deletions packages/colony-js/src/clients/Core/ColonyClientV16.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
import { SignerOrProvider } from '@colony/core';
import { type SignerOrProvider } from '@colony/core';

import { IColony__factory as IColonyFactory } from '../../contracts/IColony/16/factories/IColony__factory.js';
import { IColony } from '../../contracts/IColony/16/IColony.js';
import { ColonyNetworkClient } from '../ColonyNetworkClient.js';
import { type IColony } from '../../contracts/IColony/16/IColony.js';
import { type ColonyNetworkClient } from '../ColonyNetworkClient.js';
import {
AugmentedIColony,
AugmentedEstimate,
type AugmentedIColony,
type AugmentedEstimate,
} from './augments/commonAugments.js';
import { ColonyAugmentsV3 } from './augments/augmentsV3.js';
import { ColonyAugmentsV4 } from './augments/augmentsV4.js';
import { ColonyAugmentsV5 } from './augments/augmentsV5.js';
import { ColonyAugmentsV6 } from './augments/augmentsV6.js';
import { type ColonyAugmentsV3 } from './augments/augmentsV3.js';
import { type ColonyAugmentsV4 } from './augments/augmentsV4.js';
import { type ColonyAugmentsV5 } from './augments/augmentsV5.js';
import { type ColonyAugmentsV6 } from './augments/augmentsV6.js';
import {
addAugments,
ColonyAugmentsV7,
AugmentedEstimateV7,
type ColonyAugmentsV7,
type AugmentedEstimateV7,
} from './augments/augmentsV7.js';
import {
AddDomainAugmentsB,
AddDomainEstimateGasB,
type AddDomainAugmentsB,
type AddDomainEstimateGasB,
addAugmentsB as addAddDomainAugments,
} from './augments/AddDomain.js';
import {
MoveFundsBetweenPotsAugmentsB,
MoveFundsBetweenPotsEstimateGasB,
type MoveFundsBetweenPotsAugmentsB,
type MoveFundsBetweenPotsEstimateGasB,
addAugmentsB as addMoveFundsBetweenPotsAugments,
} from './augments/MoveFundsBetweenPots.js';

Expand Down
4 changes: 2 additions & 2 deletions packages/colony-js/src/clients/Core/ColonyClientV8.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { SignerOrProvider } from '@colony/core';

import { IColony__factory as IColonyFactory } from '../../contracts/IColony/8/factories/IColony__factory.js';
import { ColonyNetworkClient } from '../ColonyNetworkClient.js';
import { UnknownIColonyClient } from './augments/commonAugments.js';
import { type ColonyNetworkClient } from '../ColonyNetworkClient.js';
import { type UnknownIColonyClient } from './augments/commonAugments.js';
import { addAugments } from './augments/augmentsV5.js';
import { addAugmentsB as addAddDomainAugments } from './augments/AddDomain.js';
import { addAugmentsB as addMoveFundsBetweenPotsAugments } from './augments/MoveFundsBetweenPots.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/colony-js/src/clients/Core/ColonyVersionClient.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// A minimal version of the ColonyClient contract that only supports the `version` method
import { BigNumber, Contract } from 'ethers';
import { type BigNumber, Contract } from 'ethers';
import type { SignerOrProvider } from '@colony/core';

interface ColonyVersionClient extends Contract {
Expand Down
18 changes: 11 additions & 7 deletions packages/colony-js/src/clients/Core/augments/AddDomain.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
import { BigNumber, BigNumberish, ContractTransaction } from 'ethers';
import {
type BigNumber,
type BigNumberish,
type ContractTransaction,
} from 'ethers';
import {
type TxOverrides,
ColonyRole,
getPermissionProofs,
} from '@colony/core';

import {
IColonyV4,
IColonyV12,
IColonyV13,
IColonyV14,
IColonyV15,
IColonyV16,
type IColonyV4,
type IColonyV12,
type IColonyV13,
type IColonyV14,
type IColonyV15,
type IColonyV16,
} from '../contracts.js';
import type {
AugmentedIColony,
Expand Down
Loading