Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.

Commit

Permalink
Switch to prettier defaults (#1656)
Browse files Browse the repository at this point in the history
  • Loading branch information
mnvr committed Feb 24, 2024
2 parents 0b8d9fa + c1bf193 commit 8b1d33e
Show file tree
Hide file tree
Showing 669 changed files with 12,317 additions and 12,050 deletions.
3 changes: 0 additions & 3 deletions .github/.prettierrc.json

This file was deleted.

4 changes: 1 addition & 3 deletions .prettierrc.json
@@ -1,6 +1,4 @@
{
"tabWidth": 4,
"trailingComma": "es5",
"singleQuote": true,
"bracketSameLine": true
"plugins": ["prettier-plugin-organize-imports"]
}
8 changes: 4 additions & 4 deletions apps/accounts/.eslintrc.js
Expand Up @@ -3,11 +3,11 @@ module.exports = {
// This is required here to ensure desktop picks the right eslint config, where this app is
// packaged as a submodule.
root: true,
extends: ['@ente/eslint-config'],
parser: '@typescript-eslint/parser',
extends: ["@ente/eslint-config"],
parser: "@typescript-eslint/parser",
parserOptions: {
tsconfigRootDir: __dirname,
project: './tsconfig.json',
project: "./tsconfig.json",
},
ignorePatterns: ['.eslintrc.js', 'out'],
ignorePatterns: [".eslintrc.js", "out"],
};
2 changes: 1 addition & 1 deletion apps/accounts/next.config.js
@@ -1,4 +1,4 @@
const nextConfigBase = require('@/next/next.config.base.js');
const nextConfigBase = require("@/next/next.config.base.js");

module.exports = {
...nextConfigBase,
Expand Down
4 changes: 2 additions & 2 deletions apps/accounts/sentry.client.config.ts
@@ -1,3 +1,3 @@
import { initSentry } from '@ente/shared/sentry/config/sentry.config.base';
import { initSentry } from "@ente/shared/sentry/config/sentry.config.base";

initSentry('https://0f7214c7feb9b1dd2fed5db09b42fa1b@sentry.ente.io/5');
initSentry("https://0f7214c7feb9b1dd2fed5db09b42fa1b@sentry.ente.io/5");
62 changes: 32 additions & 30 deletions apps/accounts/src/pages/_app.tsx
@@ -1,27 +1,27 @@
import { CacheProvider } from '@emotion/react';
import { APPS, APP_TITLES } from '@ente/shared/apps/constants';
import { EnteAppProps } from '@ente/shared/apps/types';
import { Overlay } from '@ente/shared/components/Container';
import DialogBoxV2 from '@ente/shared/components/DialogBoxV2';
import { setupI18n } from "@/ui/i18n";
import { CacheProvider } from "@emotion/react";
import { APPS, APP_TITLES } from "@ente/shared/apps/constants";
import { EnteAppProps } from "@ente/shared/apps/types";
import { Overlay } from "@ente/shared/components/Container";
import DialogBoxV2 from "@ente/shared/components/DialogBoxV2";
import {
DialogBoxAttributesV2,
SetDialogBoxAttributesV2,
} from '@ente/shared/components/DialogBoxV2/types';
import EnteSpinner from '@ente/shared/components/EnteSpinner';
import AppNavbar from '@ente/shared/components/Navbar/app';
import { useLocalState } from '@ente/shared/hooks/useLocalState';
import { setupI18n } from '@/ui/i18n';
import HTTPService from '@ente/shared/network/HTTPService';
import { LS_KEYS, getData } from '@ente/shared/storage/localStorage';
import { getTheme } from '@ente/shared/themes';
import { THEME_COLOR } from '@ente/shared/themes/constants';
import createEmotionCache from '@ente/shared/themes/createEmotionCache';
import { CssBaseline, useMediaQuery } from '@mui/material';
import { ThemeProvider } from '@mui/material/styles';
import Head from 'next/head';
import { useRouter } from 'next/router';
import { createContext, useEffect, useState } from 'react';
import 'styles/global.css';
} from "@ente/shared/components/DialogBoxV2/types";
import EnteSpinner from "@ente/shared/components/EnteSpinner";
import AppNavbar from "@ente/shared/components/Navbar/app";
import { useLocalState } from "@ente/shared/hooks/useLocalState";
import HTTPService from "@ente/shared/network/HTTPService";
import { LS_KEYS, getData } from "@ente/shared/storage/localStorage";
import { getTheme } from "@ente/shared/themes";
import { THEME_COLOR } from "@ente/shared/themes/constants";
import createEmotionCache from "@ente/shared/themes/createEmotionCache";
import { CssBaseline, useMediaQuery } from "@mui/material";
import { ThemeProvider } from "@mui/material/styles";
import Head from "next/head";
import { useRouter } from "next/router";
import { createContext, useEffect, useState } from "react";
import "styles/global.css";

interface AppContextProps {
isMobile: boolean;
Expand Down Expand Up @@ -50,7 +50,7 @@ export default function App(props: EnteAppProps) {

const showNavBar = (show: boolean) => setShowNavBar(show);

const isMobile = useMediaQuery('(max-width:428px)');
const isMobile = useMediaQuery("(max-width:428px)");

const router = useRouter();

Expand All @@ -70,14 +70,14 @@ export default function App(props: EnteAppProps) {
const pkg = getData(LS_KEYS.CLIENT_PACKAGE);
if (!pkg) return;
HTTPService.setHeaders({
'X-Client-Package': pkg.name,
"X-Client-Package": pkg.name,
});
};

useEffect(() => {
router.events.on('routeChangeComplete', setupPackageName);
router.events.on("routeChangeComplete", setupPackageName);
return () => {
router.events.off('routeChangeComplete', setupPackageName);
router.events.off("routeChangeComplete", setupPackageName);
};
}, [router.events]);

Expand Down Expand Up @@ -111,17 +111,19 @@ export default function App(props: EnteAppProps) {
showNavBar,
setDialogBoxAttributesV2:
setDialogBoxAttributesV2 as any,
}}>
}}
>
{!isI18nReady && (
<Overlay
sx={(theme) => ({
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
display: "flex",
justifyContent: "center",
alignItems: "center",
zIndex: 2000,
backgroundColor: (theme as any).colors
.background.base,
})}>
})}
>
<EnteSpinner />
</Overlay>
)}
Expand Down
2 changes: 1 addition & 1 deletion apps/accounts/src/pages/_document.tsx
@@ -1,6 +1,6 @@
import DocumentPage, {
EnteDocumentProps,
} from '@ente/shared/next/pages/_document';
} from "@ente/shared/next/pages/_document";

export default function Document(props: EnteDocumentProps) {
return <DocumentPage {...props} />;
Expand Down
26 changes: 13 additions & 13 deletions apps/accounts/src/pages/account-handoff.tsx
@@ -1,11 +1,11 @@
import { VerticallyCentered } from '@ente/shared/components/Container';
import EnteSpinner from '@ente/shared/components/EnteSpinner';
import { ACCOUNTS_PAGES } from '@ente/shared/constants/pages';
import HTTPService from '@ente/shared/network/HTTPService';
import { logError } from '@ente/shared/sentry';
import { LS_KEYS, getData, setData } from '@ente/shared/storage/localStorage';
import { useRouter } from 'next/router';
import { useEffect } from 'react';
import { VerticallyCentered } from "@ente/shared/components/Container";
import EnteSpinner from "@ente/shared/components/EnteSpinner";
import { ACCOUNTS_PAGES } from "@ente/shared/constants/pages";
import HTTPService from "@ente/shared/network/HTTPService";
import { logError } from "@ente/shared/sentry";
import { LS_KEYS, getData, setData } from "@ente/shared/storage/localStorage";
import { useRouter } from "next/router";
import { useEffect } from "react";

const AccountHandoff = () => {
const router = useRouter();
Expand All @@ -16,26 +16,26 @@ const AccountHandoff = () => {

router.push(ACCOUNTS_PAGES.PASSKEYS);
} catch (e) {
logError(e, 'Failed to deserialize and set passed user data');
logError(e, "Failed to deserialize and set passed user data");
router.push(ACCOUNTS_PAGES.LOGIN);
}
};

const getClientPackageName = () => {
const urlParams = new URLSearchParams(window.location.search);
const pkg = urlParams.get('package');
const pkg = urlParams.get("package");
if (!pkg) return;
setData(LS_KEYS.CLIENT_PACKAGE, { name: pkg });
HTTPService.setHeaders({
'X-Client-Package': pkg,
"X-Client-Package": pkg,
});
};

const extractAccountsToken = () => {
const urlParams = new URLSearchParams(window.location.search);
const token = urlParams.get('token');
const token = urlParams.get("token");
if (!token) {
throw new Error('token not found');
throw new Error("token not found");
}

const user = getData(LS_KEYS.USER) || {};
Expand Down
10 changes: 5 additions & 5 deletions apps/accounts/src/pages/credentials/index.tsx
@@ -1,8 +1,8 @@
import CredentialPage from '@ente/accounts/pages/credentials';
import { useRouter } from 'next/router';
import { AppContext } from '../_app';
import { useContext } from 'react';
import { APPS } from '@ente/shared/apps/constants';
import CredentialPage from "@ente/accounts/pages/credentials";
import { APPS } from "@ente/shared/apps/constants";
import { useRouter } from "next/router";
import { useContext } from "react";
import { AppContext } from "../_app";

export default function Credential() {
const appContext = useContext(AppContext);
Expand Down
10 changes: 5 additions & 5 deletions apps/accounts/src/pages/generate/index.tsx
@@ -1,8 +1,8 @@
import GeneratePage from '@ente/accounts/pages/generate';
import { APPS } from '@ente/shared/apps/constants';
import { useRouter } from 'next/router';
import { AppContext } from 'pages/_app';
import { useContext } from 'react';
import GeneratePage from "@ente/accounts/pages/generate";
import { APPS } from "@ente/shared/apps/constants";
import { useRouter } from "next/router";
import { AppContext } from "pages/_app";
import { useContext } from "react";

export default function Generate() {
const appContext = useContext(AppContext);
Expand Down
6 changes: 3 additions & 3 deletions apps/accounts/src/pages/index.tsx
@@ -1,11 +1,11 @@
import { useRouter } from 'next/router';
import { useEffect } from 'react';
import { useRouter } from "next/router";
import { useEffect } from "react";

const Index = () => {
const router = useRouter();

useEffect(() => {
router.push('/login');
router.push("/login");
}, []);
return <></>;
};
Expand Down
10 changes: 5 additions & 5 deletions apps/accounts/src/pages/login/index.tsx
@@ -1,8 +1,8 @@
import LoginPage from '@ente/accounts/pages/login';
import { useRouter } from 'next/router';
import { AppContext } from '../_app';
import { useContext } from 'react';
import { APPS } from '@ente/shared/apps/constants';
import LoginPage from "@ente/accounts/pages/login";
import { APPS } from "@ente/shared/apps/constants";
import { useRouter } from "next/router";
import { useContext } from "react";
import { AppContext } from "../_app";

export default function Login() {
const appContext = useContext(AppContext);
Expand Down
39 changes: 21 additions & 18 deletions apps/accounts/src/pages/passkeys/DeletePasskeyModal.tsx
@@ -1,11 +1,11 @@
import DialogBoxV2 from '@ente/shared/components/DialogBoxV2';
import EnteButton from '@ente/shared/components/EnteButton';
import { Button, Stack, Typography } from '@mui/material';
import { AppContext } from 'pages/_app';
import { useContext, useState } from 'react';
import { deletePasskey } from 'services/passkeysService';
import { PasskeysContext } from '.';
import { t } from 'i18next';
import DialogBoxV2 from "@ente/shared/components/DialogBoxV2";
import EnteButton from "@ente/shared/components/EnteButton";
import { Button, Stack, Typography } from "@mui/material";
import { t } from "i18next";
import { AppContext } from "pages/_app";
import { useContext, useState } from "react";
import { deletePasskey } from "services/passkeysService";
import { PasskeysContext } from ".";

interface IProps {
open: boolean;
Expand Down Expand Up @@ -41,27 +41,30 @@ const DeletePasskeyModal = (props: IProps) => {
onClose={props.onClose}
fullScreen={isMobile}
attributes={{
title: t('DELETE_PASSKEY'),
title: t("DELETE_PASSKEY"),
secondary: {
action: props.onClose,
text: t('CANCEL'),
text: t("CANCEL"),
},
}}>
<Stack spacing={'8px'}>
<Typography>{t('DELETE_PASSKEY_CONFIRMATION')}</Typography>
}}
>
<Stack spacing={"8px"}>
<Typography>{t("DELETE_PASSKEY_CONFIRMATION")}</Typography>
<EnteButton
type="submit"
size="large"
color="critical"
loading={loading}
onClick={doDelete}>
{t('DELETE')}
onClick={doDelete}
>
{t("DELETE")}
</EnteButton>
<Button
size="large"
color={'secondary'}
onClick={props.onClose}>
{t('CANCEL')}
color={"secondary"}
onClick={props.onClose}
>
{t("CANCEL")}
</Button>
</Stack>
</DialogBoxV2>
Expand Down

0 comments on commit 8b1d33e

Please sign in to comment.