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

Upgrade ESLint to v9 #334

Merged
merged 28 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
87de72c
Upgrade to Eslint 9
lorisleiva Nov 27, 2024
7065fa8
Fix new linting errors
lorisleiva Nov 28, 2024
7a83915
Adjust configs
lorisleiva Nov 28, 2024
d8b039b
Use tseslint.config helper
lorisleiva Nov 28, 2024
d130a4c
Update eslint.config.mjs
lorisleiva Nov 28, 2024
546d8d9
Update turbo.json
lorisleiva Nov 28, 2024
3b2b8ae
Enable @typescript-eslint/no-unsafe-return
lorisleiva Nov 28, 2024
dae5a19
Enable @typescript-eslint/unbound-method
lorisleiva Nov 28, 2024
b1792a8
Enable @typescript-eslint/no-base-to-string
lorisleiva Nov 28, 2024
22881ea
Enable @typescript-eslint/no-unsafe-argument
lorisleiva Nov 28, 2024
1206511
Enable @typescript-eslint/no-unsafe-assignment
lorisleiva Nov 28, 2024
749f616
Enable @typescript-eslint/no-unsafe-call
lorisleiva Nov 28, 2024
c555a82
Enable @typescript-eslint/no-unsafe-enum-comparison
lorisleiva Nov 28, 2024
c0cc32f
Enable @typescript-eslint/no-unsafe-member-access
lorisleiva Nov 28, 2024
b85c683
Enable @typescript-eslint/only-throw-error
lorisleiva Nov 28, 2024
f8a15d1
Enable @typescript-eslint/prefer-promise-reject-errors
lorisleiva Nov 28, 2024
8a78b7d
Enable @typescript-eslint/restrict-plus-operands
lorisleiva Nov 28, 2024
04bc69f
Enable @typescript-eslint/restrict-template-expressions
lorisleiva Nov 28, 2024
74b9d2d
Update index.ts
lorisleiva Nov 28, 2024
fab5cc6
Merge branch 'main' into loris/upgrade-eslint-9
lorisleiva Nov 28, 2024
84c8aa7
Add changeset
lorisleiva Nov 28, 2024
88bab9e
Try disabling new rules again for CI
lorisleiva Nov 28, 2024
b687d5a
Revert "Try disabling new rules again for CI"
lorisleiva Nov 28, 2024
d8e7f16
Fix @typescript-eslint/no-unused-vars
lorisleiva Nov 28, 2024
d92fe02
Update tsconfig.json
lorisleiva Nov 28, 2024
4e375d5
Build before lint in CI
lorisleiva Nov 28, 2024
dd190aa
Update tsconfig.json
lorisleiva Nov 28, 2024
e53e821
Simplify script
lorisleiva Nov 28, 2024
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
13 changes: 13 additions & 0 deletions .changeset/rich-pans-cough.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
'@codama/nodes-from-anchor': patch
'@codama/renderers-js-umi': patch
'@codama/dynamic-parsers': patch
'@codama/dynamic-codecs': patch
'@codama/renderers-rust': patch
'@codama/visitors-core': patch
'@codama/renderers-js': patch
'@codama/visitors': patch
'@codama/errors': patch
---

Bump dependencies
5 changes: 0 additions & 5 deletions .eslintrc.js

This file was deleted.

3 changes: 3 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ jobs:
- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Compile JS and types
run: pnpm run build

- name: Check linting
run: pnpm run lint

Expand Down
17 changes: 17 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import solanaConfig from '@solana/eslint-config-solana';
import tseslint from 'typescript-eslint';

export default tseslint.config([
{
files: ['**/*.ts', '**/*.(c|m)?js'],
ignores: ['**/dist/**', '**/e2e/**'],
extends: [solanaConfig],
},
{
files: ['packages/nodes/**', 'packages/node-types/**'],
rules: {
'sort-keys-fix/sort-keys-fix': 'off',
'typescript-sort-keys/interface': 'off',
},
},
]);
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@
"@changesets/changelog-github": "^0.5.0",
"@changesets/cli": "^2.27.10",
"@codama/internals": "workspace:*",
"@solana/eslint-config-solana": "^3.0.3",
"@eslint/js": "^9.13.0",
"@eslint/json": "^0.8.0",
"@solana/eslint-config-solana": "^4.0.0",
"@solana/prettier-config-solana": "0.0.5",
"@types/node": "^20",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.0.0",
"@types/node": "^22",
"@typescript-eslint/eslint-plugin": "^8.16.0",
"@typescript-eslint/parser": "^8.16.0",
"agadoo": "^3.0.0",
"eslint": "^8.57.1",
"eslint-config-turbo": "^2.3.3",
"eslint-plugin-simple-import-sort": "^10.0.0",
"eslint": "^9.15.0",
"eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-sort-keys-fix": "^1.1.2",
"eslint-plugin-typescript-sort-keys": "^3.3.0",
"happy-dom": "^15.11.7",
Expand Down
2 changes: 1 addition & 1 deletion packages/dynamic-codecs/src/codecs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ export function getNodeCodecVisitor(
return transformCodec(
getMapCodec(key, value, { size }),
(value: object) => new Map(Object.entries(value)),
(map: Map<unknown, unknown>): object => Object.fromEntries(map),
(map: Map<unknown, unknown>) => Object.fromEntries(map) as object,
) as Codec<unknown>;
},
visitNumberType(node) {
Expand Down
2 changes: 1 addition & 1 deletion packages/dynamic-codecs/src/values.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export function getValueNodeVisitor(
const value = visit(entry.value, this);
return [key, value];
}),
);
) as unknown;
},
visitNoneValue() {
return { __option: 'None' };
Expand Down
1 change: 0 additions & 1 deletion packages/dynamic-parsers/src/parsers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ export function parseInstruction(
): ParsedInstruction | undefined {
const parsedData = parseInstructionData(root, instruction.data);
if (!parsedData) return undefined;
instruction.accounts;
const instructionNode = getLastNodeFromPath(parsedData.path);
const accounts: ParsedInstructionAccounts = instructionNode.accounts.flatMap((account, index) => {
const accountMeta = instruction.accounts[index];
Expand Down
4 changes: 2 additions & 2 deletions packages/errors/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ program
.argument('[encodedContext]', 'encoded context to interpolate into the error message', encodedContext => {
try {
return decodeEncodedContext(encodedContext);
} catch (e) {
} catch {
throw new InvalidArgumentError('Encoded context malformed');
}
})
.action((code: number, context) => {
.action((code: number, context: object | undefined) => {
const message = getHumanReadableErrorMessage(code as CodamaErrorCode, context);
console.log(`
${
Expand Down
61 changes: 30 additions & 31 deletions packages/errors/src/codes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,46 +25,45 @@
* - `_MISSING`: Some required input is missing. E.g. `TRANSACTION_FEE_PAYER_MISSING`.
* - `_UNIMPLEMENTED`: Some required component is not available in the environment. E.g. `SUBTLE_CRYPTO_VERIFY_FUNCTION_UNIMPLEMENTED`.
*/
export const CODAMA_ERROR__UNRECOGNIZED_NODE_KIND = 1 as const;
export const CODAMA_ERROR__UNEXPECTED_NODE_KIND = 2 as const;
export const CODAMA_ERROR__UNEXPECTED_NESTED_NODE_KIND = 3 as const;
export const CODAMA_ERROR__LINKED_NODE_NOT_FOUND = 4 as const;
export const CODAMA_ERROR__NODE_FILESYSTEM_FUNCTION_UNAVAILABLE = 5 as const;
export const CODAMA_ERROR__VERSION_MISMATCH = 6 as const;
export const CODAMA_ERROR__UNRECOGNIZED_NUMBER_FORMAT = 7 as const;
export const CODAMA_ERROR__UNRECOGNIZED_BYTES_ENCODING = 8 as const;
export const CODAMA_ERROR__ENUM_VARIANT_NOT_FOUND = 9 as const;
export const CODAMA_ERROR__DISCRIMINATOR_FIELD_NOT_FOUND = 10 as const;
export const CODAMA_ERROR__DISCRIMINATOR_FIELD_HAS_NO_DEFAULT_VALUE = 11 as const;
export const CODAMA_ERROR__UNRECOGNIZED_NODE_KIND = 1;
export const CODAMA_ERROR__UNEXPECTED_NODE_KIND = 2;
export const CODAMA_ERROR__UNEXPECTED_NESTED_NODE_KIND = 3;
export const CODAMA_ERROR__LINKED_NODE_NOT_FOUND = 4;
export const CODAMA_ERROR__NODE_FILESYSTEM_FUNCTION_UNAVAILABLE = 5;
export const CODAMA_ERROR__VERSION_MISMATCH = 6;
export const CODAMA_ERROR__UNRECOGNIZED_NUMBER_FORMAT = 7;
export const CODAMA_ERROR__UNRECOGNIZED_BYTES_ENCODING = 8;
export const CODAMA_ERROR__ENUM_VARIANT_NOT_FOUND = 9;
export const CODAMA_ERROR__DISCRIMINATOR_FIELD_NOT_FOUND = 10;
export const CODAMA_ERROR__DISCRIMINATOR_FIELD_HAS_NO_DEFAULT_VALUE = 11;

// Visitors-related errors.
// Reserve error codes in the range [1200000-1200999].
export const CODAMA_ERROR__VISITORS__CANNOT_ADD_DUPLICATED_PDA_NAMES = 1200000 as const;
export const CODAMA_ERROR__VISITORS__INVALID_PDA_SEED_VALUES = 1200001 as const;
export const CODAMA_ERROR__VISITORS__CYCLIC_DEPENDENCY_DETECTED_WHEN_RESOLVING_INSTRUCTION_DEFAULT_VALUES =
1200002 as const;
export const CODAMA_ERROR__VISITORS__CANNOT_USE_OPTIONAL_ACCOUNT_AS_PDA_SEED_VALUE = 1200003 as const;
export const CODAMA_ERROR__VISITORS__INVALID_INSTRUCTION_DEFAULT_VALUE_DEPENDENCY = 1200004 as const;
export const CODAMA_ERROR__VISITORS__ACCOUNT_FIELD_NOT_FOUND = 1200005 as const;
export const CODAMA_ERROR__VISITORS__INVALID_NUMBER_WRAPPER = 1200006 as const;
export const CODAMA_ERROR__VISITORS__CANNOT_EXTEND_MISSING_VISIT_FUNCTION = 1200007 as const;
export const CODAMA_ERROR__VISITORS__FAILED_TO_VALIDATE_NODE = 1200008 as const;
export const CODAMA_ERROR__VISITORS__INSTRUCTION_ENUM_ARGUMENT_NOT_FOUND = 1200009 as const;
export const CODAMA_ERROR__VISITORS__CANNOT_FLATTEN_STRUCT_WITH_CONFLICTING_ATTRIBUTES = 1200010 as const;
export const CODAMA_ERROR__VISITORS__RENDER_MAP_KEY_NOT_FOUND = 1200011 as const;
export const CODAMA_ERROR__VISITORS__CANNOT_REMOVE_LAST_PATH_IN_NODE_STACK = 1200012 as const;
export const CODAMA_ERROR__VISITORS__CANNOT_ADD_DUPLICATED_PDA_NAMES = 1200000;
export const CODAMA_ERROR__VISITORS__INVALID_PDA_SEED_VALUES = 1200001;
export const CODAMA_ERROR__VISITORS__CYCLIC_DEPENDENCY_DETECTED_WHEN_RESOLVING_INSTRUCTION_DEFAULT_VALUES = 1200002;
export const CODAMA_ERROR__VISITORS__CANNOT_USE_OPTIONAL_ACCOUNT_AS_PDA_SEED_VALUE = 1200003;
export const CODAMA_ERROR__VISITORS__INVALID_INSTRUCTION_DEFAULT_VALUE_DEPENDENCY = 1200004;
export const CODAMA_ERROR__VISITORS__ACCOUNT_FIELD_NOT_FOUND = 1200005;
export const CODAMA_ERROR__VISITORS__INVALID_NUMBER_WRAPPER = 1200006;
export const CODAMA_ERROR__VISITORS__CANNOT_EXTEND_MISSING_VISIT_FUNCTION = 1200007;
export const CODAMA_ERROR__VISITORS__FAILED_TO_VALIDATE_NODE = 1200008;
export const CODAMA_ERROR__VISITORS__INSTRUCTION_ENUM_ARGUMENT_NOT_FOUND = 1200009;
export const CODAMA_ERROR__VISITORS__CANNOT_FLATTEN_STRUCT_WITH_CONFLICTING_ATTRIBUTES = 1200010;
export const CODAMA_ERROR__VISITORS__RENDER_MAP_KEY_NOT_FOUND = 1200011;
export const CODAMA_ERROR__VISITORS__CANNOT_REMOVE_LAST_PATH_IN_NODE_STACK = 1200012;

// Anchor-related errors.
// Reserve error codes in the range [2100000-2100999].
export const CODAMA_ERROR__ANCHOR__UNRECOGNIZED_IDL_TYPE = 2100000 as const;
export const CODAMA_ERROR__ANCHOR__ACCOUNT_TYPE_MISSING = 2100001 as const;
export const CODAMA_ERROR__ANCHOR__ARGUMENT_TYPE_MISSING = 2100002 as const;
export const CODAMA_ERROR__ANCHOR__TYPE_PATH_MISSING = 2100003 as const;
export const CODAMA_ERROR__ANCHOR__SEED_KIND_UNIMPLEMENTED = 2100004 as const;
export const CODAMA_ERROR__ANCHOR__UNRECOGNIZED_IDL_TYPE = 2100000;
export const CODAMA_ERROR__ANCHOR__ACCOUNT_TYPE_MISSING = 2100001;
export const CODAMA_ERROR__ANCHOR__ARGUMENT_TYPE_MISSING = 2100002;
export const CODAMA_ERROR__ANCHOR__TYPE_PATH_MISSING = 2100003;
export const CODAMA_ERROR__ANCHOR__SEED_KIND_UNIMPLEMENTED = 2100004;

// Renderers-related errors.
// Reserve error codes in the range [2800000-2800999].
export const CODAMA_ERROR__RENDERERS__UNSUPPORTED_NODE = 2800000 as const;
export const CODAMA_ERROR__RENDERERS__UNSUPPORTED_NODE = 2800000;

/**
* A union of every Codama error code
Expand Down
2 changes: 1 addition & 1 deletion packages/errors/src/message-formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function getHumanReadableErrorMessage<TErrorCode extends CodamaErrorCode>
): string {
const messageFormatString = CodamaErrorMessages[code];
const message = messageFormatString.replace(/(?<!\\)\$(\w+)/g, (substring, variableName) =>
variableName in context ? `${context[variableName as keyof typeof context]}` : substring,
variableName in context ? `${context[variableName as keyof typeof context] as string}` : substring,
);
return message;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/errors/test/error.typetest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const unexpectedNodeKindError = new CodamaError(CODAMA_ERROR__UNEXPECTED_NODE_KI

unexpectedNodeKindError.context satisfies CodamaErrorContext[typeof CODAMA_ERROR__UNEXPECTED_NODE_KIND];
// @ts-expect-error Non existent context property.
unexpectedNodeKindError.context.feePayer;
unexpectedNodeKindError.context.feePayer satisfies never;

// @ts-expect-error Missing context.
new CodamaError(CODAMA_ERROR__UNRECOGNIZED_NODE_KIND);
Expand Down
4 changes: 2 additions & 2 deletions packages/internals/scripts/lint.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { $, argv } from 'zx';
// Lint and format the code.
$.stdio = 'inherit';
if (argv.fix) {
await $`pnpm eslint --fix "src/*" "test/*" && pnpm prettier --log-level warn --ignore-unknown --write ./*`;
await $`pnpm eslint --fix . && pnpm prettier --log-level warn --ignore-unknown --write ./*`;
} else {
await $`pnpm eslint "src/*" "test/*" && pnpm prettier --check .`;
await $`pnpm eslint . && pnpm prettier --check .`;
}
6 changes: 0 additions & 6 deletions packages/node-types/.eslintrc.cjs

This file was deleted.

2 changes: 1 addition & 1 deletion packages/nodes-from-anchor/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export function rootNodeFromAnchor(idl: AnchorIdl): RootNode {
}

export function rootNodeFromAnchorWithoutDefaultVisitor(idl: AnchorIdl): RootNode {
if (idl.metadata?.spec === '0.1.0') {
if ((idl.metadata as { spec?: string })?.spec === '0.1.0') {
return rootNodeFromAnchorV01(idl as IdlV01);
}

Expand Down
4 changes: 2 additions & 2 deletions packages/nodes-from-anchor/src/v00/ProgramNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { instructionNodeFromAnchorV00 } from './InstructionNode';
import { pdaNodeFromAnchorV00 } from './PdaNode';

export function programNodeFromAnchorV00(idl: IdlV00): ProgramNode {
const origin: 'anchor' | 'shank' = idl.metadata?.origin ?? 'anchor';
const origin = (idl.metadata as { origin?: 'anchor' | 'shank' }).origin ?? 'anchor';
const pdas = (idl.accounts ?? []).filter(account => (account.seeds ?? []).length > 0).map(pdaNodeFromAnchorV00);
const accounts = (idl.accounts ?? []).map(a => accountNodeFromAnchorV00(a, origin));
const instructions = (idl.instructions ?? []).map(i => instructionNodeFromAnchorV00(i, origin));
Expand All @@ -20,7 +20,7 @@ export function programNodeFromAnchorV00(idl: IdlV00): ProgramNode {
name: idl.name ?? '',
origin,
pdas,
publicKey: idl.metadata?.address ?? '',
publicKey: (idl.metadata as { address?: string })?.address ?? '',
version: idl.version as ProgramVersion,
});
}
3 changes: 1 addition & 2 deletions packages/nodes-from-anchor/src/v00/idl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ export type IdlV00 = {
version: string;
};

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type IdlV00Metadata = any;
export type IdlV00Metadata = object;

export type IdlV00Constant = {
name: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export function enumTypeNodeFromAnchorV00(
});
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
function isStructVariant(variant: IdlV00EnumVariant): variant is IdlV00EnumVariant & { fields: IdlV00EnumFieldsNamed } {
const field = variant.fields![0];
return typeof field === 'object' && 'name' in field && 'type' in field;
Expand Down
16 changes: 4 additions & 12 deletions packages/nodes-from-anchor/src/v00/typeNodes/TypeNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,7 @@ import {
TypeNode,
} from '@codama/nodes';

import {
IdlV00Type,
IdlV00TypeDefTy,
IdlV00TypeDefTyEnum,
IdlV00TypeDefTyStruct,
IdlV00TypeMap,
IdlV00TypeSet,
IdlV00TypeTuple,
} from '../idl';
import { IdlV00Type, IdlV00TypeDefTy, IdlV00TypeMap, IdlV00TypeSet } from '../idl';
import { arrayTypeNodeFromAnchorV00 } from './ArrayTypeNode';
import { enumTypeNodeFromAnchorV00 } from './EnumTypeNode';
import { mapTypeNodeFromAnchorV00 } from './MapTypeNode';
Expand Down Expand Up @@ -81,7 +73,7 @@ export const typeNodeFromAnchorV00 = (idlType: IdlV00Type | IdlV00TypeDefTy): Ty

// Enum.
if ('kind' in idlType && idlType.kind === 'enum' && 'variants' in idlType) {
return enumTypeNodeFromAnchorV00(idlType as IdlV00TypeDefTyEnum);
return enumTypeNodeFromAnchorV00(idlType);
}

// Map.
Expand All @@ -104,12 +96,12 @@ export const typeNodeFromAnchorV00 = (idlType: IdlV00Type | IdlV00TypeDefTy): Ty

// Struct.
if ('kind' in idlType && 'fields' in idlType && idlType.kind === 'struct') {
return structTypeNodeFromAnchorV00(idlType as IdlV00TypeDefTyStruct);
return structTypeNodeFromAnchorV00(idlType);
}

// Tuple.
if ('tuple' in idlType && Array.isArray(idlType.tuple)) {
return tupleTypeNodeFromAnchorV00(idlType as IdlV00TypeTuple);
return tupleTypeNodeFromAnchorV00(idlType);
}

throw new CodamaError(CODAMA_ERROR__ANCHOR__UNRECOGNIZED_IDL_TYPE, {
Expand Down
9 changes: 3 additions & 6 deletions packages/nodes-from-anchor/src/v01/typeNodes/TypeNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ import {
IdlV01DefinedFieldsTuple,
IdlV01Field,
IdlV01Type,
IdlV01TypeCOption,
IdlV01TypeDefTy,
IdlV01TypeDefTyEnum,
IdlV01TypeOption,
} from '../idl';
import { arrayTypeNodeFromAnchorV01 } from './ArrayTypeNode';
import { enumTypeNodeFromAnchorV01 } from './EnumTypeNode';
Expand Down Expand Up @@ -82,16 +79,16 @@ export const typeNodeFromAnchorV01 = (idlType: IdlV01Type | IdlV01TypeDefTy): Ty

// Enum.
if ('kind' in idlType && idlType.kind === 'enum' && 'variants' in idlType) {
return enumTypeNodeFromAnchorV01(idlType as IdlV01TypeDefTyEnum);
return enumTypeNodeFromAnchorV01(idlType);
}

// Option.
if ('option' in idlType) {
return optionTypeNodeFromAnchorV01(idlType as IdlV01TypeOption);
return optionTypeNodeFromAnchorV01(idlType);
}

if ('coption' in idlType) {
return optionTypeNodeFromAnchorV01(idlType as IdlV01TypeCOption);
return optionTypeNodeFromAnchorV01(idlType);
}

// Struct and Tuple.
Expand Down
6 changes: 0 additions & 6 deletions packages/nodes/.eslintrc.cjs

This file was deleted.

6 changes: 3 additions & 3 deletions packages/renderers-js-umi/src/getTypeManifestVisitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export function getTypeManifestVisitor(input: {
if (!isUnsignedInteger(resolvedNode)) {
throw new Error(
`Amount wrappers can only be applied to unsigned ` +
`integer types. Got type [${amountType.number.toString()}].`,
`integer types. Got format [${resolvedNode.format}].`,
);
}
const { unit, decimals } = amountType;
Expand Down Expand Up @@ -251,7 +251,7 @@ export function getTypeManifestVisitor(input: {
if (!isInteger(dateTimeNumber)) {
throw new Error(
`DateTime wrappers can only be applied to integer ` +
`types. Got type [${dateTimeNumber.toString()}].`,
`types. Got format [${dateTimeNumber.format}].`,
);
}
numberManifest.strictImports.add('umi', 'DateTime');
Expand Down Expand Up @@ -655,7 +655,7 @@ export function getTypeManifestVisitor(input: {
if (!isUnsignedInteger(nestedNumber)) {
throw new Error(
`Amount wrappers can only be applied to unsigned ` +
`integer types. Got type [${nestedNumber.toString()}].`,
`integer types. Got format [${nestedNumber.format}].`,
);
}
const idAndDecimals = `'SOL', 9`;
Expand Down
2 changes: 1 addition & 1 deletion packages/renderers-js-umi/src/getValidatorBagVisitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function getValidationItemsVisitor(): Visitor<readonly ValidationItem[]>
`The ${getNodeTitle(node)} ${exportDetails}` +
`conflicts with the ${conflictExportDetails}` +
`${getNodeTitle(conflictingNode)}.\n` +
`|> Conflicting stack: ${exportConflict.stack}.`;
`|> Conflicting stack: ${exportConflict.stack.toString()}.`;
items.push(validationItem('error', message, node, stack));
});
return items;
Expand Down
2 changes: 1 addition & 1 deletion packages/renderers-js-umi/test/_setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export function codeStringAsRegex(code: string) {
async function normalizeCode(code: string) {
try {
code = await format(code, PRETTIER_OPTIONS);
} catch (e) {
} catch {
// Ignore errors.
}
return code.trim();
Expand Down
Loading