Skip to content

The open alternative to Salesforce, designed for AI.

Added unused imports and vars and fixed lint (#929)

Lucas Bordeaub52745533ac4
diff --git a/front/.eslintrc.js b/front/.eslintrc.js
index c7808837211..d47a49995db 100644
--- a/front/.eslintrc.js
+++ b/front/.eslintrc.js
@@ -5,7 +5,7 @@ module.exports = {
tsconfigRootDir: __dirname,
sourceType: 'module',
},
- plugins: ['@typescript-eslint/eslint-plugin', 'simple-import-sort', 'twenty'],
+ plugins: ['@typescript-eslint/eslint-plugin', 'simple-import-sort', 'twenty', 'unused-imports'],
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
@@ -48,5 +48,12 @@ module.exports = {
'twenty/sort-css-properties-alphabetically': 'error',
'twenty/no-hardcoded-colors': 'error',
'func-style':['error', 'declaration', { 'allowArrowFunctions': true }],
+ "no-unused-vars": "off",
+ "@typescript-eslint/no-unused-vars": "off",
+ "unused-imports/no-unused-imports": "warn",
+ "unused-imports/no-unused-vars": [
+ "warn",
+ { "vars": "all", "varsIgnorePattern": "^_", "args": "after-used", "argsIgnorePattern": "^_" }
+ ]
}
};
diff --git a/front/package.json b/front/package.json
index 891ab1062a3..9f2d671f7ee 100644
--- a/front/package.json
+++ b/front/package.json
@@ -51,7 +51,7 @@
"yup": "^1.2.0"
},
"scripts": {
- "start": "PORT=3001 craco start",
+ "start": "PORT=3001 craco start --max-warnings=0",
"build": "craco build",
"test": "craco test",
"coverage": "craco test --coverage .",
@@ -148,6 +148,7 @@
"eslint-plugin-simple-import-sort": "^10.0.0",
"eslint-plugin-storybook": "^0.6.12",
"eslint-plugin-twenty": "file:../packages/eslint-plugin-twenty",
+ "eslint-plugin-unused-imports": "^3.0.0",
"http-server": "^14.1.1",
"mock-apollo-client": "^1.2.1",
"msw": "1.2.1",
diff --git a/front/src/generated/graphql.tsx b/front/src/generated/graphql.tsx
index 27fdfe1024c..85062f255ae 100644
--- a/front/src/generated/graphql.tsx
+++ b/front/src/generated/graphql.tsx
@@ -46,6 +46,7 @@ export type Attachment = {
name: Scalars['String'];
type: AttachmentType;
updatedAt: Scalars['DateTime'];
+ workspace: Workspace;
};
export type AttachmentCreateNestedManyWithoutActivityInput = {
@@ -84,6 +85,12 @@ export type AttachmentUpdateManyWithoutAuthorNestedInput = {
set?: InputMaybe<Array<AttachmentWhereUniqueInput>>;
};
+export type AttachmentUpdateManyWithoutWorkspaceNestedInput = {
+ connect?: InputMaybe<Array<AttachmentWhereUniqueInput>>;
+ disconnect?: InputMaybe<Array<AttachmentWhereUniqueInput>>;
+ set?: InputMaybe<Array<AttachmentWhereUniqueInput>>;
+};
+
export type AttachmentWhereInput = {
AND?: InputMaybe<Array<AttachmentWhereInput>>;
NOT?: InputMaybe<Array<AttachmentWhereInput>>;
@@ -219,6 +226,10 @@ export type CommentThreadCreateInput = {
updatedAt?: InputMaybe<Scalars['DateTime']>;
};
+export type CommentThreadCreateNestedOneWithoutCommentThreadTargetsInput = {
+ connect?: InputMaybe<CommentThreadWhereUniqueInput>;
+};
+
export type CommentThreadCreateNestedOneWithoutCommentsInput = {
connect?: InputMaybe<CommentThreadWhereUniqueInput>;
};
@@ -282,6 +293,7 @@ export type CommentThreadTarget = {
createdAt: Scalars['DateTime'];
id: Scalars['ID'];
updatedAt: Scalars['DateTime'];
+ workspace: Workspace;
};
export type CommentThreadTargetCreateManyCommentThreadInput = {
@@ -297,6 +309,20 @@ export type CommentThreadTargetCreateManyCommentThreadInputEnvelope = {
skipDuplicates?: InputMaybe<Scalars['Boolean']>;
};
+export type CommentThreadTargetCreateManyWorkspaceInput = {
+ commentThreadId: Scalars['String'];
+ commentableId: Scalars['String'];
+ commentableType: CommentableType;
+ createdAt?: InputMaybe<Scalars['DateTime']>;
+ id?: InputMaybe<Scalars['String']>;
+ updatedAt?: InputMaybe<Scalars['DateTime']>;
+};
+
+export type CommentThreadTargetCreateManyWorkspaceInputEnvelope = {
+ data: Array<CommentThreadTargetCreateManyWorkspaceInput>;
+ skipDuplicates?: InputMaybe<Scalars['Boolean']>;
+};
+
export type CommentThreadTargetCreateNestedManyWithoutCommentThreadInput = {
connect?: InputMaybe<Array<CommentThreadTargetWhereUniqueInput>>;
connectOrCreate?: InputMaybe<Array<CommentThreadTargetCreateOrConnectWithoutCommentThreadInput>>;
@@ -309,6 +335,11 @@ export type CommentThreadTargetCreateOrConnectWithoutCommentThreadInput = {
where: CommentThreadTargetWhereUniqueInput;
};
+export type CommentThreadTargetCreateOrConnectWithoutWorkspaceInput = {
+ create: CommentThreadTargetCreateWithoutWorkspaceInput;
+ where: CommentThreadTargetWhereUniqueInput;
+};
+
export type CommentThreadTargetCreateWithoutCommentThreadInput = {
commentableId: Scalars['String'];
commentableType: CommentableType;
@@ -317,6 +348,15 @@ export type CommentThreadTargetCreateWithoutCommentThreadInput = {
updatedAt?: InputMaybe<Scalars['DateTime']>;
};
+export type CommentThreadTargetCreateWithoutWorkspaceInput = {
+ commentThread: CommentThreadCreateNestedOneWithoutCommentThreadTargetsInput;
+ commentableId: Scalars['String'];
+ commentableType: CommentableType;
+ createdAt?: InputMaybe<Scalars['DateTime']>;
+ id?: InputMaybe<Scalars['String']>;
+ updatedAt?: InputMaybe<Scalars['DateTime']>;
+};
+
export type CommentThreadTargetListRelationFilter = {
every?: InputMaybe<CommentThreadTargetWhereInput>;
none?: InputMaybe<CommentThreadTargetWhereInput>;
@@ -350,6 +390,17 @@ export type CommentThreadTargetUpdateManyWithoutCommentThreadNestedInput = {
set?: InputMaybe<Array<CommentThreadTargetWhereUniqueInput>>;
};
+export type CommentThreadTargetUpdateManyWithoutWorkspaceNestedInput = {
+ connect?: InputMaybe<Array<CommentThreadTargetWhereUniqueInput>>;
+ connectOrCreate?: InputMaybe<Array<CommentThreadTargetCreateOrConnectWithoutWorkspaceInput>>;
+ create?: InputMaybe<Array<CommentThreadTargetCreateWithoutWorkspaceInput>>;
+ createMany?: InputMaybe<CommentThreadTargetCreateManyWorkspaceInputEnvelope>;
+ delete?: InputMaybe<Array<CommentThreadTargetWhereUniqueInput>>;
+ deleteMany?: InputMaybe<Array<CommentThreadTargetScalarWhereInput>>;
+ disconnect?: InputMaybe<Array<CommentThreadTargetWhereUniqueInput>>;
+ set?: InputMaybe<Array<CommentThreadTargetWhereUniqueInput>>;
+};
+
export type CommentThreadTargetWhereInput = {
AND?: InputMaybe<Array<CommentThreadTargetWhereInput>>;
NOT?: InputMaybe<Array<CommentThreadTargetWhereInput>>;
@@ -1818,6 +1869,8 @@ export type Verify = {
export type Workspace = {
__typename?: 'Workspace';
+ Attachment?: Maybe<Array<Attachment>>;
+ CommentThreadTarget?: Maybe<Array<CommentThreadTarget>>;
commentThreads?: Maybe<Array<CommentThread>>;
comments?: Maybe<Array<Comment>>;
companies?: Maybe<Array<Company>>;
@@ -1890,6 +1943,8 @@ export type WorkspaceMemberWhereUniqueInput = {
};
export type WorkspaceUpdateInput = {
+ Attachment?: InputMaybe<AttachmentUpdateManyWithoutWorkspaceNestedInput>;
+ CommentThreadTarget?: InputMaybe<CommentThreadTargetUpdateManyWithoutWorkspaceNestedInput>;
commentThreads?: InputMaybe<CommentThreadUpdateManyWithoutWorkspaceNestedInput>;
comments?: InputMaybe<CommentUpdateManyWithoutWorkspaceNestedInput>;
companies?: InputMaybe<CompanyUpdateManyWithoutWorkspaceNestedInput>;
diff --git a/front/src/modules/activities/components/CommentThreadComments.tsx b/front/src/modules/activities/components/CommentThreadComments.tsx
index fdc40f912da..363391b4516 100644
--- a/front/src/modules/activities/components/CommentThreadComments.tsx
+++ b/front/src/modules/activities/components/CommentThreadComments.tsx
@@ -83,7 +83,7 @@ export function CommentThreadComments({ commentThread }: OwnProps) {
<>
<StyledThreadItemListContainer>
<StyledThreadCommentTitle>Comments</StyledThreadCommentTitle>
- {commentThread?.comments?.map((comment, index) => (
+ {commentThread?.comments?.map((comment) => (
<Comment key={comment.id} comment={comment} />
))}
</StyledThreadItemListContainer>
diff --git a/front/src/modules/apollo/hooks/useApolloFactory.ts b/front/src/modules/apollo/hooks/useApolloFactory.ts
index 5c4eeef53ba..54367b29881 100644
--- a/front/src/modules/apollo/hooks/useApolloFactory.ts
+++ b/front/src/modules/apollo/hooks/useApolloFactory.ts
@@ -24,7 +24,7 @@ export function useApolloFactory() {
fields: {
commentThreadTargets: {
merge(
- existing: CommentThreadTarget[] = [],
+ _existing: CommentThreadTarget[] = [],
incoming: CommentThreadTarget[],
) {
return [...incoming];
diff --git a/front/src/modules/people/components/EditablePeopleFullName.tsx b/front/src/modules/people/components/EditablePeopleFullName.tsx
index 7a8b63bc457..7d8c0891a80 100644
--- a/front/src/modules/people/components/EditablePeopleFullName.tsx
+++ b/front/src/modules/people/components/EditablePeopleFullName.tsx
@@ -19,7 +19,6 @@ type OwnProps = {
>
| null
| undefined;
- onChange?: (firstName: string, lastName: string) => void;
onSubmit?: (firstName: string, lastName: string) => void;
onCancel?: () => void;
};
@@ -33,7 +32,6 @@ const NoEditModeContainer = styled.div`
export function EditablePeopleFullName({
person,
- onChange,
onSubmit,
onCancel,
}: OwnProps) {
diff --git a/front/src/modules/ui/button/components/Button.tsx b/front/src/modules/ui/button/components/Button.tsx
index ad90df3bf56..ebd751a9630 100644
--- a/front/src/modules/ui/button/components/Button.tsx
+++ b/front/src/modules/ui/button/components/Button.tsx
@@ -76,7 +76,7 @@ const StyledButton = styled.button<
}
}};
border-style: solid;
- border-width: ${({ theme, variant, position }) => {
+ border-width: ${({ variant, position }) => {
switch (variant) {
case 'primary':
case 'secondary':
diff --git a/front/src/modules/ui/button/components/IconButton.tsx b/front/src/modules/ui/button/components/IconButton.tsx
index fa1b5d3a87d..2a3a67b8779 100644
--- a/front/src/modules/ui/button/components/IconButton.tsx
+++ b/front/src/modules/ui/button/components/IconButton.tsx
@@ -117,7 +117,6 @@ const StyledIconButton = styled.button<
export function IconButton({
icon,
- title,
variant = 'transparent',
size = 'medium',
textColor = 'tertiary',
diff --git a/front/src/modules/ui/editable-field/components/EditableField.tsx b/front/src/modules/ui/editable-field/components/EditableField.tsx
index ae5a3334763..f05eab573fc 100644
--- a/front/src/modules/ui/editable-field/components/EditableField.tsx
+++ b/front/src/modules/ui/editable-field/components/EditableField.tsx
@@ -140,7 +140,7 @@ export function EditableField({
transition={{ duration: 0.1 }}
whileHover={{ scale: 1.04 }}
>
- <EditableFieldEditButton customHotkeyScope={customEditHotkeyScope} />
+ <EditableFieldEditButton />
</motion.div>
)}
</EditableFieldBaseContainer>
diff --git a/front/src/modules/ui/editable-field/components/EditableFieldEditButton.tsx b/front/src/modules/ui/editable-field/components/EditableFieldEditButton.tsx
index 067a88d47fc..4ab49aa613f 100644
--- a/front/src/modules/ui/editable-field/components/EditableFieldEditButton.tsx
+++ b/front/src/modules/ui/editable-field/components/EditableFieldEditButton.tsx
@@ -1,7 +1,6 @@
import styled from '@emotion/styled';
import { IconButton } from '@/ui/button/components/IconButton';
-import { HotkeyScope } from '@/ui/hotkey/types/HotkeyScope';
import { IconPencil } from '@/ui/icon';
import { overlayBackground } from '@/ui/themes/effects';
@@ -26,11 +25,7 @@ export const StyledEditableFieldEditButton = styled.div`
${overlayBackground}
`;
-type OwnProps = {
- customHotkeyScope?: HotkeyScope;
-};
-
-export function EditableFieldEditButton({ customHotkeyScope }: OwnProps) {
+export function EditableFieldEditButton() {
const { openEditableField } = useEditableField();
function handleClick() {
diff --git a/front/src/modules/ui/input/components/TextInput.tsx b/front/src/modules/ui/input/components/TextInput.tsx
index b4ff6bffa09..83445628d95 100644
--- a/front/src/modules/ui/input/components/TextInput.tsx
+++ b/front/src/modules/ui/input/components/TextInput.tsx
@@ -27,7 +27,7 @@ type OwnProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'onChange'> & {
const StyledContainer = styled.div<Pick<OwnProps, 'fullWidth'>>`
display: flex;
flex-direction: column;
- width: ${({ fullWidth, theme }) => (fullWidth ? `100%` : 'auto')};
+ width: ${({ fullWidth }) => (fullWidth ? `100%` : 'auto')};
`;
const StyledLabel = styled.span`
diff --git a/front/src/modules/ui/snack-bar/states/snackBarState.ts b/front/src/modules/ui/snack-bar/states/snackBarState.ts
index 159edfdbeba..dad665f4c70 100644
--- a/front/src/modules/ui/snack-bar/states/snackBarState.ts
+++ b/front/src/modules/ui/snack-bar/states/snackBarState.ts
@@ -19,9 +19,10 @@ export const snackBarInternalState = atom<SnackBarState>({
},
});
+// TODO: use a recoil callback
export const snackBarSetQueueState = selector<SnackBarOptions | null>({
key: 'snackBarQueueState',
- get: ({ get }) => null, // We don't care about getting the value
+ get: ({ get: _get }) => null, // We don't care about getting the value
set: ({ set }, newValue) =>
set(snackBarInternalState, (prev) => {
if (prev.queue.length >= prev.maxQueue) {
diff --git a/front/src/modules/ui/table/components/SelectAllCheckbox.tsx b/front/src/modules/ui/table/components/SelectAllCheckbox.tsx
index acf88420ad6..74e91e168dc 100644
--- a/front/src/modules/ui/table/components/SelectAllCheckbox.tsx
+++ b/front/src/modules/ui/table/components/SelectAllCheckbox.tsx
@@ -1,4 +1,3 @@
-import React from 'react';
import styled from '@emotion/styled';
import { Checkbox } from '@/ui/input/components/Checkbox';
@@ -19,7 +18,8 @@ export const SelectAllCheckbox = () => {
const checked = allRowsSelectedStatus === 'all';
const indeterminate = allRowsSelectedStatus === 'some';
- function onChange(value: boolean) {
+
+ function onChange() {
selectAllRows();
}
diff --git a/front/src/modules/ui/table/editable-cell/types/EditableCellDoubleTextEditMode.tsx b/front/src/modules/ui/table/editable-cell/types/EditableCellDoubleTextEditMode.tsx
index ba59bf86bd7..57dc33d11b9 100644
--- a/front/src/modules/ui/table/editable-cell/types/EditableCellDoubleTextEditMode.tsx
+++ b/front/src/modules/ui/table/editable-cell/types/EditableCellDoubleTextEditMode.tsx
@@ -36,7 +36,6 @@ export function EditableCellDoubleTextEditMode({
secondValue,
firstValuePlaceholder,
secondValuePlaceholder,
- onChange,
onSubmit,
onCancel,
}: OwnProps) {
diff --git a/front/src/modules/ui/table/editable-cell/types/EditableCellText.tsx b/front/src/modules/ui/table/editable-cell/types/EditableCellText.tsx
index d20f20137df..505df1e0359 100644
--- a/front/src/modules/ui/table/editable-cell/types/EditableCellText.tsx
+++ b/front/src/modules/ui/table/editable-cell/types/EditableCellText.tsx
@@ -7,20 +7,16 @@ import { EditableCell } from '../components/EditableCell';
type OwnProps = {
placeholder?: string;
value: string;
- onChange?: (newValue: string) => void;
editModeHorizontalAlign?: 'left' | 'right';
loading?: boolean;
onSubmit?: (newText: string) => void;
- onCancel?: () => void;
};
export function EditableCellText({
value,
placeholder,
- onChange,
editModeHorizontalAlign,
loading,
- onCancel,
onSubmit,
}: OwnProps) {
return (
diff --git a/front/src/modules/users/components/UserChip.tsx b/front/src/modules/users/components/UserChip.tsx
index 6113619d041..e4fc47c43f7 100644
--- a/front/src/modules/users/components/UserChip.tsx
+++ b/front/src/modules/users/components/UserChip.tsx
@@ -1,13 +1,12 @@
-import { EntityChip, EntityChipVariant } from '@/ui/chip/components/EntityChip';
+import { EntityChip } from '@/ui/chip/components/EntityChip';
export type UserChipPropsType = {
id: string;
name: string;
pictureUrl?: string;
- variant?: EntityChipVariant;
};
-export function UserChip({ id, name, pictureUrl, variant }: UserChipPropsType) {
+export function UserChip({ id, name, pictureUrl }: UserChipPropsType) {
return (
<EntityChip
entityId={id}
diff --git a/front/yarn.lock b/front/yarn.lock
index 2158f9df966..db99477e351 100644
--- a/front/yarn.lock
+++ b/front/yarn.lock
@@ -9493,6 +9493,18 @@ eslint-plugin-testing-library@^5.0.1:
dependencies:
postcss "^8.4.24"
+eslint-plugin-unused-imports@^3.0.0:
+ version "3.0.0"
+ resolved "https://registry.yarnpkg.com/eslint-plugin-unused-imports/-/eslint-plugin-unused-imports-3.0.0.tgz#d25175b0072ff16a91892c3aa72a09ca3a9e69e7"
+ integrity sha512-sduiswLJfZHeeBJ+MQaG+xYzSWdRXoSw61DpU13mzWumCkR0ufD0HmO4kdNokjrkluMHpj/7PJeN35pgbhW3kw==
+ dependencies:
+ eslint-rule-composer "^0.3.0"
+
+eslint-rule-composer@^0.3.0:
+ version "0.3.0"
+ resolved "https://registry.yarnpkg.com/eslint-rule-composer/-/eslint-rule-composer-0.3.0.tgz#79320c927b0c5c0d3d3d2b76c8b4a488f25bbaf9"
+ integrity sha512-bt+Sh8CtDmn2OajxvNO+BX7Wn4CIWMpTRm3MaiKPCQcnnlm0CS2mhui6QaoeQugs+3Kj2ESKEEGJUdVafwhiCg==
+
[email protected], eslint-scope@^5.1.1:
version "5.1.1"
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c"