Skip to content

Commit

Permalink
Revert "chore: add prettierrc and format"
Browse files Browse the repository at this point in the history
This reverts commit 0fdaa10.
  • Loading branch information
httpjamesm authored and aeharding committed Jun 29, 2023
1 parent a83aa71 commit cdc8b0e
Show file tree
Hide file tree
Showing 62 changed files with 136 additions and 143 deletions.
6 changes: 0 additions & 6 deletions .prettierrc

This file was deleted.

4 changes: 3 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{
"recommendations": ["ionic.ionic"]
"recommendations": [
"ionic.ionic"
]
}
12 changes: 6 additions & 6 deletions server.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const validLemmyServers = {};
const badLemmyServers = {};

INITIAL_VALID_LEMMY_SERVERS.forEach(
(server) => (validLemmyServers[server] = true),
(server) => (validLemmyServers[server] = true)
);

const app = express();
Expand Down Expand Up @@ -105,7 +105,7 @@ app.use(
onProxyReq: (clientReq, req) => {
clientReq.setHeader(
"user-agent",
`(${req.hostname}, ${process.env.EMAIL || "hello@wefwef.app"})`,
`(${req.hostname}, ${process.env.EMAIL || "hello@wefwef.app"})`
);
clientReq.removeHeader("cookie");

Expand All @@ -125,7 +125,7 @@ app.use(
onProxyRes: (proxyRes, req, res) => {
res.removeHeader("cookie");
},
}),
})
);

function transformer(html) {
Expand All @@ -134,10 +134,10 @@ function transformer(html) {
`<script>${
CUSTOM_LEMMY_SERVERS.length
? `window.CUSTOM_LEMMY_SERVERS = ${JSON.stringify(
CUSTOM_LEMMY_SERVERS,
CUSTOM_LEMMY_SERVERS
)}`
: ""
}</script>`,
}</script>`
);
}

Expand All @@ -149,5 +149,5 @@ const PORT = process.env.PORT || 5173;

ViteExpress.listen(app, PORT, () =>
// eslint-disable-next-line no-console
console.log(`Server is on http://localhost:${PORT}`),
console.log(`Server is on http://localhost:${PORT}`)
);
4 changes: 2 additions & 2 deletions src/Auth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default function Auth({ children }: AuthProps) {
const jwt = useAppSelector(jwtSelector);
const iss = useAppSelector(jwtIssSelector);
const connectedInstance = useAppSelector(
(state) => state.auth.connectedInstance,
(state) => state.auth.connectedInstance
);
const location = useLocation();
const pageVisibility = usePageVisibility();
Expand Down Expand Up @@ -59,7 +59,7 @@ export default function Auth({ children }: AuthProps) {

dispatch(syncMessages());
},
shouldSyncMessages() ? 1_000 * 15 : null,
shouldSyncMessages() ? 1_000 * 15 : null
);

useInterval(() => {
Expand Down
8 changes: 4 additions & 4 deletions src/BeforeInstallPromptProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,25 @@ export default function BeforeInstallPromptProvider({
event.preventDefault();
setBeforeInstallPromptEvent(event);
},
[],
[]
);

useEffect(() => {
const handleBeforeInstallPromptEvent = (
event: BeforeInstallPromptEvent,
event: BeforeInstallPromptEvent
) => {
handleBeforeInstallPrompt(event);
};

window.addEventListener(
"beforeinstallprompt",
handleBeforeInstallPromptEvent as never,
handleBeforeInstallPromptEvent as never
);

return () => {
window.removeEventListener(
"beforeinstallprompt",
handleBeforeInstallPromptEvent as never,
handleBeforeInstallPromptEvent as never
);
};
}, [handleBeforeInstallPrompt]);
Expand Down
6 changes: 3 additions & 3 deletions src/TabbedRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export default function TabbedRoutes() {
const pageRef = useRef<IonRouterOutletCustomEvent<unknown>["target"]>(null);

const connectedInstance = useAppSelector(
(state) => state.auth.connectedInstance,
(state) => state.auth.connectedInstance
);
const actor = location.pathname.split("/")[2];
const iss = useAppSelector(jwtIssSelector);
Expand All @@ -100,7 +100,7 @@ export default function TabbedRoutes() {
} else {
router.push(
`/posts/${actor ?? iss ?? DEFAULT_ACTOR}/${jwt ? "home" : "all"}`,
"back",
"back"
);
}
}
Expand Down Expand Up @@ -154,7 +154,7 @@ export default function TabbedRoutes() {
}

resolve(!!state.scrollTop);
}),
})
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/features/auth/AccountSwitcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default function AccountSwitcher({
const dispatch = useAppDispatch();
const accounts = useAppSelector((state) => state.auth.accountData?.accounts);
const activeHandle = useAppSelector(
(state) => state.auth.accountData?.activeHandle,
(state) => state.auth.accountData?.activeHandle
);
const [editing, setEditing] = useState(false);

Expand Down
6 changes: 3 additions & 3 deletions src/features/auth/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export default function Login({
return new URL(
customServer.startsWith("https://")
? customServer
: `https://${customServer}`,
: `https://${customServer}`
).hostname;
} catch (e) {
return undefined;
Expand Down Expand Up @@ -165,8 +165,8 @@ export default function Login({
new LemmyHttp(`/api/${server ?? customServerHostname}`),
username,
password,
totp,
),
totp
)
);
} catch (error) {
if (error === "missing_totp_token") {
Expand Down
16 changes: 8 additions & 8 deletions src/features/auth/authSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ interface PostState {
}

const initialState: (connectedInstance?: string) => PostState = (
connectedInstance = "",
connectedInstance = ""
) => ({
accountData: getCredentialsFromStorage(),
site: undefined,
Expand All @@ -71,7 +71,7 @@ export const authSlice = createSlice({

const accounts = uniqBy(
[action.payload, ...state.accountData.accounts],
(c) => c.handle,
(c) => c.handle
);

state.accountData = {
Expand All @@ -87,7 +87,7 @@ export const authSlice = createSlice({
const accounts = differenceWith(
state.accountData.accounts,
[action.payload],
(a, b) => a.handle === b,
(a, b) => a.handle === b
);

if (accounts.length === 0) {
Expand Down Expand Up @@ -143,15 +143,15 @@ export const activeAccount = createSelector(
],
(accounts, activeHandle) => {
return accounts?.find(({ handle }) => handle === activeHandle);
},
}
);

export const jwtSelector = createSelector([activeAccount], (account) => {
return account?.jwt;
});

export const jwtPayloadSelector = createSelector([jwtSelector], (jwt) =>
jwt ? parseJWT(jwt) : undefined,
jwt ? parseJWT(jwt) : undefined
);

export const jwtIssSelector = (state: RootState) =>
Expand Down Expand Up @@ -253,7 +253,7 @@ export const urlSelector = createSelector(
(connectedInstance, iss) => {
// never leak the jwt to the incorrect server
return iss ?? connectedInstance;
},
}
);

export const clientSelector = createSelector([urlSelector], (url) => {
Expand All @@ -262,7 +262,7 @@ export const clientSelector = createSelector([urlSelector], (url) => {
});

function updateCredentialsStorage(
accounts: CredentialStoragePayload | undefined,
accounts: CredentialStoragePayload | undefined
) {
if (!accounts) {
localStorage.removeItem(MULTI_ACCOUNT_STORAGE_NAME);
Expand All @@ -274,7 +274,7 @@ function updateCredentialsStorage(

function getCredentialsFromStorage(): CredentialStoragePayload | undefined {
const serializedCredentials = localStorage.getItem(
MULTI_ACCOUNT_STORAGE_NAME,
MULTI_ACCOUNT_STORAGE_NAME
);
if (!serializedCredentials) return;
return JSON.parse(serializedCredentials);
Expand Down
4 changes: 2 additions & 2 deletions src/features/comment/CommentSort.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const BUTTONS: ActionSheetButton<CommentSortType>[] = COMMENT_SORTS.map(
text: startCase(sortType),
data: sortType,
icon: getSortIcon(sortType),
}),
})
);

interface CommentSortProps {
Expand All @@ -44,7 +44,7 @@ export default function CommentSort({ sort, setSort }: CommentSortProps) {
isOpen={open}
onDidDismiss={() => setOpen(false)}
onWillDismiss={(
e: IonActionSheetCustomEvent<OverlayEventDetail<CommentSortType>>,
e: IonActionSheetCustomEvent<OverlayEventDetail<CommentSortType>>
) => {
if (e.detail.data) {
setSort(e.detail.data);
Expand Down
6 changes: 3 additions & 3 deletions src/features/comment/CommentTree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ export default function CommentTree({
}: CommentTreeProps) {
const dispatch = useAppDispatch();
const commentCollapsedById = useAppSelector(
(state) => state.comment.commentCollapsedById,
(state) => state.comment.commentCollapsedById
);

const childCount = useMemo(
() => getFlattenedChildren(comment).length,
[comment],
[comment]
);

const collapsed = commentCollapsedById[comment.comment_view.comment.id];
Expand All @@ -40,7 +40,7 @@ export default function CommentTree({
updateCommentCollapseState({
commentId: comment.comment_view.comment.id,
collapsed,
}),
})
);
}

Expand Down
6 changes: 3 additions & 3 deletions src/features/comment/Comments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export default function Comments({
const [comments, setComments] = useState<CommentView[]>([]);
const commentTree = useMemo(
() => (comments.length ? buildCommentsTree(comments, !!commentPath) : []),
[commentPath, comments],
[commentPath, comments]
);
const client = useClient();
const [isListAtTop, setIsListAtTop] = useState<boolean>(true);
Expand Down Expand Up @@ -143,13 +143,13 @@ export default function Comments({
const newComments = pullAllBy(
response.comments,
existingComments,
"comment.id",
"comment.id"
);
if (!newComments.length) setFinishedPaging(true);

let potentialComments = uniqBy(
[...existingComments, ...newComments],
(c) => c.comment.id,
(c) => c.comment.id
);

// Filter context to a single comment chain (only show direct ancestors and children)
Expand Down
7 changes: 2 additions & 5 deletions src/features/comment/commentSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const commentSlice = createSlice({

updateCommentCollapseState: (
state,
action: PayloadAction<{ commentId: number; collapsed: boolean }>,
action: PayloadAction<{ commentId: number; collapsed: boolean }>
) => {
state.commentCollapsedById[action.payload.commentId] =
action.payload.collapsed;
Expand All @@ -39,10 +39,7 @@ export const commentSlice = createSlice({
},
updateCommentVote: (
state,
action: PayloadAction<{
commentId: number;
vote: -1 | 1 | 0 | undefined;
}>,
action: PayloadAction<{ commentId: number; vote: -1 | 1 | 0 | undefined }>
) => {
state.commentVotesById[action.payload.commentId] = action.payload.vote;
},
Expand Down
4 changes: 2 additions & 2 deletions src/features/comment/inFeed/FeedComment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ export default function FeedComment({ comment, className }: FeedCommentProps) {
buildGeneralBrowseLink(
`/c/${getHandle(comment.community)}/comments/${comment.post.id}/${
comment.comment.path
}`,
),
}`
)
)
}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/features/community/CommunitySummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default function CommunitySummary({ community }: CommunitySummaryProps) {
return (
<Container
routerLink={buildGeneralBrowseLink(
`/c/${getHandle(community.community)}`,
`/c/${getHandle(community.community)}`
)}
>
<Contents>
Expand Down
2 changes: 1 addition & 1 deletion src/features/community/MoreActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default function MoreActions({ community }: MoreActionsProps) {
});

const communityByHandle = useAppSelector(
(state) => state.community.communityByHandle,
(state) => state.community.communityByHandle
);

const { presentNewPost } = useContext(NewPostContext);
Expand Down
4 changes: 2 additions & 2 deletions src/features/community/communitySlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const communitySlice = createSlice({
},
recievedTrendingCommunities: (
state,
action: PayloadAction<CommunityView[]>,
action: PayloadAction<CommunityView[]>
) => {
state.trendingCommunities = action.payload;
},
Expand Down Expand Up @@ -78,7 +78,7 @@ export const followCommunity =
export const getTrendingCommunities =
() => async (dispatch: AppDispatch, getState: () => RootState) => {
const trendingCommunities = await clientSelector(
getState(),
getState()
)?.listCommunities({
type_: "All",
sort: "Hot",
Expand Down
2 changes: 1 addition & 1 deletion src/features/feed/CommunityFeed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface PostCommentFeed
export default function CommunityFeed({ ...rest }: PostCommentFeed) {
const renderItemContent = useCallback(
(community: CommunityView) => <CommunitySummary community={community} />,
[],
[]
);

return <Feed renderItemContent={renderItemContent} {...rest} />;
Expand Down
2 changes: 1 addition & 1 deletion src/features/feed/InboxFeed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ interface PostCommentFeed
export default function InboxFeed({ ...rest }: PostCommentFeed) {
const renderItemContent = useCallback(
(item: InboxItemView) => <InboxItem item={item} />,
[],
[]
);

return <Feed renderItemContent={renderItemContent} {...rest} />;
Expand Down
Loading

0 comments on commit cdc8b0e

Please sign in to comment.