From 7a0ce80dfef0b2c2c0054ed2938e7d17d639c695 Mon Sep 17 00:00:00 2001 From: Brandon Tabaska Date: Wed, 28 Aug 2024 13:45:54 -0400 Subject: [PATCH] [Issue #2037]Add no console log to eslint rules (navapbc/simpler-grants-gov#182) Fixes #2037 > Added new rule to eslint to prevent leaving behind console log statements > normal expected rule in eslint configurations --- frontend/.eslintrc.js | 2 ++ frontend/src/app/api/BaseApi.ts | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/.eslintrc.js b/frontend/.eslintrc.js index 280ce11e3..30e0488f1 100644 --- a/frontend/.eslintrc.js +++ b/frontend/.eslintrc.js @@ -51,6 +51,8 @@ module.exports = { "@typescript-eslint/no-explicit-any": "error", // Just warn since playwright tests may not use screen the way jest would "testing-library/prefer-screen-queries": "warn", + // Prevent unnecessary console statements + "no-console": ["error", { allow: ["warn", "error"] }], }, }, ], diff --git a/frontend/src/app/api/BaseApi.ts b/frontend/src/app/api/BaseApi.ts index 89ffc39f4..bca7b683c 100644 --- a/frontend/src/app/api/BaseApi.ts +++ b/frontend/src/app/api/BaseApi.ts @@ -219,7 +219,7 @@ const throwError = ( searchInputs?: QueryParamData, firstError?: APIResponseError, ) => { - console.log("Throwing error: ", message, status_code, searchInputs); + console.error("Throwing error: ", message, status_code, searchInputs); // Include just firstError for now, we can expand this // If we need ValidationErrors to be more expanded