web: (ESLint) Use dot notation. (#14557)

This commit is contained in:
Teffen Ellis
2025-05-19 19:33:52 +02:00
committed by GitHub
parent d97297e0ce
commit b72d0e84c9
30 changed files with 49 additions and 49 deletions

View File

@ -46,7 +46,7 @@ export class SystemStatusCard extends AdminStatusCard<SystemInfo> {
return; return;
} }
const outpost = outposts.results[0]; const outpost = outposts.results[0];
outpost.config["authentik_host"] = window.location.origin; outpost.config.authentik_host = window.location.origin;
await new OutpostsApi(DEFAULT_CONFIG).outpostsInstancesUpdate({ await new OutpostsApi(DEFAULT_CONFIG).outpostsInstancesUpdate({
uuid: outpost.pk, uuid: outpost.pk,
outpostRequest: outpost, outpostRequest: outpost,

View File

@ -9,9 +9,9 @@ describe("ak-admin-settings-footer-link", () => {
afterEach(async () => { afterEach(async () => {
await browser.execute(async () => { await browser.execute(async () => {
await document.body.querySelector("ak-admin-settings-footer-link")?.remove(); await document.body.querySelector("ak-admin-settings-footer-link")?.remove();
if (document.body["_$litPart$"]) { if (document.body._$litPart$) {
// @ts-expect-error expression of type '"_$litPart$"' is added by Lit // @ts-expect-error expression of type '"_$litPart$"' is added by Lit
await delete document.body["_$litPart$"]; await delete document.body._$litPart$;
} }
}); });
}); });

View File

@ -78,7 +78,7 @@ export class ApplicationForm extends WithCapabilitiesConfig(ModelForm<Applicatio
}); });
} }
if (this.can(CapabilitiesEnum.CanSaveMedia)) { if (this.can(CapabilitiesEnum.CanSaveMedia)) {
const icon = this.getFormFiles()["metaIcon"]; const icon = this.getFormFiles().metaIcon;
if (icon || this.clearIcon) { if (icon || this.clearIcon) {
await new CoreApi(DEFAULT_CONFIG).coreApplicationsSetIconCreate({ await new CoreApi(DEFAULT_CONFIG).coreApplicationsSetIconCreate({
slug: app.slug, slug: app.slug,

View File

@ -61,18 +61,18 @@ export class ApplicationWizardApplicationStep extends ApplicationWizardStep {
this.errors = new Map(); this.errors = new Map();
const values = trimMany(this.formValues ?? {}, ["metaLaunchUrl", "name", "slug"]); const values = trimMany(this.formValues ?? {}, ["metaLaunchUrl", "name", "slug"]);
if (values["name"] === "") { if (values.name === "") {
this.errors.set("name", msg("An application name is required")); this.errors.set("name", msg("An application name is required"));
} }
if ( if (
!( !(
isStr(values["metaLaunchUrl"]) && isStr(values.metaLaunchUrl) &&
(values["metaLaunchUrl"] === "" || URL.canParse(values["metaLaunchUrl"])) (values.metaLaunchUrl === "" || URL.canParse(values.metaLaunchUrl))
) )
) { ) {
this.errors.set("metaLaunchUrl", msg("Not a valid URL")); this.errors.set("metaLaunchUrl", msg("Not a valid URL"));
} }
if (!(isStr(values["slug"]) && values["slug"] !== "" && isSlug(values["slug"]))) { if (!(isStr(values.slug) && values.slug !== "" && isSlug(values.slug))) {
this.errors.set("slug", msg("Not a valid slug")); this.errors.set("slug", msg("Not a valid slug"));
} }
return this.errors.size === 0; return this.errors.size === 0;

View File

@ -75,7 +75,7 @@ export const CryptoCertificateSearch = () => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
const showMessage = (ev: CustomEvent<any>) => { const showMessage = (ev: CustomEvent<any>) => {
const detail = ev.detail; const detail = ev.detail;
delete detail["target"]; delete detail.target;
document.getElementById("message-pad")!.innerText = `Event: ${JSON.stringify( document.getElementById("message-pad")!.innerText = `Event: ${JSON.stringify(
detail, detail,
null, null,

View File

@ -57,7 +57,7 @@ export class FlowForm extends WithCapabilitiesConfig(ModelForm<Flow, string>) {
} }
if (this.can(CapabilitiesEnum.CanSaveMedia)) { if (this.can(CapabilitiesEnum.CanSaveMedia)) {
const icon = this.getFormFiles()["background"]; const icon = this.getFormFiles().background;
if (icon || this.clearBackground) { if (icon || this.clearBackground) {
await new FlowsApi(DEFAULT_CONFIG).flowsInstancesSetBackgroundCreate({ await new FlowsApi(DEFAULT_CONFIG).flowsInstancesSetBackgroundCreate({
slug: flow.slug, slug: flow.slug,

View File

@ -27,7 +27,7 @@ export class FlowImportForm extends Form<Flow> {
} }
async send(): Promise<FlowImportResult> { async send(): Promise<FlowImportResult> {
const file = this.getFormFiles()["flow"]; const file = this.getFormFiles().flow;
if (!file) { if (!file) {
throw new SentryIgnoredError("No form data"); throw new SentryIgnoredError("No form data");
} }

View File

@ -18,7 +18,7 @@ export class SAMLProviderImportForm extends Form<SAMLProvider> {
} }
async send(data: SAMLProvider): Promise<void> { async send(data: SAMLProvider): Promise<void> {
const file = this.getFormFiles()["metadata"]; const file = this.getFormFiles().metadata;
if (!file) { if (!file) {
throw new SentryIgnoredError("No form data"); throw new SentryIgnoredError("No form data");
} }

View File

@ -62,7 +62,7 @@ export class KerberosSourceForm extends WithCapabilitiesConfig(BaseSourceForm<Ke
} }
const c = await config(); const c = await config();
if (c.capabilities.includes(CapabilitiesEnum.CanSaveMedia)) { if (c.capabilities.includes(CapabilitiesEnum.CanSaveMedia)) {
const icon = this.getFormFiles()["icon"]; const icon = this.getFormFiles().icon;
if (icon || this.clearIcon) { if (icon || this.clearIcon) {
await new SourcesApi(DEFAULT_CONFIG).sourcesAllSetIconCreate({ await new SourcesApi(DEFAULT_CONFIG).sourcesAllSetIconCreate({
slug: source.slug, slug: source.slug,

View File

@ -87,7 +87,7 @@ export class OAuthSourceForm extends WithCapabilitiesConfig(BaseSourceForm<OAuth
} }
const c = await config(); const c = await config();
if (c.capabilities.includes(CapabilitiesEnum.CanSaveMedia)) { if (c.capabilities.includes(CapabilitiesEnum.CanSaveMedia)) {
const icon = this.getFormFiles()["icon"]; const icon = this.getFormFiles().icon;
if (icon || this.clearIcon) { if (icon || this.clearIcon) {
await new SourcesApi(DEFAULT_CONFIG).sourcesAllSetIconCreate({ await new SourcesApi(DEFAULT_CONFIG).sourcesAllSetIconCreate({
slug: source.slug, slug: source.slug,

View File

@ -75,7 +75,7 @@ export class PlexSourceForm extends WithCapabilitiesConfig(BaseSourceForm<PlexSo
}); });
} }
if (this.can(CapabilitiesEnum.CanSaveMedia)) { if (this.can(CapabilitiesEnum.CanSaveMedia)) {
const icon = this.getFormFiles()["icon"]; const icon = this.getFormFiles().icon;
if (icon || this.clearIcon) { if (icon || this.clearIcon) {
await new SourcesApi(DEFAULT_CONFIG).sourcesAllSetIconCreate({ await new SourcesApi(DEFAULT_CONFIG).sourcesAllSetIconCreate({
slug: source.slug, slug: source.slug,

View File

@ -63,7 +63,7 @@ export class SAMLSourceForm extends WithCapabilitiesConfig(BaseSourceForm<SAMLSo
} }
const c = await config(); const c = await config();
if (c.capabilities.includes(CapabilitiesEnum.CanSaveMedia)) { if (c.capabilities.includes(CapabilitiesEnum.CanSaveMedia)) {
const icon = this.getFormFiles()["icon"]; const icon = this.getFormFiles().icon;
if (icon || this.clearIcon) { if (icon || this.clearIcon) {
await new SourcesApi(DEFAULT_CONFIG).sourcesAllSetIconCreate({ await new SourcesApi(DEFAULT_CONFIG).sourcesAllSetIconCreate({
slug: source.slug, slug: source.slug,

View File

@ -65,9 +65,9 @@ describe("Select Table", () => {
await browser.execute(() => { await browser.execute(() => {
document.body.querySelector("ak-select-table")?.remove(); document.body.querySelector("ak-select-table")?.remove();
// @ts-expect-error expression of type '"_$litPart$"' is added by Lit // @ts-expect-error expression of type '"_$litPart$"' is added by Lit
if (document.body["_$litPart$"]) { if (document.body._$litPart$) {
// @ts-expect-error expression of type '"_$litPart$"' is added by Lit // @ts-expect-error expression of type '"_$litPart$"' is added by Lit
delete document.body["_$litPart$"]; delete document.body._$litPart$;
} }
}); });
}); });
@ -138,9 +138,9 @@ describe("Multiselect Table", () => {
await browser.execute(() => { await browser.execute(() => {
document.body.querySelector("ak-select-table")?.remove(); document.body.querySelector("ak-select-table")?.remove();
// @ts-expect-error expression of type '"_$litPart$"' is added by Lit // @ts-expect-error expression of type '"_$litPart$"' is added by Lit
if (document.body["_$litPart$"]) { if (document.body._$litPart$) {
// @ts-expect-error expression of type '"_$litPart$"' is added by Lit // @ts-expect-error expression of type '"_$litPart$"' is added by Lit
delete document.body["_$litPart$"]; delete document.body._$litPart$;
} }
}); });
}); });

View File

@ -40,9 +40,9 @@ describe("Simple Table", () => {
await browser.execute(() => { await browser.execute(() => {
document.body.querySelector("ak-simple-table")?.remove(); document.body.querySelector("ak-simple-table")?.remove();
// @ts-expect-error expression of type '"_$litPart$"' is added by Lit // @ts-expect-error expression of type '"_$litPart$"' is added by Lit
if (document.body["_$litPart$"]) { if (document.body._$litPart$) {
// @ts-expect-error expression of type '"_$litPart$"' is added by Lit // @ts-expect-error expression of type '"_$litPart$"' is added by Lit
delete document.body["_$litPart$"]; delete document.body._$litPart$;
} }
}); });
}); });

View File

@ -67,9 +67,9 @@ export class Portal extends LitElement implements IPortal {
this.setAttribute("data-ouia-component-type", "ak-portal"); this.setAttribute("data-ouia-component-type", "ak-portal");
this.setAttribute("data-ouia-component-id", this.getAttribute("id") || randomId()); this.setAttribute("data-ouia-component-id", this.getAttribute("id") || randomId());
this.dropdownContainer = document.createElement("div"); this.dropdownContainer = document.createElement("div");
this.dropdownContainer.dataset["managedBy"] = "ak-portal"; this.dropdownContainer.dataset.managedBy = "ak-portal";
if (this.name) { if (this.name) {
this.dropdownContainer.dataset["managedFor"] = this.name; this.dropdownContainer.dataset.managedFor = this.name;
} }
document.body.append(this.dropdownContainer); document.body.append(this.dropdownContainer);
if (!this.anchor) { if (!this.anchor) {

View File

@ -102,9 +102,9 @@ describe("Search select: Test Input Field", () => {
document.body.querySelector("#a-separate-component")?.remove(); document.body.querySelector("#a-separate-component")?.remove();
document.body.querySelector("ak-search-select-view")?.remove(); document.body.querySelector("ak-search-select-view")?.remove();
// @ts-expect-error expression of type '"_$litPart$"' is added by Lit // @ts-expect-error expression of type '"_$litPart$"' is added by Lit
if (document.body["_$litPart$"]) { if (document.body._$litPart$) {
// @ts-expect-error expression of type '"_$litPart$"' is added by Lit // @ts-expect-error expression of type '"_$litPart$"' is added by Lit
delete document.body["_$litPart$"]; delete document.body._$litPart$;
} }
}); });
}); });

View File

@ -107,9 +107,9 @@ describe("Search select: event driven startup", () => {
await browser.execute(() => { await browser.execute(() => {
document.body.querySelector("ak-mock-search-group")?.remove(); document.body.querySelector("ak-mock-search-group")?.remove();
// @ts-expect-error expression of type '"_$litPart$"' is added by Lit // @ts-expect-error expression of type '"_$litPart$"' is added by Lit
if (document.body["_$litPart$"]) { if (document.body._$litPart$) {
// @ts-expect-error expression of type '"_$litPart$"' is added by Lit // @ts-expect-error expression of type '"_$litPart$"' is added by Lit
delete document.body["_$litPart$"]; delete document.body._$litPart$;
} }
}); });
}); });

View File

@ -11,9 +11,9 @@ describe("ak-empty-state", () => {
afterEach(async () => { afterEach(async () => {
await browser.execute(async () => { await browser.execute(async () => {
await document.body.querySelector("ak-empty-state")?.remove(); await document.body.querySelector("ak-empty-state")?.remove();
if (document.body["_$litPart$"]) { if (document.body._$litPart$) {
// @ts-expect-error expression of type '"_$litPart$"' is added by Lit // @ts-expect-error expression of type '"_$litPart$"' is added by Lit
await delete document.body["_$litPart$"]; await delete document.body._$litPart$;
} }
}); });
}); });

View File

@ -10,9 +10,9 @@ describe("ak-expand", () => {
afterEach(async () => { afterEach(async () => {
await browser.execute(async () => { await browser.execute(async () => {
await document.body.querySelector("ak-expand")?.remove(); await document.body.querySelector("ak-expand")?.remove();
if (document.body["_$litPart$"]) { if (document.body._$litPart$) {
// @ts-expect-error expression of type '"_$litPart$"' is added by Lit // @ts-expect-error expression of type '"_$litPart$"' is added by Lit
await delete document.body["_$litPart$"]; await delete document.body._$litPart$;
} }
}); });
}); });

View File

@ -17,9 +17,9 @@ describe("ak-array-input", () => {
afterEach(async () => { afterEach(async () => {
await browser.execute(async () => { await browser.execute(async () => {
await document.body.querySelector("ak-array-input")?.remove(); await document.body.querySelector("ak-array-input")?.remove();
if (document.body["_$litPart$"]) { if (document.body._$litPart$) {
// @ts-expect-error expression of type '"_$litPart$"' is added by Lit // @ts-expect-error expression of type '"_$litPart$"' is added by Lit
await delete document.body["_$litPart$"]; await delete document.body._$litPart$;
} }
}); });
}); });

View File

@ -112,7 +112,7 @@ export class Wizard extends ModalButton {
const stepElement = document.createElement(step); const stepElement = document.createElement(step);
stepElement.slot = step; stepElement.slot = step;
stepElement.dataset["wizardmanaged"] = "true"; stepElement.dataset.wizardmanaged = "true";
this.appendChild(stepElement); this.appendChild(stepElement);
} }

View File

@ -47,7 +47,7 @@ export class OAuth2DeviceCode extends BaseStage<
label="${msg("Code")}" label="${msg("Code")}"
required required
class="pf-c-form__group" class="pf-c-form__group"
.errors=${(this.challenge?.responseErrors || {})["code"]} .errors=${(this.challenge?.responseErrors || {}).code}
> >
<input <input
type="text" type="text"

View File

@ -56,7 +56,7 @@ export class AuthenticatorEmailStage extends BaseStage<
label="${msg("Configure your email")}" label="${msg("Configure your email")}"
required required
class="pf-c-form__group" class="pf-c-form__group"
.errors=${(this.challenge?.responseErrors || {})["email"]} .errors=${(this.challenge?.responseErrors || {}).email}
> >
<input <input
type="email" type="email"
@ -109,7 +109,7 @@ export class AuthenticatorEmailStage extends BaseStage<
label="${msg("Code")}" label="${msg("Code")}"
required required
class="pf-c-form__group" class="pf-c-form__group"
.errors=${(this.challenge?.responseErrors || {})["code"]} .errors=${(this.challenge?.responseErrors || {}).code}
> >
<input <input
type="text" type="text"

View File

@ -56,7 +56,7 @@ export class AuthenticatorSMSStage extends BaseStage<
label="${msg("Phone number")}" label="${msg("Phone number")}"
required required
class="pf-c-form__group" class="pf-c-form__group"
.errors=${(this.challenge?.responseErrors || {})["phone_number"]} .errors=${(this.challenge?.responseErrors || {}).phone_number}
> >
<input <input
type="tel" type="tel"
@ -107,7 +107,7 @@ export class AuthenticatorSMSStage extends BaseStage<
label="${msg("Code")}" label="${msg("Code")}"
required required
class="pf-c-form__group" class="pf-c-form__group"
.errors=${(this.challenge?.responseErrors || {})["code"]} .errors=${(this.challenge?.responseErrors || {}).code}
> >
<input <input
type="text" type="text"

View File

@ -114,7 +114,7 @@ export class AuthenticatorTOTPStage extends BaseStage<
label="${msg("Code")}" label="${msg("Code")}"
required required
class="pf-c-form__group" class="pf-c-form__group"
.errors=${(this.challenge?.responseErrors || {})["code"]} .errors=${(this.challenge?.responseErrors || {}).code}
> >
<!-- @ts-ignore --> <!-- @ts-ignore -->
<input <input

View File

@ -87,7 +87,7 @@ export class AuthenticatorValidateStageWebCode extends BaseDeviceStage<
: msg("Authentication code")}" : msg("Authentication code")}"
required required
class="pf-c-form__group" class="pf-c-form__group"
.errors=${(this.challenge?.responseErrors || {})["code"]} .errors=${(this.challenge?.responseErrors || {}).code}
> >
<!-- @ts-ignore --> <!-- @ts-ignore -->
<input <input

View File

@ -155,7 +155,7 @@ export class WebAuthnAuthenticatorRegisterStage extends BaseStage<
</ak-empty-state> </ak-empty-state>
${this.challenge?.responseErrors ${this.challenge?.responseErrors
? html`<p class="pf-m-block"> ? html`<p class="pf-m-block">
${this.challenge.responseErrors["response"][0].string} ${this.challenge.responseErrors.response[0].string}
</p>` </p>`
: nothing} : nothing}
<div class="pf-c-form__group pf-m-action"> <div class="pf-c-form__group pf-m-action">

View File

@ -85,7 +85,7 @@ export class BaseStage<
if (!("non_field_errors" in errors)) { if (!("non_field_errors" in errors)) {
return nothing; return nothing;
} }
const nonFieldErrors = errors["non_field_errors"]; const nonFieldErrors = errors.non_field_errors;
if (!nonFieldErrors) { if (!nonFieldErrors) {
return nothing; return nothing;
} }

View File

@ -267,7 +267,7 @@ export class IdentificationStage extends BaseStage<
label=${label} label=${label}
required required
class="pf-c-form__group" class="pf-c-form__group"
.errors=${(this.challenge.responseErrors || {})["uid_field"]} .errors=${(this.challenge.responseErrors || {}).uid_field}
> >
<input <input
type=${type} type=${type}
@ -289,9 +289,9 @@ export class IdentificationStage extends BaseStage<
inputId="ak-stage-identification-password" inputId="ak-stage-identification-password"
required required
class="pf-c-form__group" class="pf-c-form__group"
.errors=${(this.challenge?.responseErrors || {})["password"]} .errors=${(this.challenge?.responseErrors || {}).password}
?allow-show-password=${this.challenge.allowShowPassword} ?allow-show-password=${this.challenge.allowShowPassword}
prefill=${PasswordManagerPrefill["password"] ?? ""} prefill=${PasswordManagerPrefill.password ?? ""}
></ak-flow-input-password> ></ak-flow-input-password>
` `
: nothing} : nothing}

View File

@ -67,10 +67,10 @@ export class PasswordStage extends BaseStage<PasswordChallenge, PasswordChalleng
required required
grab-focus grab-focus
class="pf-c-form__group" class="pf-c-form__group"
.errors=${(this.challenge?.responseErrors || {})["password"]} .errors=${(this.challenge?.responseErrors || {}).password}
?allow-show-password=${this.challenge.allowShowPassword} ?allow-show-password=${this.challenge.allowShowPassword}
invalid=${this.hasError("password").toString()} invalid=${this.hasError("password").toString()}
prefill=${PasswordManagerPrefill["password"] ?? ""} prefill=${PasswordManagerPrefill.password ?? ""}
></ak-flow-input-password> ></ak-flow-input-password>
${this.challenge.recoveryUrl ${this.challenge.recoveryUrl