homarr-labs / homarr

Found non-null assertions JS-0339
Anti-pattern
Major
20 occurrences in this check
116
117                  event.preventDefault();
118                  handleValueRemove(
119                    multiSelectValues[multiSelectValues.length - 1]!,120                  );
121                }}
122              />
 58  const values = multiSelectValues.map((item) => (
 59    <IntegrationPill
 60      key={item}
 61      option={data.find((i) => i.id === item)!} 62      onRemove={() => handleValueRemove(item)}
 63    />
 64  ));
Forbidden non-null assertion
 8
 9export const zodUnionFromArray = <T extends z.ZodTypeAny>(
10  array: CouldBeReadonlyArray<T>,
11) => z.union([array[0]!, array[1]!, ...array.slice(2)]);
Forbidden non-null assertion
 8
 9export const zodUnionFromArray = <T extends z.ZodTypeAny>(
10  array: CouldBeReadonlyArray<T>,
11) => z.union([array[0]!, array[1]!, ...array.slice(2)]);
Forbidden non-null assertion
 4
 5export const zodEnumFromArray = <T extends string>(
 6  array: CouldBeReadonlyArray<T>,
 7) => z.enum([array[0]!, ...array.slice(1)]); 8
 9export const zodUnionFromArray = <T extends z.ZodTypeAny>(
10  array: CouldBeReadonlyArray<T>,
Forbidden non-null assertion
 6export default {
 7  schema: "./schema",
 8  driver: "better-sqlite",
 9  dbCredentials: { url: process.env.DB_URL! },10} satisfies Config;
26
27  return (
28    <Avatar {...commonProps}>
29      {currentSession.user.name!.substring(0, 2).toUpperCase()}30    </Avatar>
31  );
32};
20      <Avatar
21        {...commonProps}
22        src={currentSession.user.image}
23        alt={currentSession.user.name!}24      />
25    );
26
 91        xOffset: addedNode.x!,
 92        yOffset: addedNode.y!,
 93        width: addedNode.w!,
 94        height: addedNode.h!, 95      });
 96    },
 97    [moveItemToSection, section.id],
 90        sectionId: section.id,
 91        xOffset: addedNode.x!,
 92        yOffset: addedNode.y!,
 93        width: addedNode.w!, 94        height: addedNode.h!,
 95      });
 96    },
 89        itemId,
 90        sectionId: section.id,
 91        xOffset: addedNode.x!,
 92        yOffset: addedNode.y!, 93        width: addedNode.w!,
 94        height: addedNode.h!,
 95      });
 88      moveItemToSection({
 89        itemId,
 90        sectionId: section.id,
 91        xOffset: addedNode.x!, 92        yOffset: addedNode.y!,
 93        width: addedNode.w!,
 94        height: addedNode.h!,
 74        xOffset: changedNode.x!,
 75        yOffset: changedNode.y!,
 76        width: changedNode.w!,
 77        height: changedNode.h!, 78      });
 79    },
 80    [moveAndResizeItem],
 73        itemId,
 74        xOffset: changedNode.x!,
 75        yOffset: changedNode.y!,
 76        width: changedNode.w!, 77        height: changedNode.h!,
 78      });
 79    },
 72      moveAndResizeItem({
 73        itemId,
 74        xOffset: changedNode.x!,
 75        yOffset: changedNode.y!, 76        width: changedNode.w!,
 77        height: changedNode.h!,
 78      });
 71      // Updates the react-query state
 72      moveAndResizeItem({
 73        itemId,
 74        xOffset: changedNode.x!, 75        yOffset: changedNode.y!,
 76        width: changedNode.w!,
 77        height: changedNode.h!,
47      <Comp
48        options={state.options as never}
49        integrations={state.integrations.map(
50          (id) => integrationData.find((x) => x.id === id)!,51        )}
52      />
53      <Affix bottom={12} right={72}>
20  searchParams,
21}: NewIntegrationPageProps) {
22  const result = z
23    .enum([integrationKinds[0]!, ...integrationKinds.slice(1)])24    .safeParse(searchParams.kind);
25  if (!result.success) {
26    notFound();
129                      onConfirm: () => {
130                        form.setFieldValue(
131                          `secrets.${index}.value`,
132                          secretsMap.get(kind)!.value ?? "",133                        );
134                        res(true);
135                      },
112            {secretsKinds.map((kind, index) => (
113              <SecretCard
114                key={kind}
115                secret={secretsMap.get(kind)!}116                onCancel={() =>
117                  new Promise((res) => {
118                    // When nothing changed, just close the secret card