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

@ -136,7 +136,8 @@ function CollectionSelector({
? t('MOVE_TO_COLLECTION')
: attributes.intent === CollectionSelectorIntent.restore
? t('RESTORE_TO_COLLECTION')
: attributes.intent === CollectionSelectorIntent.unhide
: attributes.intent ===
CollectionSelectorIntent.unhide
? t('UNHIDE_TO_COLLECTION')
: t('SELECT_COLLECTION')}
</DialogTitleWithCloseButton>

View file

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

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

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

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

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

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

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

3460
yarn.lock

File diff suppressed because it is too large Load diff