Skip to content

Commit

Permalink
chore(platform): Added strict null check
Browse files Browse the repository at this point in the history
  • Loading branch information
rajdip-b committed Sep 5, 2024
1 parent 7e12b47 commit 072254f
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function SecretPage(): React.JSX.Element {
collapsible
type="single"
>
{allSecrets?.map((secret) => {
{allSecrets.map((secret) => {
return (
<AccordionItem
className="rounded-xl bg-white/5 px-5"
Expand Down
2 changes: 1 addition & 1 deletion apps/platform/src/app/(main)/project/[project]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function DetailedProjectPage({
return (
<main className="flex flex-col gap-4">
<div className="flex justify-between ">
<div className="text-3xl">{currentProject?.name}</div>
<div className="text-3xl">{currentProject.name}</div>
<Dialog>
<DialogTrigger>
<Button>
Expand Down
6 changes: 3 additions & 3 deletions apps/platform/src/app/auth/invite/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default function AuthDetailsPage(): React.JSX.Element {
const inputRef = useRef<HTMLInputElement>(null)

useEffect(() => {
inputRef.current?.focus()
inputRef.current.focus()
}, [])

return (
Expand Down Expand Up @@ -38,12 +38,12 @@ export default function AuthDetailsPage(): React.JSX.Element {
<div
className={`${NunitoSansFont.className} flex h-[10vh] cursor-text flex-col items-start gap-1 rounded-md border border-white/10 bg-neutral-800 px-3 py-2 text-sm`}
onClick={() => {
inputRef.current?.focus()
inputRef.current.focus()
}}
onKeyDown={(e) => {
// Enter or space key
if (e.key === 'Enter' || e.key === ' ') {
inputRef.current?.focus()
inputRef.current.focus()
}
}}
role="button"
Expand Down
2 changes: 1 addition & 1 deletion apps/platform/src/components/shared/navbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ async function fetchNameImage(): Promise<UserNameImage | undefined> {
throw new Error('Invalid data')
}
return {
name: data.name?.split(' ')[0] ?? data.email.split('@')[0],
name: data.name.split(' ')[0] ?? data.email.split('@')[0],
image: data.profilePictureUrl
}
} catch (error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,7 @@ function SidebarTab({
* @returns The background color for the tab.
*/
const isCurrentActive = (tabName: string): boolean => {
if (
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- This is necessary
currentPath !== null &&
currentPath.split('/')[1] === tabName.toLowerCase()
) {
if (currentPath.split('/')[1] === tabName.toLowerCase()) {
return true
}
return false
Expand Down
2 changes: 1 addition & 1 deletion apps/platform/src/components/ui/line-tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function LineTab({ customID, tabs }: LineTabsProps): React.JSX.Element {
customID={customID}
key={tab}
searchParams={searchParams}
selected={search?.toLocaleLowerCase() === tab.toLocaleLowerCase()}
selected={search.toLocaleLowerCase() === tab.toLocaleLowerCase()}
text={tab}
/>
))}
Expand Down
2 changes: 1 addition & 1 deletion apps/platform/src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ try {
if (error instanceof z.ZodError) {
const { fieldErrors } = error.flatten()
const errorMessage = Object.entries(fieldErrors)
.map(([field, errors]) => `${field}: ${errors?.join(', ')}`)
.map(([field, errors]) => `${field}: ${errors.join(', ')}`)
.join('\n ')
throw new Error(
`Missing environment variables: \n ${errorMessage}\n Please check your .env file.`
Expand Down
2 changes: 1 addition & 1 deletion apps/platform/src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export function middleware(req: NextRequest): NextResponse {
const cookieStore = cookies()

const token = cookieStore.has('token')
const isOnboardingFinished = cookieStore.get('isOnboardingFinished')?.value
const isOnboardingFinished = cookieStore.get('isOnboardingFinished').value

const currentPath = req.nextUrl.pathname

Expand Down
5 changes: 3 additions & 2 deletions apps/platform/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
"paths": {
"@/*": ["./src/*"],
"@public/*": ["./public/*"]
}
},
"strictNullChecks": true
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}
}

0 comments on commit 072254f

Please sign in to comment.