Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce props on a new line for multiline components #1807

Merged
merged 5 commits into from
Dec 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,8 @@
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
"react/prop-types": 0,
"react/jsx-max-props-per-line": [2, {
"maximum": 1,
"when": "always"
}],
"react/jsx-max-props-per-line": ["error", { "maximum": 1, "when": "always" }],
"react/jsx-first-prop-new-line": ["error", "multiline-multiprop"],
"react/jsx-fragments": "error",
"arrow-spacing": "error",
"space-infix-ops": "error",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"eslint": "^6.8.0",
"eslint-plugin-cypress": "^2.11.3",
"eslint-plugin-no-only-tests": "^2.6.0",
"eslint-plugin-react": "^7.22.0",
"eslint-plugin-react": "^7.27.1",
"eslint-plugin-react-hooks": "^4.2.0",
"eslint-plugin-ternary": "^1.0.4",
"npm-run-all": "^4.1.5",
Expand Down
3 changes: 2 additions & 1 deletion packages/common-components/src/Toasts/ToastContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ const ToastContent = ({ toast, onClose }: ToastContentProps) => {
/>
{onProgressCancel &&
onProgressCancelLoading
? <Loading size={16}
? <Loading
size={16}
className={classes.progressCrossButton} />
: <CloseCirceSvg
className={classes.progressCrossButton}
Expand Down
3 changes: 2 additions & 1 deletion packages/common-components/src/stories/Tabs.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ export const TabsDemo = (): React.ReactNode => {
activeKey={tab}
onTabSelect={setTab}
>
<TabPane title="tab 1"
<TabPane
title="tab 1"
tabKey="1"
>
first
Expand Down
9 changes: 5 additions & 4 deletions packages/common-components/src/stories/Toasts.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,11 @@ const ToastNotificationDemo: React.FC<{toast: ToastParams}> = ({ toast }) => {
<br />
{toasts.map((toast) => (
toast.progress && toast.progress < 80 ? (
<button onClick={() => updateToast(toast.id, {
...toast,
progress: toast.progress !== undefined ? toast.progress + 20 : undefined
})}>
<button
onClick={() => updateToast(toast.id, {
...toast,
progress: toast.progress !== undefined ? toast.progress + 20 : undefined
})}>
increase progress toast
</button>
) : null
Expand Down
3 changes: 2 additions & 1 deletion packages/files-ui/src/Components/Elements/TeamModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ const TeamModal = ({ onHide }: Props) => {
mobileStickyBottom={false}
>
<div className={classes.root}>
<Typography variant="h2"
<Typography
variant="h2"
className={classes.title}
>
<Trans>Teams</Trans>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,23 +123,24 @@ const BinFileBrowser: React.FC<IFileBrowserModuleProps> = ({ controls = false }:
}), [])

return (
<FileBrowserContext.Provider value={{
bucket,
crumbs: undefined,
deleteItems,
recoverItems,
currentPath,
moduleRootPath: ROUTE_LINKS.Bin("/"),
refreshContents,
loadingCurrentPath,
showUploadsInTable: false,
sourceFiles: pathContents,
heading: t`Bin`,
controls,
itemOperations,
bulkOperations,
viewFolder
}}>
<FileBrowserContext.Provider
value={{
bucket,
crumbs: undefined,
deleteItems,
recoverItems,
currentPath,
moduleRootPath: ROUTE_LINKS.Bin("/"),
refreshContents,
loadingCurrentPath,
showUploadsInTable: false,
sourceFiles: pathContents,
heading: t`Bin`,
controls,
itemOperations,
bulkOperations,
viewFolder
}}>
<DragAndDrop>
<FilesList />
</DragAndDrop>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,28 +185,29 @@ const CSFFileBrowser: React.FC<IFileBrowserModuleProps> = () => {
}), [])

return (
<FileBrowserContext.Provider value={{
bucket,
bulkOperations,
crumbs,
moduleRootPath: ROUTE_LINKS.Drive("/"),
currentPath,
refreshContents,
deleteItems: moveItemsToBin,
downloadFile: handleDownload,
moveItems,
renameItem: renameItem,
viewFolder,
handleUploadOnDrop,
loadingCurrentPath,
showUploadsInTable: true,
sourceFiles: pathContents,
heading: t`My Files`,
controls: true,
allowDropUpload: true,
itemOperations,
withSurvey: showSurvey && olderThanOneWeek
}}>
<FileBrowserContext.Provider
value={{
bucket,
bulkOperations,
crumbs,
moduleRootPath: ROUTE_LINKS.Drive("/"),
currentPath,
refreshContents,
deleteItems: moveItemsToBin,
downloadFile: handleDownload,
moveItems,
renameItem: renameItem,
viewFolder,
handleUploadOnDrop,
loadingCurrentPath,
showUploadsInTable: true,
sourceFiles: pathContents,
heading: t`My Files`,
controls: true,
allowDropUpload: true,
itemOperations,
withSurvey: showSurvey && olderThanOneWeek
}}>
<DragAndDrop>
<FilesList />
</DragAndDrop>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,8 @@ const FileInfoModal = ({ filePath, close }: IFileInfoModuleProps) => {
<Trans>CID (Content Identifier)</Trans>
</Typography>
</Grid>
<div onClick={onCopyCID}
<div
onClick={onCopyCID}
className={classes.copyRow}
>
<Typography
Expand Down Expand Up @@ -402,7 +403,8 @@ const FileInfoModal = ({ filePath, close }: IFileInfoModuleProps) => {
<Trans>Decryption key</Trans>
</Typography>
</Grid>
<div onClick={onCopyKey}
<div
onClick={onCopyKey}
className={classes.copyRow}
>
<Typography
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ const MoveFileModule = ({ filesToMove, onClose, onCancel, mode }: IMoveFileModul
sm={12}
className={classes.paddedContainer}
>
<Typography className={classes.heading}
<Typography
className={classes.heading}
variant="h5"
component="h5"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,20 +102,21 @@ const SearchFileBrowser: React.FC<IFileBrowserModuleProps> = ({ controls = false
}), [])

return (
<FileBrowserContext.Provider value={{
crumbs: undefined,
loadingCurrentPath: loadingSearchResults,
showUploadsInTable: false,
viewFolder,
sourceFiles: pathContents,
moduleRootPath: undefined,
currentPath: searchTerm,
heading: t`Search results`,
controls,
itemOperations,
isSearch: true,
getPath
}}>
<FileBrowserContext.Provider
value={{
crumbs: undefined,
loadingCurrentPath: loadingSearchResults,
showUploadsInTable: false,
viewFolder,
sourceFiles: pathContents,
moduleRootPath: undefined,
currentPath: searchTerm,
heading: t`Search results`,
controls,
itemOperations,
isSearch: true,
getPath
}}>
<DragAndDrop>
<FilesList />
</DragAndDrop>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,28 +287,29 @@ const SharedFileBrowser = () => {


return (
<FileBrowserContext.Provider value={{
bucket,
bulkOperations,
handleUploadOnDrop,
crumbs,
moduleRootPath: ROUTE_LINKS.SharedFolderExplorer(bucket?.id || "", "/"),
currentPath,
refreshContents,
deleteItems,
downloadFile: handleDownload,
moveItems,
renameItem,
viewFolder,
loadingCurrentPath,
showUploadsInTable: false,
sourceFiles: pathContents,
heading: bucket?.name || t`Shared`,
controls: true,
allowDropUpload: access === "writer" || access === "owner",
itemOperations,
withSurvey: false
}}>
<FileBrowserContext.Provider
value={{
bucket,
bulkOperations,
handleUploadOnDrop,
crumbs,
moduleRootPath: ROUTE_LINKS.SharedFolderExplorer(bucket?.id || "", "/"),
currentPath,
refreshContents,
deleteItems,
downloadFile: handleDownload,
moveItems,
renameItem,
viewFolder,
loadingCurrentPath,
showUploadsInTable: false,
sourceFiles: pathContents,
heading: bucket?.name || t`Shared`,
controls: true,
allowDropUpload: access === "writer" || access === "owner",
itemOperations,
withSurvey: false
}}>
<DragAndDrop>
<FilesList isShared/>
</DragAndDrop>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -965,8 +965,10 @@ const FilesList = ({ isShared = false }: Props) => {
data-cy="data-state-no-files"
>
<EmptySvg />
<Typography variant="h4"
component="h4">
<Typography
variant="h4"
component="h4"
>
<Trans>No files to show</Trans>
</Typography>
</section>
Expand All @@ -982,8 +984,10 @@ const FilesList = ({ isShared = false }: Props) => {
>
{desktop ? (
<TableHead>
<TableRow type="grid"
className={classes.tableRow}>
<TableRow
type="grid"
className={classes.tableRow}
>
<TableHeadCell>
<CheckboxInput
value={selectedItems.length === items.length}
Expand Down Expand Up @@ -1029,8 +1033,10 @@ const FilesList = ({ isShared = false }: Props) => {
</TableHead>
) : (
<TableHead>
<TableRow type="grid"
className={classes.tableRow}>
<TableRow
type="grid"
className={classes.tableRow}
>
<TableHeadCell>
<CheckboxInput
value={selectedItems.length === items.length}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,8 @@ const FilePreviewModal = ({ file, nextFile, previousFile, closePreview, filePath
className={classes.prevNext}
>
{previousFile && (
<Button onClick={previousFile}
<Button
onClick={previousFile}
className={classes.prevNextButton}
data-cy="button-view-previous-file">
<ArrowLeftIcon />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,8 @@ const InitialScreen = ({ className }: IInitialScreen) => {
labelClassName={classes.inputLabel}
/>
{!!errorEmail && (
<Typography component="p"
<Typography
component="p"
variant="body1"
className={classes.error}>{error}</Typography>
)}
Expand Down Expand Up @@ -506,7 +507,8 @@ const InitialScreen = ({ className }: IInitialScreen) => {
{maintenanceMode && (
<Typography className={clsx(classes.maintenanceMessage, classes.maintenanceActiveMessage)}>
<Trans>We are performing routine maintenance of the system. Service status updates will be posted on the{" "}
<a href={ROUTE_LINKS.DiscordInvite}
<a
href={ROUTE_LINKS.DiscordInvite}
target="_blank"
rel='noreferrer noopener'>Files Support Channel</a>{" "}
on Discord
Expand Down
9 changes: 6 additions & 3 deletions packages/files-ui/src/Components/Modules/Settings/Profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,8 @@ const ProfileView = () => {
}
</>
}
<CheckboxInput label={t`Allow lookup by sharing key, wallet address or username`}
<CheckboxInput
label={t`Allow lookup by sharing key, wallet address or username`}
value={profile?.lookupConsent || false}
onChange={toggleLookupConsent} />
</div>
Expand Down Expand Up @@ -599,7 +600,8 @@ const ProfileView = () => {
<Trans>Theme</Trans>
</Typography>
<Grid container>
<Grid item
<Grid
item
xs={12}
lg={6}
>
Expand All @@ -615,7 +617,8 @@ const ProfileView = () => {
</Typography>}
</label>
</Grid>
<Grid item
<Grid
item
xs={12}
lg={6}
>
Expand Down
3 changes: 2 additions & 1 deletion packages/files-ui/src/Components/SharingExplainerModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ const SharingExplainerModal = ({ showModal, onHide }: Props) => {

case 2:
return <>
<div className={classes.title}
<div
className={classes.title}
><Trans>Add viewers and editors by username, sharing id or Ethereum address.</Trans></div>
<div className={classes.imageContainer}>
<img
Expand Down
3 changes: 2 additions & 1 deletion packages/files-ui/src/Contexts/PosthogContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ const PosthogProvider = ({ children }: PosthogProviderProps) => {
This website uses cookies that help the website function and track interactions for analytics purposes.
You have the right to decline our use of cookies. For us to provide a customizable user experience to you,
please click on the Accept button below.
<a className={classes.link}
<a
className={classes.link}
href="https://files.chainsafe.io/privacy-policy"
target='_blank'
rel='noopener noreferrer'>Learn more
Expand Down
Loading