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

This commit is contained in:
Lucas Bordeau 2023-07-26 02:18:25 +02:00 committed by GitHub
parent c0700c9b20
commit b52745533a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 89 additions and 27 deletions

View File

@ -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": "^_" }
]
}
};

View File

@ -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",

View File

@ -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>;

View File

@ -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>

View File

@ -24,7 +24,7 @@ export function useApolloFactory() {
fields: {
commentThreadTargets: {
merge(
existing: CommentThreadTarget[] = [],
_existing: CommentThreadTarget[] = [],
incoming: CommentThreadTarget[],
) {
return [...incoming];

View File

@ -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) {

View File

@ -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':

View File

@ -117,7 +117,6 @@ const StyledIconButton = styled.button<
export function IconButton({
icon,
title,
variant = 'transparent',
size = 'medium',
textColor = 'tertiary',

View File

@ -140,7 +140,7 @@ export function EditableField({
transition={{ duration: 0.1 }}
whileHover={{ scale: 1.04 }}
>
<EditableFieldEditButton customHotkeyScope={customEditHotkeyScope} />
<EditableFieldEditButton />
</motion.div>
)}
</EditableFieldBaseContainer>

View File

@ -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() {

View File

@ -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`

View File

@ -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) {

View File

@ -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();
}

View File

@ -36,7 +36,6 @@ export function EditableCellDoubleTextEditMode({
secondValue,
firstValuePlaceholder,
secondValuePlaceholder,
onChange,
onSubmit,
onCancel,
}: OwnProps) {

View File

@ -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 (

View File

@ -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}

View File

@ -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==
eslint-scope@5.1.1, eslint-scope@^5.1.1:
version "5.1.1"
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c"