Add no-console eslint rule (#1890)

* Add no-console eslint rule

* Remove unused test
This commit is contained in:
Charles Bochet
2023-10-05 21:16:02 +02:00
committed by GitHub
parent 922f8eca0e
commit 07450df1a1
24 changed files with 69 additions and 212 deletions

View File

@ -17,6 +17,7 @@ import { usePreviousHotkeyScope } from '@/ui/utilities/hotkey/hooks/usePreviousH
import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
import { useListenClickOutside } from '@/ui/utilities/pointer-event/hooks/useListenClickOutside';
import { useRecoilScopedState } from '@/ui/utilities/recoil-scope/hooks/useRecoilScopedState';
import { logError } from '~/utils/logError';
import { BoardColumnContext } from '../contexts/BoardColumnContext';
import { useBoardColumns } from '../hooks/useBoardColumns';
@ -65,9 +66,7 @@ export const BoardColumnMenu = ({
},
);
console.error(
'There was a problem with the company selection, please retry.',
);
logError('There was a problem with the company selection, please retry.');
return;
}

View File

@ -19,6 +19,7 @@ import {
PipelineStage,
useUpdateOnePipelineProgressStageMutation,
} from '~/generated/graphql';
import { logError } from '~/utils/logError';
import { useCurrentCardSelected } from '../hooks/useCurrentCardSelected';
import { useSetCardSelected } from '../hooks/useSetCardSelected';
@ -126,7 +127,7 @@ export const EntityBoard = ({
);
}
} catch (e) {
console.error(e);
logError(e);
}
},
[boardColumns, updatePipelineProgressStageInDB, updateBoardCardIds],

View File

@ -3,6 +3,7 @@ import { PersonChip } from '@/people/components/PersonChip';
import { Entity } from '@/ui/input/relation-picker/types/EntityTypeForSelect';
import { UserChip } from '@/users/components/UserChip';
import { getLogoUrlFromDomainName } from '~/utils';
import { logError } from '~/utils/logError';
import { useRelationField } from '../../hooks/useRelationField';
@ -42,7 +43,7 @@ export const RelationFieldDisplay = () => {
);
}
default:
console.warn(
logError(
`Unknown relation type: "${fieldDefinition.metadata.relationType}"
in RelationFieldDisplay`,
);

View File

@ -2,6 +2,7 @@ import { CompanyChip } from '@/companies/components/CompanyChip';
import { PersonChip } from '@/people/components/PersonChip';
import { Entity } from '@/ui/input/relation-picker/types/EntityTypeForSelect';
import { getLogoUrlFromDomainName } from '~/utils';
import { logError } from '~/utils/logError';
type OwnProps = {
entityType: Entity;
@ -36,7 +37,7 @@ export const ChipDisplay = ({
);
}
default:
console.warn(
logError(
`Unknown relation type: "${entityType}" in DoubleTextChipDisplay`,
);
return <> </>;

View File

@ -1,6 +1,8 @@
import { Profiler } from 'react';
import { Interaction } from 'scheduler/tracing';
import { logDebug } from '~/utils/logDebug';
type OwnProps = {
id: string;
children: React.ReactNode;
@ -16,7 +18,7 @@ export const TimingProfiler = ({ id, children }: OwnProps) => {
commitTime: number,
interactions: Set<Interaction>,
) => {
console.debug(
logDebug(
'TimingProfiler',
JSON.stringify(
{

View File

@ -1,6 +1,8 @@
import { Hotkey } from 'react-hotkeys-hook/dist/types';
import { useRecoilCallback } from 'recoil';
import { logDebug } from '~/utils/logDebug';
import { internalHotkeysEnabledScopesState } from '../states/internal/internalHotkeysEnabledScopesState';
const DEBUG_HOTKEY_SCOPE = true;
@ -27,7 +29,7 @@ export const useScopedHotkeyCallback = () =>
if (!currentHotkeyScopes.includes(scope)) {
if (DEBUG_HOTKEY_SCOPE) {
console.debug(
logDebug(
`%cI can't call hotkey (${
hotkeysEvent.keys
}) because I'm in scope [${scope}] and the active scopes are : [${currentHotkeyScopes.join(
@ -41,7 +43,7 @@ export const useScopedHotkeyCallback = () =>
}
if (DEBUG_HOTKEY_SCOPE) {
console.debug(
logDebug(
`%cI can call hotkey (${
hotkeysEvent.keys
}) because I'm in scope [${scope}] and the active scopes are : [${currentHotkeyScopes.join(