Update to Prettier 3

This commit is contained in:
Manav Rathi 2024-02-22 11:36:17 +05:30
parent 44703ff3df
commit f1cf014004
40 changed files with 1948 additions and 1767 deletions

View file

@ -2,5 +2,5 @@
"tabWidth": 4,
"trailingComma": "es5",
"singleQuote": true,
"jsxBracketSameLine": true
"bracketSameLine": true
}

View file

@ -3,7 +3,9 @@
font-family: 'Inter';
font-style: normal;
font-weight: 400;
src: local(''), url('/fonts/inter-v11-latin-500.woff2') format('woff2'),
src:
local(''),
url('/fonts/inter-v11-latin-500.woff2') format('woff2'),
/* Chrome 26+, Opera 23+, Firefox 39+ */
url('/fonts/inter-v11-latin-500.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
font-display: swap; /*https://web.dev/font-display/?utm_source=lighthouse&utm_medium=devtools#how-to-avoid-showing-invisible-text*/
@ -14,7 +16,9 @@
font-family: 'Inter';
font-style: normal;
font-weight: 700;
src: local(''), url('/fonts/inter-v11-latin-600.woff2') format('woff2'),
src:
local(''),
url('/fonts/inter-v11-latin-600.woff2') format('woff2'),
/* Chrome 26+, Opera 23+, Firefox 39+ */
url('/fonts/inter-v11-latin-600.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
font-display: swap;
@ -25,7 +29,9 @@
font-family: 'Inter';
font-style: normal;
font-weight: 900;
src: local(''), url('/fonts/inter-v11-latin-800.woff2') format('woff2'),
src:
local(''),
url('/fonts/inter-v11-latin-800.woff2') format('woff2'),
/* Chrome 26+, Opera 23+, Firefox 39+ */
url('/fonts/inter-v11-latin-800.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
font-display: swap;

View file

@ -8,8 +8,8 @@ class ComlinkConvertWorker {
async getInstance() {
if (!this.comlinkWorkerInstance) {
this.comlinkWorkerInstance = await getDedicatedConvertWorker()
.remote;
this.comlinkWorkerInstance =
await getDedicatedConvertWorker().remote;
}
return this.comlinkWorkerInstance;
}

View file

@ -335,9 +335,8 @@ export async function getRenderableImage(fileName: string, imageBlob: Blob) {
imageBlob.size
)}`
);
convertedImageBlob = await heicConversionService.convert(
imageBlob
);
convertedImageBlob =
await heicConversionService.convert(imageBlob);
addLogLine(`${fileName} successfully converted`);
} catch (e) {
throw Error(CustomError.NON_PREVIEWABLE_FILE);
@ -536,9 +535,8 @@ export const getPreviewableImage = async (
): Promise<Blob> => {
try {
let fileBlob: Blob;
const fileURL = await CastDownloadManager.getCachedOriginalFile(
file
)[0];
const fileURL =
await CastDownloadManager.getCachedOriginalFile(file)[0];
if (!fileURL) {
fileBlob = await new Response(
await CastDownloadManager.downloadFile(castToken, file)

View file

@ -22,12 +22,12 @@ export function DownloadQuickOption({
collectionSummaryType === CollectionSummaryType.favorites
? t('DOWNLOAD_FAVORITES')
: collectionSummaryType ===
CollectionSummaryType.uncategorized
? t('DOWNLOAD_UNCATEGORIZED')
: collectionSummaryType ===
CollectionSummaryType.hiddenItems
? t('DOWNLOAD_HIDDEN_ITEMS')
: t('DOWNLOAD_COLLECTION')
CollectionSummaryType.uncategorized
? t('DOWNLOAD_UNCATEGORIZED')
: collectionSummaryType ===
CollectionSummaryType.hiddenItems
? t('DOWNLOAD_HIDDEN_ITEMS')
: t('DOWNLOAD_COLLECTION')
}>
<IconButton
onClick={handleCollectionAction(

View file

@ -26,11 +26,11 @@ export function ShareQuickOption({
CollectionSummaryType.incomingShareCollaborator
? t('SHARING_DETAILS')
: collectionSummaryType ===
CollectionSummaryType.outgoingShare ||
collectionSummaryType ===
CollectionSummaryType.sharedOnlyViaLink
? t('MODIFY_SHARING')
: t('SHARE_COLLECTION')
CollectionSummaryType.outgoingShare ||
collectionSummaryType ===
CollectionSummaryType.sharedOnlyViaLink
? t('MODIFY_SHARING')
: t('SHARE_COLLECTION')
}>
<IconButton
onClick={handleCollectionAction(

View file

@ -131,14 +131,15 @@ function CollectionSelector({
{attributes.intent === CollectionSelectorIntent.upload
? t('UPLOAD_TO_COLLECTION')
: attributes.intent === CollectionSelectorIntent.add
? t('ADD_TO_COLLECTION')
: attributes.intent === CollectionSelectorIntent.move
? t('MOVE_TO_COLLECTION')
: attributes.intent === CollectionSelectorIntent.restore
? t('RESTORE_TO_COLLECTION')
: attributes.intent === CollectionSelectorIntent.unhide
? t('UNHIDE_TO_COLLECTION')
: t('SELECT_COLLECTION')}
? t('ADD_TO_COLLECTION')
: attributes.intent === CollectionSelectorIntent.move
? t('MOVE_TO_COLLECTION')
: attributes.intent === CollectionSelectorIntent.restore
? t('RESTORE_TO_COLLECTION')
: attributes.intent ===
CollectionSelectorIntent.unhide
? t('UNHIDE_TO_COLLECTION')
: t('SELECT_COLLECTION')}
</DialogTitleWithCloseButton>
<DialogContent sx={{ '&&&': { padding: 0 } }}>
<FlexWrapper flexWrap="wrap" gap={'4px'} padding={'16px'}>

View file

@ -74,8 +74,10 @@ export function ManageLinkExpiry({
isLinkExpired(publicShareProp?.validTill)
? t('LINK_EXPIRED')
: publicShareProp?.validTill
? formatDateTime(publicShareProp?.validTill / 1000)
: t('NEVER')
? formatDateTime(
publicShareProp?.validTill / 1000
)
: t('NEVER')
}
/>
</MenuItemGroup>

View file

@ -110,19 +110,16 @@ export default function ExportModal(props: Props) {
const syncExportRecord = async (exportFolder: string): Promise<void> => {
try {
if (!exportService.exportFolderExists(exportFolder)) {
const pendingExports = await exportService.getPendingExports(
null
);
const pendingExports =
await exportService.getPendingExports(null);
setPendingExports(pendingExports);
}
const exportRecord = await exportService.getExportRecord(
exportFolder
);
const exportRecord =
await exportService.getExportRecord(exportFolder);
setExportStage(exportRecord.stage);
setLastExportTime(exportRecord.lastAttemptTimestamp);
const pendingExports = await exportService.getPendingExports(
exportRecord
);
const pendingExports =
await exportService.getPendingExports(exportRecord);
setPendingExports(pendingExports);
} catch (e) {
if (e.message !== CustomError.EXPORT_FOLDER_DOES_NOT_EXIST) {

View file

@ -136,10 +136,10 @@ export const FilesDownloadProgress: React.FC<FilesDownloadProgressProps> = ({
title: isFilesDownloadCompletedWithErrors(attributes)
? t('DOWNLOAD_FAILED')
: isFilesDownloadCompleted(attributes)
? t(`DOWNLOAD_COMPLETE`)
: t('DOWNLOADING_COLLECTION', {
name: attributes.folderName,
}),
? t(`DOWNLOAD_COMPLETE`)
: t('DOWNLOADING_COLLECTION', {
name: attributes.folderName,
}),
caption: isFilesDownloadCompleted(attributes)
? attributes.folderName
: t('DOWNLOAD_PROGRESS', {

View file

@ -91,9 +91,8 @@ export default function MLFileDebugView(props: MLFileDebugViewProps) {
const loadFile = async () => {
// TODO: go through worker for these apis, to not include ml code in main bundle
const imageBitmap = await createImageBitmap(props.file);
const faceDetections = await blazeFaceDetectionService.detectFaces(
imageBitmap
);
const faceDetections =
await blazeFaceDetectionService.detectFaces(imageBitmap);
addLogLine('detectedFaces: ', faceDetections.length);
const objectDetections = await ssdMobileNetV2Service.detectObjects(

View file

@ -429,11 +429,11 @@ export function PhotoList({
date: isSameDay(new Date(currentDate), new Date())
? t('TODAY')
: isSameDay(
new Date(currentDate),
new Date(Date.now() - A_DAY)
)
? t('YESTERDAY')
: formatDate(currentDate),
new Date(currentDate),
new Date(Date.now() - A_DAY)
)
? t('YESTERDAY')
: formatDate(currentDate),
id: currentDate.toString(),
});
timeStampList.push({

View file

@ -159,9 +159,8 @@ export function FileInfo({
}
}
if (exif['Make'] && exif['Model']) {
parsedExifData[
'takenOnDevice'
] = `${exif['Make']} ${exif['Model']}`;
parsedExifData['takenOnDevice'] =
`${exif['Make']} ${exif['Model']}`;
}
if (exif['ExposureTime']) {
parsedExifData['exposureTime'] = `1/${

View file

@ -110,8 +110,10 @@ function PhotoViewer(props: Iprops) {
useState<Photoswipe<Photoswipe.Options>>();
const [isFav, setIsFav] = useState(false);
const [showInfo, setShowInfo] = useState(false);
const [exif, setExif] =
useState<{ key: string; value: Record<string, any> }>();
const [exif, setExif] = useState<{
key: string;
value: Record<string, any>;
}>();
const exifCopy = useRef(null);
const [livePhotoBtnOptions, setLivePhotoBtnOptions] = useState(
defaultLivePhotoDefaultOptions

View file

@ -28,8 +28,8 @@ function UploadProgressSubtitleText() {
{uploadStage === UPLOAD_STAGES.UPLOADING
? t(`UPLOAD_STAGE_MESSAGE.${uploadStage}`, { uploadCounter })
: uploadStage === UPLOAD_STAGES.EXTRACTING_METADATA
? t(`UPLOAD_STAGE_MESSAGE.${uploadStage}`, { uploadCounter })
: t(`UPLOAD_STAGE_MESSAGE.${uploadStage}`)}
? t(`UPLOAD_STAGE_MESSAGE.${uploadStage}`, { uploadCounter })
: t(`UPLOAD_STAGE_MESSAGE.${uploadStage}`)}
</Typography>
);
}

View file

@ -61,9 +61,9 @@ export default function UploadTypeSelector({
UploadTypeSelectorIntent.collectPhotos
? t('SELECT_PHOTOS')
: uploadTypeSelectorIntent ===
UploadTypeSelectorIntent.import
? t('IMPORT')
: t('UPLOAD')}
UploadTypeSelectorIntent.import
? t('IMPORT')
: t('UPLOAD')}
</DialogTitleWithCloseButton>
<Box p={1.5} pt={0.5}>
<Stack spacing={0.5}>

View file

@ -287,8 +287,8 @@ export default function Uploader(props: Props) {
electronFiles?.length > 0
? 'electronFiles'
: webFiles?.length > 0
? 'webFiles'
: 'sharedFiles'
? 'webFiles'
: 'sharedFiles'
} count ${
electronFiles?.length ??
webFiles?.length ??

View file

@ -6,7 +6,10 @@ import { CustomError } from '@ente/shared/error';
import { retryAsyncFunction } from 'utils/network';
export class PhotosDownloadClient implements DownloadClient {
constructor(private token: string, private timeout: number) {}
constructor(
private token: string,
private timeout: number
) {}
updateTokens(token: string) {
this.token = token;
}

View file

@ -28,9 +28,8 @@ const EMBEDDINGS_TABLE = 'embeddings_v2';
const EMBEDDING_SYNC_TIME_TABLE = 'embedding_sync_time';
export const getAllLocalEmbeddings = async () => {
const embeddings: Array<Embedding> = await localForage.getItem<Embedding[]>(
EMBEDDINGS_TABLE
);
const embeddings: Array<Embedding> =
await localForage.getItem<Embedding[]>(EMBEDDINGS_TABLE);
if (!embeddings) {
await localForage.removeItem(EMBEDDINGS_TABLE_V1);
await localForage.removeItem(EMBEDDING_SYNC_TIME_TABLE);

View file

@ -1000,9 +1000,8 @@ class ExportService {
if (!this.exists(exportRecordJSONPath)) {
return this.createEmptyExportRecord(exportRecordJSONPath);
}
const recordFile = await ElectronAPIs.readTextFile(
exportRecordJSONPath
);
const recordFile =
await ElectronAPIs.readTextFile(exportRecordJSONPath);
try {
return JSON.parse(recordFile);
} catch (e) {

View file

@ -68,9 +68,8 @@ export async function replaceThumbnail(
current: idx,
total: largeThumbnailFiles.length,
});
const originalThumbnail = await downloadManager.getThumbnail(
file
);
const originalThumbnail =
await downloadManager.getThumbnail(file);
const dummyImageFile = new File(
[originalThumbnail],
file.metadata.title

View file

@ -187,9 +187,8 @@ export const syncPublicFiles = async (
if (!token) {
return sortFiles(files, sortAsc);
}
const lastSyncTime = await getPublicCollectionLastSyncTime(
collectionUID
);
const lastSyncTime =
await getPublicCollectionLastSyncTime(collectionUID);
if (collection.updationTime === lastSyncTime) {
return sortFiles(files, sortAsc);
}

View file

@ -231,7 +231,7 @@ function getCollectionSuggestion(
type: SuggestionType.COLLECTION,
value: searchResult.id,
label: searchResult.name,
} as Suggestion)
}) as Suggestion
);
}
@ -267,15 +267,14 @@ async function getLocationSuggestions(searchPhrase: string) {
type: SuggestionType.LOCATION,
value: locationTag.data,
label: locationTag.data.name,
} as Suggestion)
}) as Suggestion
);
const locationTagNames = new Set(
locationTagSuggestions.map((result) => result.label)
);
const citySearchResults = await locationSearchService.searchCities(
searchPhrase
);
const citySearchResults =
await locationSearchService.searchCities(searchPhrase);
const nonConflictingCityResult = citySearchResults.filter(
(city) => !locationTagNames.has(city.city)
@ -287,7 +286,7 @@ async function getLocationSuggestions(searchPhrase: string) {
type: SuggestionType.CITY,
value: city,
label: city.city,
} as Suggestion)
}) as Suggestion
);
return [...locationTagSuggestions, ...citySearchSuggestions];
@ -302,7 +301,7 @@ async function getThingSuggestion(searchPhrase: string): Promise<Suggestion[]> {
type: SuggestionType.THING,
value: searchResult,
label: searchResult.name,
} as Suggestion)
}) as Suggestion
);
}

View file

@ -28,9 +28,8 @@ export async function uploadStreamUsingMultipart(
) {
const uploadPartCount = calculatePartCount(dataStream.chunkCount);
logger(`fetching ${uploadPartCount} urls for multipart upload`);
const multipartUploadURLs = await uploadService.fetchMultipartUploadURLs(
uploadPartCount
);
const multipartUploadURLs =
await uploadService.fetchMultipartUploadURLs(uploadPartCount);
logger(`fetched ${uploadPartCount} urls for multipart upload`);
const fileObjectKey = await uploadStreamInParts(

View file

@ -202,7 +202,7 @@ function convertInProgressUploadsToList(inProgressUploads) {
({
localFileID,
progress,
} as InProgressUpload)
}) as InProgressUpload
);
}

View file

@ -3,7 +3,9 @@
font-family: 'Inter';
font-style: normal;
font-weight: 400;
src: local(''), url('/fonts/inter-v11-latin-500.woff2') format('woff2'),
src:
local(''),
url('/fonts/inter-v11-latin-500.woff2') format('woff2'),
/* Chrome 26+, Opera 23+, Firefox 39+ */
url('/fonts/inter-v11-latin-500.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
font-display: swap; /*https://web.dev/font-display/?utm_source=lighthouse&utm_medium=devtools#how-to-avoid-showing-invisible-text*/
@ -14,7 +16,9 @@
font-family: 'Inter';
font-style: normal;
font-weight: 700;
src: local(''), url('/fonts/inter-v11-latin-600.woff2') format('woff2'),
src:
local(''),
url('/fonts/inter-v11-latin-600.woff2') format('woff2'),
/* Chrome 26+, Opera 23+, Firefox 39+ */
url('/fonts/inter-v11-latin-600.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
font-display: swap;
@ -25,7 +29,9 @@
font-family: 'Inter';
font-style: normal;
font-weight: 900;
src: local(''), url('/fonts/inter-v11-latin-800.woff2') format('woff2'),
src:
local(''),
url('/fonts/inter-v11-latin-800.woff2') format('woff2'),
/* Chrome 26+, Opera 23+, Firefox 39+ */
url('/fonts/inter-v11-latin-800.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
font-display: swap;

View file

@ -8,8 +8,8 @@ class ComlinkConvertWorker {
async getInstance() {
if (!this.comlinkWorkerInstance) {
this.comlinkWorkerInstance = await getDedicatedConvertWorker()
.remote;
this.comlinkWorkerInstance =
await getDedicatedConvertWorker().remote;
}
return this.comlinkWorkerInstance;
}

View file

@ -8,8 +8,8 @@ class ComlinkSearchWorker {
async getInstance() {
if (!this.comlinkWorkerInstance) {
this.comlinkWorkerInstance = await getDedicatedSearchWorker()
.remote;
this.comlinkWorkerInstance =
await getDedicatedSearchWorker().remote;
}
return this.comlinkWorkerInstance;
}

View file

@ -468,9 +468,8 @@ export async function getRenderableImage(fileName: string, imageBlob: Blob) {
imageBlob.size
)}`
);
convertedImageBlob = await heicConversionService.convert(
imageBlob
);
convertedImageBlob =
await heicConversionService.convert(imageBlob);
addLogLine(`${fileName} successfully converted`);
} catch (e) {
throw Error(CustomError.NON_PREVIEWABLE_FILE);

View file

@ -177,7 +177,7 @@ class MLIDbStorage {
public async newTransaction<
Name extends StoreNames<MLDb>,
Mode extends IDBTransactionMode = 'readonly'
Mode extends IDBTransactionMode = 'readonly',
>(storeNames: Name, mode?: Mode) {
const db = await this.db;
return db.transaction(storeNames, mode);

View file

@ -177,8 +177,8 @@ async function collectionWiseFileCount(expectedState) {
`collectionWiseFileCount check failed ❌
for collection ${collectionName}
expected File count : ${fileCount} , got: ${collectionNameToFileCount.get(
collectionName
)}`
collectionName
)}`
);
}
}
@ -300,8 +300,8 @@ async function exifDataParsingCheck(expectedState) {
for ${fileName}
expected: ${JSON.stringify(exifValues['location'])}
got: [${matchingFile.metadata.latitude},${
matchingFile.metadata.longitude
}]`);
matchingFile.metadata.longitude
}]`);
}
});
console.log('exif data parsing check passed ✅');
@ -371,8 +371,8 @@ async function googleMetadataReadingCheck(expectedState) {
metadata['location']
)}
got: [${matchingFile.metadata.latitude},${
matchingFile.metadata.longitude
}]`);
matchingFile.metadata.longitude
}]`);
}
}
);

View file

@ -65,8 +65,8 @@ export const testZipFileReading = async () => {
${getFileNameSize(
file
)} more than expected chunks, expected: ${
filedata.chunkCount
}`
filedata.chunkCount
}`
);
}
console.log(`${i}/${files.length} passed ✅`);

View file

@ -38,7 +38,7 @@
"@typescript-eslint/eslint-plugin": "^7",
"@typescript-eslint/parser": "^7",
"eslint": "^8",
"prettier": "2.3.2",
"prettier": "^3",
"typescript": "^5.1.3"
}
}

View file

@ -23,8 +23,8 @@ export const PasswordStrengthHint = ({
passwordStrength === PasswordStrength.WEAK
? theme.colors.danger.A700
: passwordStrength === PasswordStrength.MODERATE
? theme.colors.warning.A500
: theme.colors.accent.A500,
? theme.colors.warning.A500
: theme.colors.accent.A500,
})}
textAlign={'left'}
flex={1}>

View file

@ -234,9 +234,8 @@ export default function Credentials({
addLocalLog(() => `userSRPSetupPending ${!srpAttributes}`);
if (!srpAttributes) {
const loginSubKey = await generateLoginSubKey(kek);
const srpSetupAttributes = await generateSRPSetupAttributes(
loginSubKey
);
const srpSetupAttributes =
await generateSRPSetupAttributes(loginSubKey);
await configureSRP(srpSetupAttributes);
}
} catch (e) {

View file

@ -14,7 +14,8 @@ export interface Iprops {
export const StyledMenu = styled(Menu)`
& .MuiPaper-root {
margin: 16px auto;
box-shadow: 0px 0px 6px rgba(0, 0, 0, 0.16),
box-shadow:
0px 0px 6px rgba(0, 0, 0, 0.16),
0px 3px 6px rgba(0, 0, 0, 0.12);
}
& .MuiList-root {

View file

@ -101,9 +101,8 @@ export const saveKeyInSessionStore = async (
fromDesktop?: boolean
) => {
const cryptoWorker = await ComlinkCryptoWorker.getInstance();
const sessionKeyAttributes = await cryptoWorker.generateKeyAndEncryptToB64(
key
);
const sessionKeyAttributes =
await cryptoWorker.generateKeyAndEncryptToB64(key);
setKey(keyType, sessionKeyAttributes);
addLogLine('fromDesktop', fromDesktop);
if (

View file

@ -1,7 +1,7 @@
import { DataStream } from '@ente/shared/upload/types';
export interface LocalFileAttributes<
T extends string | Uint8Array | DataStream
T extends string | Uint8Array | DataStream,
> {
encryptedData: T;
decryptionHeader: string;

View file

@ -55,11 +55,11 @@ export function toFileWithPath(file: File, path?: string): FileWithPath {
typeof path === 'string'
? path
: typeof webkitRelativePath === 'string' && // If <input webkitdirectory> is set,
// the File will have a {webkitRelativePath} property
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/webkitdirectory
webkitRelativePath.length > 0
? webkitRelativePath
: file.name,
// the File will have a {webkitRelativePath} property
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/webkitdirectory
webkitRelativePath.length > 0
? webkitRelativePath
: file.name,
writable: false,
configurable: false,
enumerable: true,

3460
yarn.lock

File diff suppressed because it is too large Load diff