diff --git a/package.json b/package.json index 0c6daacd..85c05e5f 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "build:prod": "webpack --env COMMIT_HASH=$(git rev-parse --short HEAD) --mode=production", "clean": "pnpm rimraf dist", "dev": "node generate_translations.js && pnpm build:dev --watch", - "lint": "pnpm translations:generate && tsc --noEmit && eslint --report-unused-disable-directives && prettier --check \"src/**/*.{ts,tsx,js,mjs,css,scss}\"", + "lint": "pnpm translations:generate && tsc --noEmit && pnpm eslint --report-unused-disable-directives && pnpm prettier --check \"src/**/*.{ts,tsx,js,mjs,css,scss}\"", "prebuild:dev": "pnpm clean && node generate_translations.js", "prebuild:prod": "pnpm clean && node generate_translations.js", "prepare": "husky", diff --git a/src/shared/components/common/markdown-textarea.tsx b/src/shared/components/common/markdown-textarea.tsx index bbbda35f..3be18ff0 100644 --- a/src/shared/components/common/markdown-textarea.tsx +++ b/src/shared/components/common/markdown-textarea.tsx @@ -762,7 +762,9 @@ export class MarkdownTextArea extends Component< getSelectedText(): string { const { selectionStart: start, selectionEnd: end } = document.getElementById(this.id) as any; - return start !== end ? this.state.content?.substring(start, end) ?? "" : ""; + return start !== end + ? (this.state.content?.substring(start, end) ?? "") + : ""; } get isDisabled() { diff --git a/src/shared/components/community/community-link.tsx b/src/shared/components/community/community-link.tsx index 688cf73d..7fe66b0b 100644 --- a/src/shared/components/community/community-link.tsx +++ b/src/shared/components/community/community-link.tsx @@ -28,7 +28,7 @@ export class CommunityLink extends Component { const title = useApubName ? community.name - : community.title ?? community.name; + : (community.title ?? community.name); if (local) { link = `/c/${community.name}`; diff --git a/src/shared/components/community/community.tsx b/src/shared/components/community/community.tsx index 67a16618..d9ff4ea9 100644 --- a/src/shared/components/community/community.tsx +++ b/src/shared/components/community/community.tsx @@ -176,7 +176,7 @@ function getSortTypeFromQuery(type?: string): SortType { UserService.Instance.myUserInfo?.local_user_view.local_user .default_sort_type; - return type ? (type as SortType) : mySortType ?? "Active"; + return type ? (type as SortType) : (mySortType ?? "Active"); } type CommunityPathProps = { name: string }; diff --git a/src/shared/components/person/person-listing.tsx b/src/shared/components/person/person-listing.tsx index ee1c09a9..ae679a83 100644 --- a/src/shared/components/person/person-listing.tsx +++ b/src/shared/components/person/person-listing.tsx @@ -29,7 +29,9 @@ export class PersonListing extends Component { let link: string; let serverStr: string | undefined = undefined; - const name = useApubName ? person.name : person.display_name ?? person.name; + const name = useApubName + ? person.name + : (person.display_name ?? person.name); if (local) { link = `/u/${person.name}`; diff --git a/src/shared/components/person/profile.tsx b/src/shared/components/person/profile.tsx index fc1def65..8f103838 100644 --- a/src/shared/components/person/profile.tsx +++ b/src/shared/components/person/profile.tsx @@ -144,7 +144,7 @@ function getSortTypeFromQuery(sort?: string): SortType { function getViewFromProps(view?: string): PersonDetailsView { return view - ? PersonDetailsView[view] ?? PersonDetailsView.Overview + ? (PersonDetailsView[view] ?? PersonDetailsView.Overview) : PersonDetailsView.Overview; } diff --git a/src/shared/utils/app/build-comments-tree.ts b/src/shared/utils/app/build-comments-tree.ts index 2ff44e0b..52e174ae 100644 --- a/src/shared/utils/app/build-comments-tree.ts +++ b/src/shared/utils/app/build-comments-tree.ts @@ -9,7 +9,7 @@ export default function buildCommentsTree( const map = new Map(); const depthOffset = !parentComment ? 0 - : getDepthFromComment(comments[0].comment) ?? 0; + : (getDepthFromComment(comments[0].comment) ?? 0); for (const comment_view of comments) { const depthI = getDepthFromComment(comment_view.comment) ?? 0; diff --git a/src/shared/utils/browser/data-bs-theme.ts b/src/shared/utils/browser/data-bs-theme.ts index 7ae0b69b..bf8cb7dc 100644 --- a/src/shared/utils/browser/data-bs-theme.ts +++ b/src/shared/utils/browser/data-bs-theme.ts @@ -5,9 +5,9 @@ export default function dataBsTheme(siteResOrTheme?: GetSiteResponse | string) { const theme = typeof siteResOrTheme === "string" ? siteResOrTheme - : siteResOrTheme?.my_user?.local_user_view.local_user.theme ?? + : (siteResOrTheme?.my_user?.local_user_view.local_user.theme ?? siteResOrTheme?.site_view.local_site.default_theme ?? - "browser"; + "browser"); return (isDark() && theme === "browser") || [ diff --git a/src/shared/utils/env/get-internal-host.ts b/src/shared/utils/env/get-internal-host.ts index ee8fdbd3..9883cb59 100644 --- a/src/shared/utils/env/get-internal-host.ts +++ b/src/shared/utils/env/get-internal-host.ts @@ -3,6 +3,6 @@ import { testHost } from "../../config"; export default function getInternalHost() { return !isBrowser() - ? process.env.LEMMY_UI_LEMMY_INTERNAL_HOST ?? testHost + ? (process.env.LEMMY_UI_LEMMY_INTERNAL_HOST ?? testHost) : testHost; // used for local dev }