Skip to content

Commit

Permalink
fix: re-introduce no-console rule for debug statements but allow cons…
Browse files Browse the repository at this point in the history
…ole.error in ESLint
  • Loading branch information
ThomasGross committed Jan 10, 2025
1 parent b9eb719 commit ce6bf90
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export default [
},

rules: {
"no-console": ["error", { allow: ["error"] }],
"prefer-arrow-callback": [
"error",
{
Expand Down
1 change: 1 addition & 0 deletions src/apps/material-grid/MaterialGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ const MaterialGrid: React.FC<MaterialGridProps> = ({
}

if (!materials.length) {
// eslint-disable-next-line no-console
console.warn(`No materials to show for MaterialGrid: ${title}`);
return null;
}
Expand Down
2 changes: 2 additions & 0 deletions src/apps/material-search/useGetHiddenInputs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const useGetHiddenInputs = (uniqueIdentifier: string): HiddenInputsResult => {
) as HTMLInputElement | null;

if (!workElement) {
// eslint-disable-next-line no-console
console.debug(
`Could not find input for work ID with unique identifier: ${uniqueIdentifier}`
);
Expand All @@ -33,6 +34,7 @@ const useGetHiddenInputs = (uniqueIdentifier: string): HiddenInputsResult => {
}

if (!materialElement) {
// eslint-disable-next-line no-console
console.debug(
`Could not find input for material type with unique identifier: ${uniqueIdentifier}`
);
Expand Down
1 change: 1 addition & 0 deletions src/apps/material-search/useUpdateFields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const useUpdateFields = ({
}

// Leaving a debug message hif the input element is not found.
// eslint-disable-next-line no-console
console.debug(
`Could not find input element to update with ID: ${uniqueIdentifier}`
);
Expand Down
1 change: 1 addition & 0 deletions src/apps/opening-hours-editor/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ export const getInitialDateFromUrl = (): Date | null => {
return date;
}

// eslint-disable-next-line no-console
console.debug(
"Invalid date format in URL parameter: initialDate =",
initialDateString
Expand Down
4 changes: 4 additions & 0 deletions src/components/guarded-app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const GuardedApp = ({ app, children }: GuardedAppProps) => {
const didAuthenticate = getUrlQueryParam(AUTH_PARAM);

// We'll leave this debugging here temporarily also in the testing phase for troubleshooting.
// eslint-disable-next-line no-console
console.debug("PERSISTED REQUEST:", persistedRequest);

useEffect(() => {
Expand All @@ -39,8 +40,11 @@ const GuardedApp = ({ app, children }: GuardedAppProps) => {
}

// We'll leave this debugging here temporarily also in the testing phase for troubleshooting.
// eslint-disable-next-line no-console
console.debug("HAS REQUEST EXPIRED?", hasRequestExpired(persistedRequest));
// eslint-disable-next-line no-console
console.debug("CURRENT TIMESTAMP", getCurrentUnixTime());
// eslint-disable-next-line no-console
console.debug("EXPIRE TIMESTAMP", persistedRequest.expire);

// If request has expired remove it.
Expand Down
2 changes: 2 additions & 0 deletions src/core/guardedRequests.slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export const guardedRequest = createAsyncThunk(
}

// We'll leave this debugging here temporarily also in the testing phase for troubleshooting.
// eslint-disable-next-line no-console
console.debug("PERFORMING REQUEST CALLBACK");
// The user is authorized to perform callback. Let's do it!
const requestCallback = getRequestCallback(type);
Expand All @@ -125,6 +126,7 @@ export const reRunRequest = createAsyncThunk(
if (requestCallbackExists(type)) {
const requestCallback = getRequestCallback(type);
// We'll leave this debugging here temporarily also in the testing phase for troubleshooting.
// eslint-disable-next-line no-console
console.debug("RERUNNING REQUEST");
return requestCallback(args);
}
Expand Down
1 change: 1 addition & 0 deletions src/core/statistics/useStatistics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export function useStatistics() {
if (!window.wts) {
window.wts = {
push(trackingProps: [EventAction, EventType, EventData]) {
// eslint-disable-next-line no-console
console.log(
`Tracking: ${trackingProps[0]}, ${trackingProps[1]}, ${JSON.stringify(
trackingProps[2]
Expand Down

0 comments on commit ce6bf90

Please sign in to comment.