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

chore : cat no console es lint rule added to pkgs with minimal/no changes #3054

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion packages/3id-did-resolver/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
3 changes: 2 additions & 1 deletion packages/anchor-listener/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
3 changes: 2 additions & 1 deletion packages/anchor-utils/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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` +
Expand Down
3 changes: 2 additions & 1 deletion packages/blockchain-utils-validation/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
3 changes: 2 additions & 1 deletion packages/codecs/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
3 changes: 2 additions & 1 deletion packages/core/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
3 changes: 2 additions & 1 deletion packages/http-client/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
6 changes: 4 additions & 2 deletions packages/http-client/src/dummy-pin-api.ts
Original file line number Diff line number Diff line change
@@ -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.`
)
}
Expand Down
3 changes: 2 additions & 1 deletion packages/ipfs-daemon/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
7 changes: 5 additions & 2 deletions packages/ipfs-daemon/src/bin/ipfs-daemon.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
#!/usr/bin/env node

import { IpfsDaemon } from '../ipfs-daemon.js'
import { LoggerProvider } from '@ceramicnetwork/common'
Copy link
Contributor Author

@samika98 samika98 Dec 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code change here, in this file. Let me know if we want to keep console.log in the http-client library, or changing it with the logger is better


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))
3 changes: 2 additions & 1 deletion packages/ipfs-topology/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
3 changes: 2 additions & 1 deletion packages/job-queue/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
3 changes: 2 additions & 1 deletion packages/pinning-aggregation/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
3 changes: 2 additions & 1 deletion packages/pinning-crust-backend/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
10 changes: 7 additions & 3 deletions packages/pinning-crust-backend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Copy link
Contributor Author

@samika98 samika98 Dec 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Change here, in this file


// Encoder
const textEncoder = new TextEncoder()

// Logger
const logger = new LoggerProvider().getDiagnosticsLogger()

// Errors
export class EmptySeedError extends Error {
constructor(address: string) {
Expand Down Expand Up @@ -177,7 +181,7 @@ export class CrustPinningBackend implements PinningBackend {
async sendTx(tx: SubmittableExtrinsic, krp: KeyringPair): Promise<void> {
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.`))
Expand All @@ -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()
}
})
Expand Down
3 changes: 2 additions & 1 deletion packages/pinning-ipfs-backend/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
3 changes: 2 additions & 1 deletion packages/pinning-powergate-backend/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
3 changes: 2 additions & 1 deletion packages/stream-caip10-link-handler/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
3 changes: 2 additions & 1 deletion packages/stream-caip10-link/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
3 changes: 2 additions & 1 deletion packages/stream-handler-common/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
3 changes: 2 additions & 1 deletion packages/stream-model-handler/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
3 changes: 2 additions & 1 deletion packages/stream-model-instance-handler/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
3 changes: 2 additions & 1 deletion packages/stream-model-instance/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
3 changes: 2 additions & 1 deletion packages/stream-model/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
3 changes: 2 additions & 1 deletion packages/stream-tile-handler/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
3 changes: 2 additions & 1 deletion packages/stream-tile/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
3 changes: 2 additions & 1 deletion packages/streamid/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down