fix login linting

This commit is contained in:
Elio Bischof
2025-07-17 20:36:26 +02:00
parent a053ee802d
commit d1509af1cd
21 changed files with 40 additions and 52 deletions

View File

@@ -7,7 +7,10 @@ module.exports = {
"@next/next/no-img-element": "off", "@next/next/no-img-element": "off",
"react/no-unescaped-entities": "off", "react/no-unescaped-entities": "off",
"no-unused-vars": "off", "no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }], "@typescript-eslint/no-unused-vars": ["error", {
argsIgnorePattern: "^_" ,
varsIgnorePattern: "^_" ,
}],
"no-undef": "off", "no-undef": "off",
}, },
parserOptions: { parserOptions: {

View File

@@ -1,5 +1,5 @@
.next *
/external !constants
.github/ !src
dist/ !locales
standalone/ !scripts/healthcheck.js

View File

@@ -34,7 +34,8 @@ export default async function Page(props: {
const organization = searchParams?.organization; const organization = searchParams?.organization;
const postLogoutRedirectUri = searchParams?.post_logout_redirect_uri; const postLogoutRedirectUri = searchParams?.post_logout_redirect_uri;
const logoutHint = searchParams?.logout_hint; const logoutHint = searchParams?.logout_hint;
const UILocales = searchParams?.ui_locales; // TODO implement with new translation service // TODO implement with new translation service
// const UILocales = searchParams?.ui_locales;
const _headers = await headers(); const _headers = await headers();
const { serviceUrl } = getServiceUrlFromHeaders(_headers); const { serviceUrl } = getServiceUrlFromHeaders(_headers);

View File

@@ -1,8 +1,7 @@
import { DynamicTheme } from "@/components/dynamic-theme"; import { DynamicTheme } from "@/components/dynamic-theme";
import { Translated } from "@/components/translated"; import { Translated } from "@/components/translated";
import { getServiceUrlFromHeaders } from "@/lib/service-url"; import { getServiceUrlFromHeaders } from "@/lib/service-url";
import { getBrandingSettings, getDefaultOrg } from "@/lib/zitadel"; import { getBrandingSettings } from "@/lib/zitadel";
import { Organization } from "@zitadel/proto/zitadel/org/v2/org_pb";
import { headers } from "next/headers"; import { headers } from "next/headers";
export default async function Page(props: { searchParams: Promise<any> }) { export default async function Page(props: { searchParams: Promise<any> }) {
@@ -11,17 +10,7 @@ export default async function Page(props: { searchParams: Promise<any> }) {
const _headers = await headers(); const _headers = await headers();
const { serviceUrl } = getServiceUrlFromHeaders(_headers); const { serviceUrl } = getServiceUrlFromHeaders(_headers);
const { login_hint, organization } = searchParams; const { organization } = searchParams;
let defaultOrganization;
if (!organization) {
const org: Organization | null = await getDefaultOrg({
serviceUrl,
});
if (org) {
defaultOrganization = org.id;
}
}
const branding = await getBrandingSettings({ const branding = await getBrandingSettings({
serviceUrl, serviceUrl,

View File

@@ -30,12 +30,10 @@ export default async function Page(props: {
const { const {
loginName, // send from password page loginName, // send from password page
userId, // send from email link
requestId, requestId,
sessionId, sessionId,
organization, organization,
code, code,
submit,
} = searchParams; } = searchParams;
const { method } = params; const { method } = params;

View File

@@ -70,16 +70,18 @@ export default async function Page(props: {
await addOTPSMS({ await addOTPSMS({
serviceUrl, serviceUrl,
userId: session.factors.user.id, userId: session.factors.user.id,
}).catch((error) => { }).catch((_error) => {
error = new Error("Could not add OTP via SMS"); // TODO: Throw this error?
new Error("Could not add OTP via SMS");
}); });
} else if (method === "email") { } else if (method === "email") {
// works // works
await addOTPEmail({ await addOTPEmail({
serviceUrl, serviceUrl,
userId: session.factors.user.id, userId: session.factors.user.id,
}).catch((error) => { }).catch((_error) => {
error = new Error("Could not add OTP via Email"); // TODO: Throw this error?
new Error("Could not add OTP via Email");
}); });
} else { } else {
throw new Error("Invalid method"); throw new Error("Invalid method");

View File

@@ -17,7 +17,7 @@ export default async function Page(props: {
searchParams: Promise<Record<string | number | symbol, string | undefined>>; searchParams: Promise<Record<string | number | symbol, string | undefined>>;
}) { }) {
const searchParams = await props.searchParams; const searchParams = await props.searchParams;
let { loginName, organization, requestId, alt } = searchParams; let { loginName, organization, requestId } = searchParams;
const _headers = await headers(); const _headers = await headers();
const { serviceUrl } = getServiceUrlFromHeaders(_headers); const { serviceUrl } = getServiceUrlFromHeaders(_headers);

View File

@@ -13,7 +13,7 @@ export default async function Page(props: { searchParams: Promise<any> }) {
const _headers = await headers(); const _headers = await headers();
const { serviceUrl } = getServiceUrlFromHeaders(_headers); const { serviceUrl } = getServiceUrlFromHeaders(_headers);
const { loginName, requestId, organization, userId } = searchParams; const { loginName, organization, userId } = searchParams;
const branding = await getBrandingSettings({ const branding = await getBrandingSettings({
serviceUrl, serviceUrl,

View File

@@ -17,7 +17,7 @@ export enum AlertType {
const yellow = const yellow =
"border-yellow-600/40 dark:border-yellow-500/20 bg-yellow-200/30 text-yellow-600 dark:bg-yellow-700/20 dark:text-yellow-200"; "border-yellow-600/40 dark:border-yellow-500/20 bg-yellow-200/30 text-yellow-600 dark:bg-yellow-700/20 dark:text-yellow-200";
const red = // const red =
"border-red-600/40 dark:border-red-500/20 bg-red-200/30 text-red-600 dark:bg-red-700/20 dark:text-red-200"; "border-red-600/40 dark:border-red-500/20 bg-red-200/30 text-red-600 dark:bg-red-700/20 dark:text-red-200";
const neutral = const neutral =
"border-divider-light dark:border-divider-dark bg-black/5 text-gray-600 dark:bg-white/10 dark:text-gray-200"; "border-divider-light dark:border-divider-dark bg-black/5 text-gray-600 dark:bg-white/10 dark:text-gray-200";

View File

@@ -43,7 +43,7 @@ export function AuthenticationMethodRadio({
} boder-divider-light relative flex h-full flex-1 cursor-pointer rounded-lg border px-5 py-4 hover:shadow-lg focus:outline-none dark:border-divider-dark dark:hover:bg-white/10` } boder-divider-light relative flex h-full flex-1 cursor-pointer rounded-lg border px-5 py-4 hover:shadow-lg focus:outline-none dark:border-divider-dark dark:hover:bg-white/10`
} }
> >
{({ active, checked }) => ( {({ checked }) => (
<> <>
<div className="flex w-full flex-col items-center text-sm"> <div className="flex w-full flex-col items-center text-sm">
{method === "passkey" && ( {method === "passkey" && (

View File

@@ -55,7 +55,7 @@ export function LanguageSwitcher() {
"transition duration-100 ease-in data-[leave]:data-[closed]:opacity-0", "transition duration-100 ease-in data-[leave]:data-[closed]:opacity-0",
)} )}
> >
{LANGS.map((lang, index) => ( {LANGS.map((lang) => (
<ListboxOption <ListboxOption
key={lang.code} key={lang.code}
value={lang} value={lang}

View File

@@ -1,6 +1,6 @@
import Link from "next/link"; import Link from "next/link";
export function SelfServiceMenu({ sessionId }: { sessionId: string }) { export function SelfServiceMenu() {
const list: any[] = []; const list: any[] = [];
// if (!!config.selfservice.change_password.enabled) { // if (!!config.selfservice.change_password.enabled) {

View File

@@ -21,7 +21,7 @@ export function SessionClearItem({
const currentLocale = useLocale(); const currentLocale = useLocale();
moment.locale(currentLocale === "zh" ? "zh-cn" : currentLocale); moment.locale(currentLocale === "zh" ? "zh-cn" : currentLocale);
const [loading, setLoading] = useState<boolean>(false); const [_loading, setLoading] = useState<boolean>(false);
async function clearSessionId(id: string) { async function clearSessionId(id: string) {
setLoading(true); setLoading(true);
@@ -41,9 +41,10 @@ export function SessionClearItem({
const { valid, verifiedAt } = isSessionValid(session); const { valid, verifiedAt } = isSessionValid(session);
const [error, setError] = useState<string | null>(null); const [_error, setError] = useState<string | null>(null);
const router = useRouter(); // TODO: To we have to call this?
useRouter();
return ( return (
<button <button

View File

@@ -41,7 +41,7 @@ export function SessionItem({
const currentLocale = useLocale(); const currentLocale = useLocale();
moment.locale(currentLocale === "zh" ? "zh-cn" : currentLocale); moment.locale(currentLocale === "zh" ? "zh-cn" : currentLocale);
const [loading, setLoading] = useState<boolean>(false); const [_loading, setLoading] = useState<boolean>(false);
async function clearSessionId(id: string) { async function clearSessionId(id: string) {
setLoading(true); setLoading(true);
@@ -61,7 +61,7 @@ export function SessionItem({
const { valid, verifiedAt } = isSessionValid(session); const { valid, verifiedAt } = isSessionValid(session);
const [error, setError] = useState<string | null>(null); const [_error, setError] = useState<string | null>(null);
const router = useRouter(); const router = useRouter();

View File

@@ -31,7 +31,6 @@ type Props = {
}; };
export function TotpRegister({ export function TotpRegister({
uri, uri,
secret,
loginName, loginName,
sessionId, sessionId,
requestId, requestId,

View File

@@ -2,7 +2,6 @@ import { useTranslations } from "next-intl";
export function Translated({ export function Translated({
i18nKey, i18nKey,
children,
namespace, namespace,
data, data,
...props ...props

View File

@@ -1,6 +1,6 @@
import { FC } from "react"; import { FC } from "react";
export const ZitadelLogoDark: FC = (props) => ( export const ZitadelLogoDark: FC = () => (
<svg <svg
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
fillRule="evenodd" fillRule="evenodd"

View File

@@ -1,6 +1,6 @@
import { FC } from "react"; import { FC } from "react";
export const ZitadelLogoLight: FC = (props) => ( export const ZitadelLogoLight: FC = () => (
<svg <svg
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
fillRule="evenodd" fillRule="evenodd"

View File

@@ -22,8 +22,6 @@
"dev": "pnpm exec turbo run dev --no-cache --continue", "dev": "pnpm exec turbo run dev --no-cache --continue",
"dev:local": "pnpm test:acceptance:setup", "dev:local": "pnpm test:acceptance:setup",
"dev:console": "pnpm exec turbo run start --filter=console", "dev:console": "pnpm exec turbo run start --filter=console",
"lint": "pnpm exec turbo run lint",
"lint:fix": "pnpm exec turbo run lint:fix",
"clean": "pnpm exec turbo run clean && rm -rf node_modules", "clean": "pnpm exec turbo run clean && rm -rf node_modules",
"format:fix": "pnpm exec prettier --write \"**/*.{ts,tsx,md}\"", "format:fix": "pnpm exec prettier --write \"**/*.{ts,tsx,md}\"",
"format": "pnpm exec prettier --check \"**/*.{ts,tsx,md}\"", "format": "pnpm exec prettier --check \"**/*.{ts,tsx,md}\"",

View File

@@ -12,8 +12,6 @@ module.exports = {
sourceType: "module", sourceType: "module",
}, },
rules: { rules: {
"@typescript-eslint/no-unused-vars": ["error", { "@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }]
"argsIgnorePattern": "^_"
}]
} }
}; };