Skip to content

Commit

Permalink
Upgrade ESLint to v9 (#334)
Browse files Browse the repository at this point in the history
* Upgrade to Eslint 9

* Fix new linting errors

* Adjust configs

* Use tseslint.config helper

* Update eslint.config.mjs

* Update turbo.json

* Enable @typescript-eslint/no-unsafe-return

* Enable @typescript-eslint/unbound-method

* Enable @typescript-eslint/no-base-to-string

* Enable @typescript-eslint/no-unsafe-argument

* Enable @typescript-eslint/no-unsafe-assignment

* Enable @typescript-eslint/no-unsafe-call

* Enable @typescript-eslint/no-unsafe-enum-comparison

* Enable @typescript-eslint/no-unsafe-member-access

* Enable @typescript-eslint/only-throw-error

* Enable @typescript-eslint/prefer-promise-reject-errors

* Enable @typescript-eslint/restrict-plus-operands

* Enable @typescript-eslint/restrict-template-expressions

* Update index.ts

* Add changeset

* Try disabling new rules again for CI

Despite it working locally... 😭

* Revert "Try disabling new rules again for CI"

This reverts commit 88bab9e.

* Fix @typescript-eslint/no-unused-vars

* Update tsconfig.json

* Build before lint in CI

* Update tsconfig.json

* Simplify script
  • Loading branch information
lorisleiva authored Nov 28, 2024
1 parent 7aad1b6 commit 2622727
Show file tree
Hide file tree
Showing 40 changed files with 2,407 additions and 502 deletions.
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

0 comments on commit 2622727

Please sign in to comment.