From 4959a13b23cff286de5d31b8dbd30ab049adaf5a Mon Sep 17 00:00:00 2001 From: George Oastler Date: Wed, 26 Jun 2024 17:16:22 +0100 Subject: [PATCH 1/2] remove eslint fix - has been added to typechain templates --- dev/scripts/src/contract/import.ts | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/dev/scripts/src/contract/import.ts b/dev/scripts/src/contract/import.ts index 27f26364fd..269cfde83e 100644 --- a/dev/scripts/src/contract/import.ts +++ b/dev/scripts/src/contract/import.ts @@ -110,16 +110,6 @@ async function importContract(pathToAbis: string, pathToOutput: string) { return result }) - // replace EventRecord incorrect imports - // eslint-disable-next-line no-useless-escape - replaced = replaced.replace( - /import\s+type\s+\{\s*EventRecord\s*\}\s+from\s+['"]@polkadot\/api\/submittable["']/g, - (match) => { - const result = `import type { EventRecord } from '@polkadot/types/interfaces'` - if (verbose) console.log(`Replacing \n\t${match}\nwith\n\t${result}\nin ${filePath}`) - return result - } - ) fs.writeFileSync(filePath, replaced) } From dccf0f09c7259c5376fd6746c0776e61b923cb62 Mon Sep 17 00:00:00 2001 From: George Oastler Date: Wed, 26 Jun 2024 17:24:40 +0100 Subject: [PATCH 2/2] remove typechain regex fixes --- dev/scripts/src/contract/import.ts | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/dev/scripts/src/contract/import.ts b/dev/scripts/src/contract/import.ts index 269cfde83e..4a9c626df4 100644 --- a/dev/scripts/src/contract/import.ts +++ b/dev/scripts/src/contract/import.ts @@ -93,23 +93,6 @@ async function importContract(pathToAbis: string, pathToOutput: string) { if (verbose) console.log(`Replacing \n\t${match}\nwith\n\t${result}\nin ${filePath}`) return `${result}` }) - // eslint-disable-next-line no-useless-escape - replaced = replaced.replace(/\n(.*)\n(\s*)\/\/\s*@ts-ignore/g, (match, p1, p2) => { - // don't replace if already ignored by eslint - if (p1.includes('eslint-disable-next-line')) return match - const result = `\n${p1}\n${p2}// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n${p2}// @ts-ignore` - if (verbose) console.log(`Replacing \n\t${match}\nwith\n\t${result}\nin ${filePath}`) - return result - }) - - // replace EventRecord with EventRecord[] - // eslint-disable-next-line no-useless-escape - replaced = replaced.replace(/: EventRecord\)/g, (match) => { - const result = `: EventRecord[])` - if (verbose) console.log(`Replacing \n\t${match}\nwith\n\t${result}\nin ${filePath}`) - return result - }) - fs.writeFileSync(filePath, replaced) }