Require === and !== comparisons

Signed-off-by: Rūdolfs Ošiņš <rudolfs@osins.org>
This commit is contained in:
Rūdolfs Ošiņš
2022-08-30 12:09:27 +02:00
committed by Alexis Sellier
parent 795d6c43f8
commit 94329d612f
18 changed files with 68 additions and 66 deletions
+1 -1
View File
@@ -146,7 +146,7 @@
</div>
{:else}
{#if line}
<div class="highlight" style="top: {line == 1 ? 1 : (1.5 * line) - 0.5}rem" />
<div class="highlight" style="top: {line === 1 ? 1 : (1.5 * line) - 0.5}rem" />
{/if}
<div class="line-numbers">
{#each lineNumbers as lineNumber}
+2 -2
View File
@@ -21,7 +21,7 @@ const defaultProps = {
};
describe('Logic', () => {
it("should show defaultBranch label and head commit if revision == head", () => {
it("should show defaultBranch label and head commit if revision === head", () => {
const { rerender } = render(BranchSelector, {
props: defaultProps,
});
@@ -112,7 +112,7 @@ describe('Logic', () => {
cy.get("div.hash.desktop").should("be.visible").should("have.text", "debf82ef3623ec11751a993bda85bac2ff1c6f00");
});
it("should show defaultBranch label if revision == head", () => {
it("should show defaultBranch label if revision === head", () => {
render(BranchSelector, {
props: {
...defaultProps,
+1 -1
View File
@@ -20,7 +20,7 @@
$: showSelector = branchList.length > 1;
$: head = project.head ?? branches[project.defaultBranch];
$: commit = getOid(revision, branches) || head;
$: if (commit == head) {
$: if (commit === head) {
branchLabel = project.defaultBranch;
} else if (branches[revision]) {
branchLabel = revision;
+4 -4
View File
@@ -33,7 +33,7 @@
let mobileFileTree = false;
const loadBlob = async (path: string): Promise<proj.Blob> => {
if (state.status == Status.Loaded && state.path === path) {
if (state.status === Status.Loaded && state.path === path) {
return state.blob;
}
@@ -78,7 +78,7 @@
};
$: getBlob = loadBlob(path);
$: loadingPath = state.status == Status.Loading ? state.path : null;
$: loadingPath = state.status === Status.Loading ? state.path : null;
</script>
<style>
@@ -185,12 +185,12 @@
{:catch}
<Placeholder icon="🍂">
<span slot="title">
{#if path != "/"}
{#if path !== "/"}
<div><code>{path}</code></div>
{/if}
</span>
<span slot="body">
{#if path == "/"}
{#if path === "/"}
The README could not be loaded.
{:else}
This path could not be loaded.
+3 -3
View File
@@ -130,14 +130,14 @@
</span>
<div
class="stat commit-count clickable widget"
class:active={content == ProjectContent.History}
class:active={content === ProjectContent.History}
on:click={() => toggleContent(ProjectContent.History, true)}>
<strong>{tree.stats.commits}</strong> commit(s)
</div>
{#if project.issues > 0}
<div
class="stat issue-count clickable widget"
class:active={content == ProjectContent.Issues}
class:active={content === ProjectContent.Issues}
on:click={() => toggleContent(ProjectContent.Issues, false)}>
<strong>{project.issues}</strong> issue(s)
</div>
@@ -149,7 +149,7 @@
{#if project.patches > 0}
<div
class="stat patch-count clickable widget"
class:active={content == ProjectContent.Patches}
class:active={content === ProjectContent.Patches}
on:click={() => toggleContent(ProjectContent.Patches, false)}>
<strong>{project.patches}</strong> patch(es)
</div>
+1 -1
View File
@@ -107,7 +107,7 @@
class="summary-state"
class:proposed={patch.state === "proposed"}
class:draft={patch.state === "draft"}
class:archived={patch.state == "archived"}>
class:archived={patch.state === "archived"}>
{capitalize(patch.state)}
</div>
</div>
+7 -7
View File
@@ -70,13 +70,13 @@
{:then { tree, commit }}
<Header {tree} {commit} {browserStore} {project} noAnchor />
{#if content == proj.ProjectContent.Tree}
{#if content === proj.ProjectContent.Tree}
<Browser {project} {commit} {tree} {browserStore} />
{:else if content == proj.ProjectContent.History}
{:else if content === proj.ProjectContent.History}
<Async fetch={fetchCommits(project, commit)} let:result>
<History {project} history={result} />
</Async>
{:else if content == proj.ProjectContent.Commit}
{:else if content === proj.ProjectContent.Commit}
<Async fetch={project.getCommit(commit)} let:result>
<Commit {project} commit={result} />
</Async>
@@ -91,19 +91,19 @@
</div>
{/await}
{#if content == proj.ProjectContent.Issues}
{#if content === proj.ProjectContent.Issues}
<Async fetch={issue.Issue.getIssues(project.urn, project.seed.api)} let:result>
<Issues {project} state={$browserStore.search?.get("state") || "open"} {config} issues={result} />
</Async>
{:else if content == proj.ProjectContent.Issue && $browserStore.issue}
{:else if content === proj.ProjectContent.Issue && $browserStore.issue}
<Async fetch={issue.Issue.getIssue(project.urn, $browserStore.issue, project.seed.api)} let:result>
<Issue {project} {config} issue={result} />
</Async>
{:else if content == proj.ProjectContent.Patches}
{:else if content === proj.ProjectContent.Patches}
<Async fetch={patch.Patch.getPatches(project.urn, project.seed.api)} let:result>
<Patches {project} {config} patches={result} />
</Async>
{:else if content == proj.ProjectContent.Patch && $browserStore.patch}
{:else if content === proj.ProjectContent.Patch && $browserStore.patch}
<Async fetch={patch.Patch.getPatch(project.urn, $browserStore.patch, project.seed.api)} let:result>
<Patch {project} {config} patch={result} />
</Async>