From df647e6233ad16cc115e7e2489fcc9e451855b8e Mon Sep 17 00:00:00 2001 From: Samika Kashyap Date: Mon, 4 Dec 2023 14:49:30 -0800 Subject: [PATCH 1/3] no console es lint rule added to pkgs with minimal/no changes --- packages/3id-did-resolver/.eslintrc.json | 3 ++- packages/anchor-listener/.eslintrc.json | 3 ++- packages/anchor-utils/.eslintrc.json | 3 ++- .../src/merkle/__tests__/merkle-proof.test.ts | 2 +- packages/blockchain-utils-validation/.eslintrc.json | 3 ++- packages/codecs/.eslintrc.json | 3 ++- packages/core/.eslintrc.json | 3 ++- packages/http-client/.eslintrc.json | 3 ++- packages/http-client/src/dummy-pin-api.ts | 6 ++++-- packages/indexing/.eslintrc.json | 3 ++- packages/ipfs-daemon/.eslintrc.json | 3 ++- packages/ipfs-daemon/src/bin/ipfs-daemon.ts | 7 +++++-- packages/ipfs-topology/.eslintrc.json | 3 ++- packages/job-queue/.eslintrc.json | 3 ++- packages/pinning-aggregation/.eslintrc.json | 3 ++- packages/pinning-crust-backend/.eslintrc.json | 3 ++- packages/pinning-crust-backend/src/index.ts | 10 +++++++--- packages/pinning-ipfs-backend/.eslintrc.json | 3 ++- packages/pinning-powergate-backend/.eslintrc.json | 3 ++- packages/stream-caip10-link-handler/.eslintrc.json | 3 ++- packages/stream-caip10-link/.eslintrc.json | 3 ++- packages/stream-handler-common/.eslintrc.json | 3 ++- packages/stream-model-handler/.eslintrc.json | 3 ++- packages/stream-model-instance-handler/.eslintrc.json | 3 ++- packages/stream-model-instance/.eslintrc.json | 3 ++- packages/stream-model/.eslintrc.json | 3 ++- packages/stream-tests/.eslintrc.json | 3 ++- packages/stream-tile-handler/.eslintrc.json | 3 ++- packages/stream-tile/.eslintrc.json | 3 ++- packages/streamid/.eslintrc.json | 3 ++- 30 files changed, 69 insertions(+), 34 deletions(-) diff --git a/packages/3id-did-resolver/.eslintrc.json b/packages/3id-did-resolver/.eslintrc.json index 49950bd36b..913959747f 100644 --- a/packages/3id-did-resolver/.eslintrc.json +++ b/packages/3id-did-resolver/.eslintrc.json @@ -12,7 +12,8 @@ "@typescript-eslint/ban-ts-comment": "off", "import/no-unresolved": "error", "import/default": "off", - "@typescript-eslint/no-floating-promises": "error" + "@typescript-eslint/no-floating-promises": "error", + "no-console": "error" }, "settings": { "import/parsers": { diff --git a/packages/anchor-listener/.eslintrc.json b/packages/anchor-listener/.eslintrc.json index 405708060c..e987b15ff4 100644 --- a/packages/anchor-listener/.eslintrc.json +++ b/packages/anchor-listener/.eslintrc.json @@ -12,7 +12,8 @@ "@typescript-eslint/ban-ts-comment": "off", "import/no-unresolved": "error", "import/default": "off", - "@typescript-eslint/no-floating-promises": "error" + "@typescript-eslint/no-floating-promises": "error", + "no-console": "error" }, "settings": { "import/parsers": { diff --git a/packages/anchor-utils/.eslintrc.json b/packages/anchor-utils/.eslintrc.json index 98d83bbe5d..8c6560cdf9 100644 --- a/packages/anchor-utils/.eslintrc.json +++ b/packages/anchor-utils/.eslintrc.json @@ -12,7 +12,8 @@ "@typescript-eslint/ban-ts-comment": "off", "import/no-unresolved": "error", "import/default": "off", - "@typescript-eslint/no-floating-promises": "error" + "@typescript-eslint/no-floating-promises": "error", + "no-console": "error" }, "settings": { "import/parsers": { diff --git a/packages/anchor-utils/src/merkle/__tests__/merkle-proof.test.ts b/packages/anchor-utils/src/merkle/__tests__/merkle-proof.test.ts index 70e9c3d07a..d9d0ccdcbf 100644 --- a/packages/anchor-utils/src/merkle/__tests__/merkle-proof.test.ts +++ b/packages/anchor-utils/src/merkle/__tests__/merkle-proof.test.ts @@ -66,7 +66,7 @@ describe('Merkle tree proofs tests', () => { const hashedProof = uint8arrays.toString(hashProof(leaf, proof), 'hex') if (hashedProof !== root) { const lettersProof = lettersTree.getProof(i) - // tslint:disable-next-line:no-console + // eslint-disable-next-line no-console console.log( 'The resulting hash of your proof is wrong. \n' + `We were expecting: ${root} \n` + diff --git a/packages/blockchain-utils-validation/.eslintrc.json b/packages/blockchain-utils-validation/.eslintrc.json index 49950bd36b..913959747f 100644 --- a/packages/blockchain-utils-validation/.eslintrc.json +++ b/packages/blockchain-utils-validation/.eslintrc.json @@ -12,7 +12,8 @@ "@typescript-eslint/ban-ts-comment": "off", "import/no-unresolved": "error", "import/default": "off", - "@typescript-eslint/no-floating-promises": "error" + "@typescript-eslint/no-floating-promises": "error", + "no-console": "error" }, "settings": { "import/parsers": { diff --git a/packages/codecs/.eslintrc.json b/packages/codecs/.eslintrc.json index 405708060c..e987b15ff4 100644 --- a/packages/codecs/.eslintrc.json +++ b/packages/codecs/.eslintrc.json @@ -12,7 +12,8 @@ "@typescript-eslint/ban-ts-comment": "off", "import/no-unresolved": "error", "import/default": "off", - "@typescript-eslint/no-floating-promises": "error" + "@typescript-eslint/no-floating-promises": "error", + "no-console": "error" }, "settings": { "import/parsers": { diff --git a/packages/core/.eslintrc.json b/packages/core/.eslintrc.json index ca04572275..a966efac21 100644 --- a/packages/core/.eslintrc.json +++ b/packages/core/.eslintrc.json @@ -7,7 +7,8 @@ "@typescript-eslint/ban-ts-ignore": "off", "@typescript-eslint/ban-ts-comment": "off", "import/no-unresolved": "error", - "import/default": "off" + "import/default": "off", + "no-console": "error" }, "settings": { "import/parsers": { diff --git a/packages/http-client/.eslintrc.json b/packages/http-client/.eslintrc.json index 49950bd36b..913959747f 100644 --- a/packages/http-client/.eslintrc.json +++ b/packages/http-client/.eslintrc.json @@ -12,7 +12,8 @@ "@typescript-eslint/ban-ts-comment": "off", "import/no-unresolved": "error", "import/default": "off", - "@typescript-eslint/no-floating-promises": "error" + "@typescript-eslint/no-floating-promises": "error", + "no-console": "error" }, "settings": { "import/parsers": { diff --git a/packages/http-client/src/dummy-pin-api.ts b/packages/http-client/src/dummy-pin-api.ts index 3cbc0c494b..7a42ec8c68 100644 --- a/packages/http-client/src/dummy-pin-api.ts +++ b/packages/http-client/src/dummy-pin-api.ts @@ -1,8 +1,10 @@ -import { PinApi, PublishOpts } from '@ceramicnetwork/common' +import { PinApi, PublishOpts, LoggerProvider } from '@ceramicnetwork/common' import { StreamID } from '@ceramicnetwork/streamid' +const logger = new LoggerProvider().getDiagnosticsLogger() + function warn(operation: string) { - console.warn( + logger.warn( `You are using the ceramic.pin.${operation} API which has been removed and is now a no-op. This operation will not have any affect. If you want to change the pin state of streams please use the new ceramic.admin.pin API which requires a DID that has been granted admin access on the Ceramic node.` ) } diff --git a/packages/indexing/.eslintrc.json b/packages/indexing/.eslintrc.json index ca04572275..a966efac21 100644 --- a/packages/indexing/.eslintrc.json +++ b/packages/indexing/.eslintrc.json @@ -7,7 +7,8 @@ "@typescript-eslint/ban-ts-ignore": "off", "@typescript-eslint/ban-ts-comment": "off", "import/no-unresolved": "error", - "import/default": "off" + "import/default": "off", + "no-console": "error" }, "settings": { "import/parsers": { diff --git a/packages/ipfs-daemon/.eslintrc.json b/packages/ipfs-daemon/.eslintrc.json index ca04572275..a966efac21 100644 --- a/packages/ipfs-daemon/.eslintrc.json +++ b/packages/ipfs-daemon/.eslintrc.json @@ -7,7 +7,8 @@ "@typescript-eslint/ban-ts-ignore": "off", "@typescript-eslint/ban-ts-comment": "off", "import/no-unresolved": "error", - "import/default": "off" + "import/default": "off", + "no-console": "error" }, "settings": { "import/parsers": { diff --git a/packages/ipfs-daemon/src/bin/ipfs-daemon.ts b/packages/ipfs-daemon/src/bin/ipfs-daemon.ts index 95803633f6..6cef7f6d62 100644 --- a/packages/ipfs-daemon/src/bin/ipfs-daemon.ts +++ b/packages/ipfs-daemon/src/bin/ipfs-daemon.ts @@ -1,11 +1,14 @@ #!/usr/bin/env node import { IpfsDaemon } from '../ipfs-daemon.js' +import { LoggerProvider } from '@ceramicnetwork/common' + +const logger = new LoggerProvider().getDiagnosticsLogger() process.on('uncaughtException', (err) => { - console.log(err) // just log for now + logger.err(err) }) IpfsDaemon.create() .then((ipfs) => ipfs.start()) - .catch((e) => console.error(e)) + .catch((e) => logger.err(e)) diff --git a/packages/ipfs-topology/.eslintrc.json b/packages/ipfs-topology/.eslintrc.json index a5f4b7fd5c..d2408608eb 100644 --- a/packages/ipfs-topology/.eslintrc.json +++ b/packages/ipfs-topology/.eslintrc.json @@ -12,7 +12,8 @@ "@typescript-eslint/ban-ts-comment": "off", "import/no-unresolved": "error", "import/default": "off", - "@typescript-eslint/no-floating-promises": "error" + "@typescript-eslint/no-floating-promises": "error", + "no-console": "error" }, "settings": { "import/parsers": { diff --git a/packages/job-queue/.eslintrc.json b/packages/job-queue/.eslintrc.json index a5f4b7fd5c..d2408608eb 100644 --- a/packages/job-queue/.eslintrc.json +++ b/packages/job-queue/.eslintrc.json @@ -12,7 +12,8 @@ "@typescript-eslint/ban-ts-comment": "off", "import/no-unresolved": "error", "import/default": "off", - "@typescript-eslint/no-floating-promises": "error" + "@typescript-eslint/no-floating-promises": "error", + "no-console": "error" }, "settings": { "import/parsers": { diff --git a/packages/pinning-aggregation/.eslintrc.json b/packages/pinning-aggregation/.eslintrc.json index 405708060c..7bb46c3ac9 100644 --- a/packages/pinning-aggregation/.eslintrc.json +++ b/packages/pinning-aggregation/.eslintrc.json @@ -12,7 +12,8 @@ "@typescript-eslint/ban-ts-comment": "off", "import/no-unresolved": "error", "import/default": "off", - "@typescript-eslint/no-floating-promises": "error" + "@typescript-eslint/no-floating-promises": "error", + "no-console": "error" }, "settings": { "import/parsers": { diff --git a/packages/pinning-crust-backend/.eslintrc.json b/packages/pinning-crust-backend/.eslintrc.json index 49950bd36b..913959747f 100644 --- a/packages/pinning-crust-backend/.eslintrc.json +++ b/packages/pinning-crust-backend/.eslintrc.json @@ -12,7 +12,8 @@ "@typescript-eslint/ban-ts-comment": "off", "import/no-unresolved": "error", "import/default": "off", - "@typescript-eslint/no-floating-promises": "error" + "@typescript-eslint/no-floating-promises": "error", + "no-console": "error" }, "settings": { "import/parsers": { diff --git a/packages/pinning-crust-backend/src/index.ts b/packages/pinning-crust-backend/src/index.ts index 5b7f8fb767..4c1025eb6e 100644 --- a/packages/pinning-crust-backend/src/index.ts +++ b/packages/pinning-crust-backend/src/index.ts @@ -9,10 +9,14 @@ import { KeyringPair } from '@polkadot/keyring/types' import { DispatchError } from '@polkadot/types/interfaces' import { ITuple } from '@polkadot/types/types' import { SubmittableExtrinsic } from '@polkadot/api/promise/types' +import { LoggerProvider } from '@ceramicnetwork/common' // Encoder const textEncoder = new TextEncoder() +// Logger +const logger = new LoggerProvider().getDiagnosticsLogger() + // Errors export class EmptySeedError extends Error { constructor(address: string) { @@ -177,7 +181,7 @@ export class CrustPinningBackend implements PinningBackend { async sendTx(tx: SubmittableExtrinsic, krp: KeyringPair): Promise { return new Promise((resolve, reject) => { tx.signAndSend(krp, ({ events = [], status }) => { - console.log(` ↪ 💸 [tx]: Transaction status: ${status.type}, nonce: ${tx.nonce}`) + logger.imp(` ↪ 💸 [tx]: Transaction status: ${status.type}, nonce: ${tx.nonce}`) if (status.isInvalid || status.isDropped || status.isUsurped) { reject(new Error(`${status.type} transaction.`)) @@ -189,12 +193,12 @@ export class CrustPinningBackend implements PinningBackend { events.forEach(({ event: { data, method, section } }) => { if (section === 'system' && method === 'ExtrinsicFailed') { const [dispatchError] = data as unknown as ITuple<[DispatchError]> - console.log( + logger.err( ` ↪ 💸 ❌ [tx]: Send transaction(${tx.type}) failed with ${dispatchError.type}.` ) reject(new TxError(tx.type, dispatchError.type)) } else if (method === 'ExtrinsicSuccess') { - console.log(` ↪ 💸 ✅ [tx]: Send transaction(${tx.type}) success.`) + logger.imp(` ↪ 💸 ✅ [tx]: Send transaction(${tx.type}) success.`) resolve() } }) diff --git a/packages/pinning-ipfs-backend/.eslintrc.json b/packages/pinning-ipfs-backend/.eslintrc.json index 49950bd36b..913959747f 100644 --- a/packages/pinning-ipfs-backend/.eslintrc.json +++ b/packages/pinning-ipfs-backend/.eslintrc.json @@ -12,7 +12,8 @@ "@typescript-eslint/ban-ts-comment": "off", "import/no-unresolved": "error", "import/default": "off", - "@typescript-eslint/no-floating-promises": "error" + "@typescript-eslint/no-floating-promises": "error", + "no-console": "error" }, "settings": { "import/parsers": { diff --git a/packages/pinning-powergate-backend/.eslintrc.json b/packages/pinning-powergate-backend/.eslintrc.json index 98d83bbe5d..8c6560cdf9 100644 --- a/packages/pinning-powergate-backend/.eslintrc.json +++ b/packages/pinning-powergate-backend/.eslintrc.json @@ -12,7 +12,8 @@ "@typescript-eslint/ban-ts-comment": "off", "import/no-unresolved": "error", "import/default": "off", - "@typescript-eslint/no-floating-promises": "error" + "@typescript-eslint/no-floating-promises": "error", + "no-console": "error" }, "settings": { "import/parsers": { diff --git a/packages/stream-caip10-link-handler/.eslintrc.json b/packages/stream-caip10-link-handler/.eslintrc.json index a5f4b7fd5c..d2408608eb 100644 --- a/packages/stream-caip10-link-handler/.eslintrc.json +++ b/packages/stream-caip10-link-handler/.eslintrc.json @@ -12,7 +12,8 @@ "@typescript-eslint/ban-ts-comment": "off", "import/no-unresolved": "error", "import/default": "off", - "@typescript-eslint/no-floating-promises": "error" + "@typescript-eslint/no-floating-promises": "error", + "no-console": "error" }, "settings": { "import/parsers": { diff --git a/packages/stream-caip10-link/.eslintrc.json b/packages/stream-caip10-link/.eslintrc.json index 49950bd36b..913959747f 100644 --- a/packages/stream-caip10-link/.eslintrc.json +++ b/packages/stream-caip10-link/.eslintrc.json @@ -12,7 +12,8 @@ "@typescript-eslint/ban-ts-comment": "off", "import/no-unresolved": "error", "import/default": "off", - "@typescript-eslint/no-floating-promises": "error" + "@typescript-eslint/no-floating-promises": "error", + "no-console": "error" }, "settings": { "import/parsers": { diff --git a/packages/stream-handler-common/.eslintrc.json b/packages/stream-handler-common/.eslintrc.json index a5f4b7fd5c..d2408608eb 100644 --- a/packages/stream-handler-common/.eslintrc.json +++ b/packages/stream-handler-common/.eslintrc.json @@ -12,7 +12,8 @@ "@typescript-eslint/ban-ts-comment": "off", "import/no-unresolved": "error", "import/default": "off", - "@typescript-eslint/no-floating-promises": "error" + "@typescript-eslint/no-floating-promises": "error", + "no-console": "error" }, "settings": { "import/parsers": { diff --git a/packages/stream-model-handler/.eslintrc.json b/packages/stream-model-handler/.eslintrc.json index ca04572275..a966efac21 100644 --- a/packages/stream-model-handler/.eslintrc.json +++ b/packages/stream-model-handler/.eslintrc.json @@ -7,7 +7,8 @@ "@typescript-eslint/ban-ts-ignore": "off", "@typescript-eslint/ban-ts-comment": "off", "import/no-unresolved": "error", - "import/default": "off" + "import/default": "off", + "no-console": "error" }, "settings": { "import/parsers": { diff --git a/packages/stream-model-instance-handler/.eslintrc.json b/packages/stream-model-instance-handler/.eslintrc.json index a5f4b7fd5c..d2408608eb 100644 --- a/packages/stream-model-instance-handler/.eslintrc.json +++ b/packages/stream-model-instance-handler/.eslintrc.json @@ -12,7 +12,8 @@ "@typescript-eslint/ban-ts-comment": "off", "import/no-unresolved": "error", "import/default": "off", - "@typescript-eslint/no-floating-promises": "error" + "@typescript-eslint/no-floating-promises": "error", + "no-console": "error" }, "settings": { "import/parsers": { diff --git a/packages/stream-model-instance/.eslintrc.json b/packages/stream-model-instance/.eslintrc.json index a5f4b7fd5c..d2408608eb 100644 --- a/packages/stream-model-instance/.eslintrc.json +++ b/packages/stream-model-instance/.eslintrc.json @@ -12,7 +12,8 @@ "@typescript-eslint/ban-ts-comment": "off", "import/no-unresolved": "error", "import/default": "off", - "@typescript-eslint/no-floating-promises": "error" + "@typescript-eslint/no-floating-promises": "error", + "no-console": "error" }, "settings": { "import/parsers": { diff --git a/packages/stream-model/.eslintrc.json b/packages/stream-model/.eslintrc.json index 49950bd36b..913959747f 100644 --- a/packages/stream-model/.eslintrc.json +++ b/packages/stream-model/.eslintrc.json @@ -12,7 +12,8 @@ "@typescript-eslint/ban-ts-comment": "off", "import/no-unresolved": "error", "import/default": "off", - "@typescript-eslint/no-floating-promises": "error" + "@typescript-eslint/no-floating-promises": "error", + "no-console": "error" }, "settings": { "import/parsers": { diff --git a/packages/stream-tests/.eslintrc.json b/packages/stream-tests/.eslintrc.json index ca04572275..a966efac21 100644 --- a/packages/stream-tests/.eslintrc.json +++ b/packages/stream-tests/.eslintrc.json @@ -7,7 +7,8 @@ "@typescript-eslint/ban-ts-ignore": "off", "@typescript-eslint/ban-ts-comment": "off", "import/no-unresolved": "error", - "import/default": "off" + "import/default": "off", + "no-console": "error" }, "settings": { "import/parsers": { diff --git a/packages/stream-tile-handler/.eslintrc.json b/packages/stream-tile-handler/.eslintrc.json index 49950bd36b..913959747f 100644 --- a/packages/stream-tile-handler/.eslintrc.json +++ b/packages/stream-tile-handler/.eslintrc.json @@ -12,7 +12,8 @@ "@typescript-eslint/ban-ts-comment": "off", "import/no-unresolved": "error", "import/default": "off", - "@typescript-eslint/no-floating-promises": "error" + "@typescript-eslint/no-floating-promises": "error", + "no-console": "error" }, "settings": { "import/parsers": { diff --git a/packages/stream-tile/.eslintrc.json b/packages/stream-tile/.eslintrc.json index a5f4b7fd5c..661b754e4f 100644 --- a/packages/stream-tile/.eslintrc.json +++ b/packages/stream-tile/.eslintrc.json @@ -12,7 +12,8 @@ "@typescript-eslint/ban-ts-comment": "off", "import/no-unresolved": "error", "import/default": "off", - "@typescript-eslint/no-floating-promises": "error" + "@typescript-eslint/no-floating-promises": "error", + "no-console": "error" }, "settings": { "import/parsers": { diff --git a/packages/streamid/.eslintrc.json b/packages/streamid/.eslintrc.json index a5f4b7fd5c..d2408608eb 100644 --- a/packages/streamid/.eslintrc.json +++ b/packages/streamid/.eslintrc.json @@ -12,7 +12,8 @@ "@typescript-eslint/ban-ts-comment": "off", "import/no-unresolved": "error", "import/default": "off", - "@typescript-eslint/no-floating-promises": "error" + "@typescript-eslint/no-floating-promises": "error", + "no-console": "error" }, "settings": { "import/parsers": { From a5ad8a5e990aed8a336f1eb76498d6218f8789ef Mon Sep 17 00:00:00 2001 From: Samika Kashyap Date: Mon, 4 Dec 2023 14:59:44 -0800 Subject: [PATCH 2/3] removed indexing from this PR --- packages/indexing/.eslintrc.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/indexing/.eslintrc.json b/packages/indexing/.eslintrc.json index a966efac21..ca04572275 100644 --- a/packages/indexing/.eslintrc.json +++ b/packages/indexing/.eslintrc.json @@ -7,8 +7,7 @@ "@typescript-eslint/ban-ts-ignore": "off", "@typescript-eslint/ban-ts-comment": "off", "import/no-unresolved": "error", - "import/default": "off", - "no-console": "error" + "import/default": "off" }, "settings": { "import/parsers": { From 37a3745d185ce0decbe9c4adb4d6ce5da152375d Mon Sep 17 00:00:00 2001 From: Samika Kashyap Date: Tue, 5 Dec 2023 13:08:07 -0800 Subject: [PATCH 3/3] removed stream tests from this pr --- packages/stream-tests/.eslintrc.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/stream-tests/.eslintrc.json b/packages/stream-tests/.eslintrc.json index a966efac21..ca04572275 100644 --- a/packages/stream-tests/.eslintrc.json +++ b/packages/stream-tests/.eslintrc.json @@ -7,8 +7,7 @@ "@typescript-eslint/ban-ts-ignore": "off", "@typescript-eslint/ban-ts-comment": "off", "import/no-unresolved": "error", - "import/default": "off", - "no-console": "error" + "import/default": "off" }, "settings": { "import/parsers": {