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",
"react/no-unescaped-entities": "off",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
"@typescript-eslint/no-unused-vars": ["error", {
argsIgnorePattern: "^_" ,
varsIgnorePattern: "^_" ,
}],
"no-undef": "off",
},
parserOptions: {

View File

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

View File

@@ -1,14 +1,14 @@
const url = process.argv[2];
if (!url) {
console.error("❌ No URL provided as command line argument.");
process.exit(1);
console.error("❌ No URL provided as command line argument.");
process.exit(1);
}
try {
const res = await fetch(url);
if (!res.ok) process.exit(1);
process.exit(0);
const res = await fetch(url);
if (!res.ok) process.exit(1);
process.exit(0);
} catch (e) {
process.exit(1);
process.exit(1);
}

View File

@@ -34,7 +34,8 @@ export default async function Page(props: {
const organization = searchParams?.organization;
const postLogoutRedirectUri = searchParams?.post_logout_redirect_uri;
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 { serviceUrl } = getServiceUrlFromHeaders(_headers);

View File

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

View File

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

View File

@@ -70,16 +70,18 @@ export default async function Page(props: {
await addOTPSMS({
serviceUrl,
userId: session.factors.user.id,
}).catch((error) => {
error = new Error("Could not add OTP via SMS");
}).catch((_error) => {
// TODO: Throw this error?
new Error("Could not add OTP via SMS");
});
} else if (method === "email") {
// works
await addOTPEmail({
serviceUrl,
userId: session.factors.user.id,
}).catch((error) => {
error = new Error("Could not add OTP via Email");
}).catch((_error) => {
// TODO: Throw this error?
new Error("Could not add OTP via Email");
});
} else {
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>>;
}) {
const searchParams = await props.searchParams;
let { loginName, organization, requestId, alt } = searchParams;
let { loginName, organization, requestId } = searchParams;
const _headers = await 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 { serviceUrl } = getServiceUrlFromHeaders(_headers);
const { loginName, requestId, organization, userId } = searchParams;
const { loginName, organization, userId } = searchParams;
const branding = await getBrandingSettings({
serviceUrl,

View File

@@ -17,7 +17,7 @@ export enum AlertType {
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";
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";
const neutral =
"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`
}
>
{({ active, checked }) => (
{({ checked }) => (
<>
<div className="flex w-full flex-col items-center text-sm">
{method === "passkey" && (

View File

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

View File

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

View File

@@ -21,7 +21,7 @@ export function SessionClearItem({
const currentLocale = useLocale();
moment.locale(currentLocale === "zh" ? "zh-cn" : currentLocale);
const [loading, setLoading] = useState<boolean>(false);
const [_loading, setLoading] = useState<boolean>(false);
async function clearSessionId(id: string) {
setLoading(true);
@@ -41,9 +41,10 @@ export function SessionClearItem({
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 (
<button

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -22,8 +22,6 @@
"dev": "pnpm exec turbo run dev --no-cache --continue",
"dev:local": "pnpm test:acceptance:setup",
"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",
"format:fix": "pnpm exec prettier --write \"**/*.{ts,tsx,md}\"",
"format": "pnpm exec prettier --check \"**/*.{ts,tsx,md}\"",

View File

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