Fixing lint.

This commit is contained in:
Dessalines 2024-07-15 10:00:39 -04:00
parent 81506e1d2f
commit 15e1bd6703
9 changed files with 14 additions and 10 deletions

View file

@ -10,7 +10,7 @@
"build:prod": "webpack --env COMMIT_HASH=$(git rev-parse --short HEAD) --mode=production", "build:prod": "webpack --env COMMIT_HASH=$(git rev-parse --short HEAD) --mode=production",
"clean": "pnpm rimraf dist", "clean": "pnpm rimraf dist",
"dev": "node generate_translations.js && pnpm build:dev --watch", "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:dev": "pnpm clean && node generate_translations.js",
"prebuild:prod": "pnpm clean && node generate_translations.js", "prebuild:prod": "pnpm clean && node generate_translations.js",
"prepare": "husky", "prepare": "husky",

View file

@ -762,7 +762,9 @@ export class MarkdownTextArea extends Component<
getSelectedText(): string { getSelectedText(): string {
const { selectionStart: start, selectionEnd: end } = const { selectionStart: start, selectionEnd: end } =
document.getElementById(this.id) as any; 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() { get isDisabled() {

View file

@ -28,7 +28,7 @@ export class CommunityLink extends Component<CommunityLinkProps, any> {
const title = useApubName const title = useApubName
? community.name ? community.name
: community.title ?? community.name; : (community.title ?? community.name);
if (local) { if (local) {
link = `/c/${community.name}`; link = `/c/${community.name}`;

View file

@ -176,7 +176,7 @@ function getSortTypeFromQuery(type?: string): SortType {
UserService.Instance.myUserInfo?.local_user_view.local_user UserService.Instance.myUserInfo?.local_user_view.local_user
.default_sort_type; .default_sort_type;
return type ? (type as SortType) : mySortType ?? "Active"; return type ? (type as SortType) : (mySortType ?? "Active");
} }
type CommunityPathProps = { name: string }; type CommunityPathProps = { name: string };

View file

@ -29,7 +29,9 @@ export class PersonListing extends Component<PersonListingProps, any> {
let link: string; let link: string;
let serverStr: string | undefined = undefined; 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) { if (local) {
link = `/u/${person.name}`; link = `/u/${person.name}`;

View file

@ -144,7 +144,7 @@ function getSortTypeFromQuery(sort?: string): SortType {
function getViewFromProps(view?: string): PersonDetailsView { function getViewFromProps(view?: string): PersonDetailsView {
return view return view
? PersonDetailsView[view] ?? PersonDetailsView.Overview ? (PersonDetailsView[view] ?? PersonDetailsView.Overview)
: PersonDetailsView.Overview; : PersonDetailsView.Overview;
} }

View file

@ -9,7 +9,7 @@ export default function buildCommentsTree(
const map = new Map<number, CommentNodeI>(); const map = new Map<number, CommentNodeI>();
const depthOffset = !parentComment const depthOffset = !parentComment
? 0 ? 0
: getDepthFromComment(comments[0].comment) ?? 0; : (getDepthFromComment(comments[0].comment) ?? 0);
for (const comment_view of comments) { for (const comment_view of comments) {
const depthI = getDepthFromComment(comment_view.comment) ?? 0; const depthI = getDepthFromComment(comment_view.comment) ?? 0;

View file

@ -5,9 +5,9 @@ export default function dataBsTheme(siteResOrTheme?: GetSiteResponse | string) {
const theme = const theme =
typeof siteResOrTheme === "string" typeof siteResOrTheme === "string"
? siteResOrTheme ? 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 ?? siteResOrTheme?.site_view.local_site.default_theme ??
"browser"; "browser");
return (isDark() && theme === "browser") || return (isDark() && theme === "browser") ||
[ [

View file

@ -3,6 +3,6 @@ import { testHost } from "../../config";
export default function getInternalHost() { export default function getInternalHost() {
return !isBrowser() return !isBrowser()
? process.env.LEMMY_UI_LEMMY_INTERNAL_HOST ?? testHost ? (process.env.LEMMY_UI_LEMMY_INTERNAL_HOST ?? testHost)
: testHost; // used for local dev : testHost; // used for local dev
} }