diff --git a/api/.eslintrc.js b/api/.eslintrc.js index 84e3ba85a..03b1d9a1a 100644 --- a/api/.eslintrc.js +++ b/api/.eslintrc.js @@ -250,7 +250,7 @@ module.exports = { "no-compare-neg-zero": ["error"], "no-cond-assign": ["error"], "no-confusing-arrow": ["error"], - "no-console": ["off"], + "no-console": ["error", { allow: ["warn", "error"] }], "no-const-assign": ["off"], "no-constant-condition": ["error"], "no-constructor-return": ["error"], diff --git a/api/package.json b/api/package.json index 4095e0283..c893c6786 100644 --- a/api/package.json +++ b/api/package.json @@ -13,12 +13,11 @@ "build-clean": "rimraf ./dist/*", "build-compile": "tsc", "build-watch": "tsc --watch", - "build-lint": "eslint src --ext .tsx,.ts", "format": "prettier --ignore-path=.prettierignore --write src && eslint --fix src", - "lint:check": "eslint src --ext .ts,.js", + "lint:check": "eslint src --ext .tsx,.ts,.js", "format:check": "prettier --ignore-path=.prettierignore src", "build-config": "copyfiles -u 2 ./src/data/config*.json ./dist/data/", - "build": "npm-run-all build-clean build-compile build-lint build-config", + "build": "npm-run-all build-clean build-compile build-config", "serve-mon": "nodemon ./dist/index", "start-dev": "NODE_ENV=development run-p serve-mon build-watch", "start": "node ./dist/index" diff --git a/client/.eslintrc.yaml b/client/.eslintrc.yaml index e045264e1..ea6f89b76 100644 --- a/client/.eslintrc.yaml +++ b/client/.eslintrc.yaml @@ -23,6 +23,7 @@ rules: { no-empty: off, "@typescript-eslint/no-inferrable-types": off, "@typescript-eslint/no-unused-vars": [2, { args: "none" }], - "@typescript-eslint/no-empty-function": off + "@typescript-eslint/no-empty-function": off, + "no-console": ["error", { allow: ["warn", "error"] }], } diff --git a/client/package.json b/client/package.json index 4f2d27a7f..dcd3fd566 100644 --- a/client/package.json +++ b/client/package.json @@ -14,11 +14,9 @@ "start": "vite", "preview": "vite preview", "format": "prettier --ignore-path=.prettierignore --write src && eslint src --ext .tsx,.ts --fix", - "lint:check": "eslint src --ext .tsx,.ts", + "lint:check": "eslint src --ext .tsx,.ts && stylelint ./src/**/*.scss", "format:check": "prettier --ignore-path=.prettierignore --check src", - "sass-lint": "stylelint ./src/**/*.scss", - "build-internal": "tsc && vite build", - "build": "run-s lint:check sass-lint build-internal", + "build": "tsc && vite build", "test": "vitest" }, "dependencies": { diff --git a/client/src/app/components/identity/DIDResolver.tsx b/client/src/app/components/identity/DIDResolver.tsx index 0fb8b168f..b170bd8f2 100644 --- a/client/src/app/components/identity/DIDResolver.tsx +++ b/client/src/app/components/identity/DIDResolver.tsx @@ -192,17 +192,17 @@ async function constructVerifiedDomains(resolvedDID: IDIDResolverResponse): Prom reject(err); } } catch (err) { - console.log(err); + console.error(err); reject(new Error(`Domain Linkage credential invalid domain ${domain}`)); } }) .catch((err) => { - console.log(err); + console.error(err); reject(new Error(`could not parse configuration from domain ${domain}`)); }); }) .catch((err) => { - console.log(err); + console.error(err); reject(new Error(`could not fetch configuration from ${domain}, this could be a CORS error`)); }); }), diff --git a/client/src/helpers/hooks/useAddressHistory.ts b/client/src/helpers/hooks/useAddressHistory.ts index 1821a6cbe..2b219fe46 100644 --- a/client/src/helpers/hooks/useAddressHistory.ts +++ b/client/src/helpers/hooks/useAddressHistory.ts @@ -83,7 +83,7 @@ export function useAddressHistory( } return null; } catch { - console.log("Failed loading transaction history details!"); + console.error("Failed loading transaction history details!"); return null; } }; diff --git a/client/src/helpers/hooks/useChartsState.ts b/client/src/helpers/hooks/useChartsState.ts index dd7c10973..75fdcfa8a 100644 --- a/client/src/helpers/hooks/useChartsState.ts +++ b/client/src/helpers/hooks/useChartsState.ts @@ -71,10 +71,10 @@ export function useChartsState(): [ setLedgerSize(graphsData.ledgerSizeDaily); setStorageDeposit(graphsData.storageDepositDaily); } else { - console.log("Fetching influx stats failed", influxStats.error); + console.error("Fetching influx stats failed", influxStats.error); } }) - .catch((e) => console.log("Influx analytics fetch failed", e)); + .catch((e) => console.error("Influx analytics fetch failed", e)); apiClient .chronicleAnalytics({ network }) @@ -82,10 +82,10 @@ export function useChartsState(): [ if (!analytics.error && analytics) { setAnalyticStats(analytics); } else { - console.log("Fetching chronicle stats failed", analytics.error); + console.error("Fetching chronicle stats failed", analytics.error); } }) - .catch((e) => console.log("Chronicle analytics fetch failed", e)); + .catch((e) => console.error("Chronicle analytics fetch failed", e)); }, [network]); return [ diff --git a/client/src/helpers/hooks/useChronicleAnalytics.ts b/client/src/helpers/hooks/useChronicleAnalytics.ts index 1c60f46ac..8ec069e81 100644 --- a/client/src/helpers/hooks/useChronicleAnalytics.ts +++ b/client/src/helpers/hooks/useChronicleAnalytics.ts @@ -64,7 +64,7 @@ export function useChronicleAnalytics(network: string): [IAnalyticStats | null] unclaimedShimmer: analyticStats?.unclaimedShimmer, }); } else { - console.log("Analytics stats refresh failed."); + console.error("Analytics stats refresh failed."); } } }; diff --git a/client/src/helpers/hooks/useOutputsDetails.ts b/client/src/helpers/hooks/useOutputsDetails.ts index 134bc5bae..b75551754 100644 --- a/client/src/helpers/hooks/useOutputsDetails.ts +++ b/client/src/helpers/hooks/useOutputsDetails.ts @@ -52,7 +52,7 @@ export function useOutputsDetails(network: string, outputIds: string[] | null): setError(response.error); } }) - .catch((e) => console.log(e)); + .catch((e) => console.error(e)); promises.push(promise); } diff --git a/client/src/helpers/hooks/useParticipationEventDetails.ts b/client/src/helpers/hooks/useParticipationEventDetails.ts index 1ae54a957..75ef4e083 100644 --- a/client/src/helpers/hooks/useParticipationEventDetails.ts +++ b/client/src/helpers/hooks/useParticipationEventDetails.ts @@ -51,7 +51,7 @@ export function useParticipationEventDetails(participations?: IParticipation[]): setError(response.error); } }) - .catch((e) => console.log(e)); + .catch((e) => console.error(e)); promises.push(promise); } diff --git a/client/src/helpers/hooks/useTokenDistributionState.ts b/client/src/helpers/hooks/useTokenDistributionState.ts index ade50ed3e..87aa8dede 100644 --- a/client/src/helpers/hooks/useTokenDistributionState.ts +++ b/client/src/helpers/hooks/useTokenDistributionState.ts @@ -23,10 +23,10 @@ export function useTokenDistributionState(): [IRichAddress[] | null, IDistributi if (!response.error && response.distribution) { setTokenDistribution(response.distribution); } else { - console.log(`Fetching token distribution failed (${network})`, response.error); + console.error(`Fetching token distribution failed (${network})`, response.error); } }) - .catch((e) => console.log(`Fetching token distribution failed (${network})`, e)); + .catch((e) => console.error(`Fetching token distribution failed (${network})`, e)); apiClient .richestAddresses({ network }) @@ -34,10 +34,10 @@ export function useTokenDistributionState(): [IRichAddress[] | null, IDistributi if (!response.error && response.top) { setRichestAddresses(response.top); } else { - console.log(`Fetching richest addresses failed (${network})`, response.error); + console.error(`Fetching richest addresses failed (${network})`, response.error); } }) - .catch((e) => console.log(`Fetching richest addresses failed (${network})`, e)); + .catch((e) => console.error(`Fetching richest addresses failed (${network})`, e)); }, [network]); return [richestAddresses, tokenDistribution]; diff --git a/client/src/services/stardust/stardustFeedClient.ts b/client/src/services/stardust/stardustFeedClient.ts index 039965fa5..672399d50 100644 --- a/client/src/services/stardust/stardustFeedClient.ts +++ b/client/src/services/stardust/stardustFeedClient.ts @@ -113,7 +113,7 @@ export class StardustFeedClient { this.socket.on("subscribe", (subscribeResponse: IFeedSubscribeResponse) => { if (subscribeResponse.error) { - console.log("Failed subscribing to feed", this._networkConfig?.network, subscribeResponse.error); + console.error("Failed subscribing to feed", this._networkConfig?.network, subscribeResponse.error); } else { this.blockSubscriptionId = subscribeResponse.subscriptionId; } @@ -151,7 +151,7 @@ export class StardustFeedClient { this.socket.emit("subscribe", subscribeRequest); } } catch (error) { - console.log("Failed subscribing to block feed", this._networkConfig?.network, error); + console.error("Failed subscribing to block feed", this._networkConfig?.network, error); } } @@ -180,7 +180,7 @@ export class StardustFeedClient { this.socket.on("subscribe", (subscribeResponse: IFeedSubscribeResponse) => { if (subscribeResponse.error) { - console.log("Failed subscribing to feed", this._networkConfig?.network, subscribeResponse.error); + console.error("Failed subscribing to feed", this._networkConfig?.network, subscribeResponse.error); } else { this.milestoneSubscriptionId = subscribeResponse.subscriptionId; } @@ -193,7 +193,7 @@ export class StardustFeedClient { }); } } catch (error) { - console.log("Failed subscribing to milestone feed", this._networkConfig?.network, error); + console.error("Failed subscribing to milestone feed", this._networkConfig?.network, error); } } diff --git a/client/src/services/stardust/tokenRegistryClient.ts b/client/src/services/stardust/tokenRegistryClient.ts index 658458bb8..de62956d0 100644 --- a/client/src/services/stardust/tokenRegistryClient.ts +++ b/client/src/services/stardust/tokenRegistryClient.ts @@ -33,7 +33,7 @@ export class TokenRegistryClient { try { response = await FetchHelper.json(endpoint, `${BASE_PATH}${network}${NFTS_PATH}${id}`, "get"); } catch (e) { - console.log("Failed to check token registry", e); + console.error("Failed to check token registry", e); } return response?.success ?? false; @@ -56,7 +56,7 @@ export class TokenRegistryClient { "get", ); } catch (e) { - console.log("Failed to check token registry", e); + console.error("Failed to check token registry", e); } return response?.success ?? false;