From 0747d42627d0173beedee15fd79dee769d50c5ab Mon Sep 17 00:00:00 2001 From: nedsalk Date: Fri, 27 Sep 2024 15:38:33 +0200 Subject: [PATCH 1/3] chore: disable `no-continue` eslint rule --- .changeset/thin-waves-care.md | 4 ++++ .eslintrc.js | 1 + .../account/src/providers/fuel-graphql-subscriber.ts | 1 - packages/contract/src/contract-factory.ts | 1 - packages/merkle/src/sparse/sparseMerkleTree.ts | 4 ---- packages/utils/src/utils/toUtf8String.ts | 9 ++++----- 6 files changed, 9 insertions(+), 11 deletions(-) create mode 100644 .changeset/thin-waves-care.md diff --git a/.changeset/thin-waves-care.md b/.changeset/thin-waves-care.md new file mode 100644 index 00000000000..12799d87b0e --- /dev/null +++ b/.changeset/thin-waves-care.md @@ -0,0 +1,4 @@ +--- +--- + +chore: disable `no-continue` eslint rule \ No newline at end of file diff --git a/.eslintrc.js b/.eslintrc.js index 90c1d962869..7624456d5ca 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -21,6 +21,7 @@ module.exports = { }, }, rules: { + 'no-continue': 'off', 'no-restricted-syntax': [ 'off', { diff --git a/packages/account/src/providers/fuel-graphql-subscriber.ts b/packages/account/src/providers/fuel-graphql-subscriber.ts index 5ada84b9356..d0ff7a9ad42 100644 --- a/packages/account/src/providers/fuel-graphql-subscriber.ts +++ b/packages/account/src/providers/fuel-graphql-subscriber.ts @@ -76,7 +76,6 @@ export class FuelGraphqlSubscriber implements AsyncIterator { .replace(':keep-alive-text\n\n', ''); if (decoded === '') { - // eslint-disable-next-line no-continue continue; } diff --git a/packages/contract/src/contract-factory.ts b/packages/contract/src/contract-factory.ts index 981091700ae..9adcfb3a55b 100644 --- a/packages/contract/src/contract-factory.ts +++ b/packages/contract/src/contract-factory.ts @@ -344,7 +344,6 @@ export default class ContractFactory { // is still valid so we can use this for the loader contract if ((err).message.indexOf(`BlobId is already taken ${blobId}`) > -1) { uploadedBlobs.push(blobId); - // eslint-disable-next-line no-continue continue; } diff --git a/packages/merkle/src/sparse/sparseMerkleTree.ts b/packages/merkle/src/sparse/sparseMerkleTree.ts index cadf8780a97..2e738f63174 100644 --- a/packages/merkle/src/sparse/sparseMerkleTree.ts +++ b/packages/merkle/src/sparse/sparseMerkleTree.ts @@ -114,7 +114,6 @@ export class SparseMerkleTree { for (let i = 0; i < sideNodes.length; i += 1) { if (sideNodes[i] === '') { - // eslint-disable-next-line no-continue continue; } @@ -127,7 +126,6 @@ export class SparseMerkleTree { // This is the leaf sibling that needs to be percolated up the tree. currentHash = sideNode; currentData = sideNode; - // eslint-disable-next-line no-continue continue; } else { // This is the node sibling that needs to be left in its place. @@ -139,7 +137,6 @@ export class SparseMerkleTree { if (!nonPlaceholderReached && sideNode === ZERO) { // We found another placeholder sibling node, keep going up the // tree until we find the first sibling that is not a placeholder. - // eslint-disable-next-line no-continue continue; } else if (!nonPlaceholderReached) { // We found the first sibling node that is not a placeholder, it is @@ -221,7 +218,6 @@ export class SparseMerkleTree { if (commonPrefixCount !== MAX_HEIGHT && commonPrefixCount > MAX_HEIGHT - 1 - i) { sideNode = ZERO; } else { - // eslint-disable-next-line no-continue continue; } } else { diff --git a/packages/utils/src/utils/toUtf8String.ts b/packages/utils/src/utils/toUtf8String.ts index a4a3795b1a7..534473571d4 100644 --- a/packages/utils/src/utils/toUtf8String.ts +++ b/packages/utils/src/utils/toUtf8String.ts @@ -1,4 +1,3 @@ -/* eslint-disable no-continue */ import type { BytesLike } from '@fuel-ts/interfaces'; import { arrayify } from './arrayify'; @@ -47,13 +46,13 @@ function onError( reason: Utf8ErrorReason, offset: number, bytes: Uint8Array, - // eslint-disable-next-line @typescript-eslint/no-unused-vars + output: Array, - // eslint-disable-next-line @typescript-eslint/no-unused-vars + badCodepoint?: number ): number { // #TODO: Log these as warnings after https://github.com/FuelLabs/fuels-ts/issues/2298 is implemented. - // eslint-disable-next-line no-console + console.log(`invalid codepoint at offset ${offset}; ${reason}, bytes: ${bytes}`); return offset; } @@ -64,7 +63,7 @@ function helper(codePoints: Array): string { if (codePoint <= 0xffff) { return String.fromCharCode(codePoint); } - // eslint-disable-next-line no-param-reassign + codePoint -= 0x10000; return String.fromCharCode( ((codePoint >> 10) & 0x3ff) + 0xd800, From 57781b52bfac3dd8a8af9354f0daa18d11536ad1 Mon Sep 17 00:00:00 2001 From: nedsalk Date: Fri, 27 Sep 2024 18:09:41 +0200 Subject: [PATCH 2/3] fix erroneously removed eslint-disables --- packages/utils/src/utils/toUtf8String.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/utils/src/utils/toUtf8String.ts b/packages/utils/src/utils/toUtf8String.ts index 534473571d4..b243df38bf7 100644 --- a/packages/utils/src/utils/toUtf8String.ts +++ b/packages/utils/src/utils/toUtf8String.ts @@ -47,12 +47,15 @@ function onError( offset: number, bytes: Uint8Array, + // eslint-disable-next-line @typescript-eslint/no-unused-vars output: Array, + // eslint-disable-next-line @typescript-eslint/no-unused-vars badCodepoint?: number ): number { // #TODO: Log these as warnings after https://github.com/FuelLabs/fuels-ts/issues/2298 is implemented. + // eslint-disable-next-line no-console console.log(`invalid codepoint at offset ${offset}; ${reason}, bytes: ${bytes}`); return offset; } @@ -64,6 +67,7 @@ function helper(codePoints: Array): string { return String.fromCharCode(codePoint); } + // eslint-disable-next-line no-param-reassign codePoint -= 0x10000; return String.fromCharCode( ((codePoint >> 10) & 0x3ff) + 0xd800, From a28858213f476ca395a1e57b88c94352de76785e Mon Sep 17 00:00:00 2001 From: nedsalk Date: Fri, 27 Sep 2024 18:10:41 +0200 Subject: [PATCH 3/3] remove newlines --- packages/utils/src/utils/toUtf8String.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/packages/utils/src/utils/toUtf8String.ts b/packages/utils/src/utils/toUtf8String.ts index b243df38bf7..992f37b667b 100644 --- a/packages/utils/src/utils/toUtf8String.ts +++ b/packages/utils/src/utils/toUtf8String.ts @@ -46,15 +46,12 @@ function onError( reason: Utf8ErrorReason, offset: number, bytes: Uint8Array, - // eslint-disable-next-line @typescript-eslint/no-unused-vars output: Array, - // eslint-disable-next-line @typescript-eslint/no-unused-vars badCodepoint?: number ): number { // #TODO: Log these as warnings after https://github.com/FuelLabs/fuels-ts/issues/2298 is implemented. - // eslint-disable-next-line no-console console.log(`invalid codepoint at offset ${offset}; ${reason}, bytes: ${bytes}`); return offset; @@ -66,7 +63,6 @@ function helper(codePoints: Array): string { if (codePoint <= 0xffff) { return String.fromCharCode(codePoint); } - // eslint-disable-next-line no-param-reassign codePoint -= 0x10000; return String.fromCharCode(