apps: Apply strict equality

This commit is contained in:
Jelle van der Waa 2026-10-15 13:37:58 +02:00 committed by Freya Gustavsson
parent 9401f45cce
commit 0efb25ead3
4 changed files with 12 additions and 12 deletions

View file

@ -211,7 +211,7 @@ export const ApplicationList = ({ metainfo_db, appProgress, appProgressTitle, ac
action={action} />);
}
const data_missing_msg = (dataPackagesInstalled == false && !refresh_progress)
const data_missing_msg = (dataPackagesInstalled === false && !refresh_progress)
? _("Application information is missing")
: null;
@ -234,7 +234,7 @@ export const ApplicationList = ({ metainfo_db, appProgress, appProgressTitle, ac
</FlexItem>
</Flex>
</PageSection>
{comps.length == 0
{comps.length === 0
? <EmptyStatePanel title={ _("No applications installed or available.") }
paragraph={data_missing_msg}
action={ data_missing_msg && _("Install application information")} onAction={refresh} />

View file

@ -62,7 +62,7 @@ export const Application = ({ metainfo_db, id, progress, action }) => {
function render_homepage_link(urls) {
return urls.map((url, index) => {
if (url.type == 'homepage') {
if (url.type === 'homepage') {
return (
<Button isInline variant="link" component='a' href={url.link}
key={"project-url-" + index}
@ -86,9 +86,9 @@ export const Application = ({ metainfo_db, id, progress, action }) => {
return <p>{_("No description provided.")}</p>;
return description.map((paragraph, index) => {
if (paragraph.tag == 'ul') {
if (paragraph.tag === 'ul') {
return <ul key={`paragraph-${index}`}>{paragraph.items.map(item => <li key={item}>{item}</li>)}</ul>;
} else if (paragraph.tag == 'ol') {
} else if (paragraph.tag === 'ol') {
return <ol key={`paragraph-${index}`}>{paragraph.items.map(item => <li key={item}>{item}</li>)}</ol>;
} else {
return <p key={`paragraph-${index}`}>{paragraph}</p>;

View file

@ -44,7 +44,7 @@ const App = () => {
action={action}
appProgress={progress}
appProgressTitle={progressTitle} />;
} else if (path.length == 1) {
} else if (path.length === 1) {
const id = path[0];
return <Application metainfo_db={metainfo_db}
action={action}

View file

@ -14,7 +14,7 @@ import { show_modal_dialog } from "cockpit-components-dialog.jsx";
const _ = cockpit.gettext;
export function debug(...args: unknown[]) {
if (window.debugging == "all" || window.debugging?.includes("apps")) {
if (window.debugging === "all" || window.debugging?.includes("apps")) {
console.debug("apps:", ...args);
}
}
@ -23,7 +23,7 @@ export function icon_url(path_or_url: string): string {
if (!path_or_url)
return "default.png";
if (path_or_url[0] != '/')
if (path_or_url[0] !== '/')
return path_or_url;
interface QueryObj {
@ -99,7 +99,7 @@ export class ProgressReporter {
const newPercentage = this.base + data.percentage / 100 * this.range;
// PackageKit with Apt backend reports wrong percentages https://github.com/PackageKit/PackageKit/issues/516
// Double check here that we have an increasing only progress value
if (this.percentage == undefined || newPercentage >= this.percentage)
if (this.percentage == null || newPercentage >= this.percentage)
this.percentage = newPercentage;
}
this.callback({ ...data, percentage: this.percentage });
@ -109,10 +109,10 @@ export class ProgressReporter {
// ex is a PackageKit error; requires typing pkg/lib/packagekit.js first
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const show_error = (ex: any) => {
if (ex.code == "cancelled")
if (ex.code === "cancelled")
return;
if (ex.code == "not-found")
if (ex.code === "not-found")
ex.detail = _("No installation package found for this application.");
show_modal_dialog(
@ -149,7 +149,7 @@ export interface Component {
export const launch = (comp: Component) => {
for (let i = 0; i < comp.launchables.length; i++) {
if (comp.launchables[i].type == "cockpit-manifest") {
if (comp.launchables[i].type === "cockpit-manifest") {
debug("launching", comp.launchables[i].name, "in component", JSON.stringify(comp));
cockpit.jump([comp.launchables[i].name]);
return;