diff --git a/.eslintrc.json b/.eslintrc.json index 9ebfebe8f..e42070b60 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -109,7 +109,9 @@ "no-const-assign": "error", // Require let or const instead of var. // https://eslint.org/docs/rules/no-var - "no-var": "error" + "no-var": "error", + // Require `===` and `!==` comparisons. + "eqeqeq": "error" }, "settings": { "svelte3/typescript": true diff --git a/src/App.svelte b/src/App.svelte index a8a3a47c1..f7b9640e0 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -36,7 +36,7 @@ function handleKeydown(event: KeyboardEvent) { if (event.key === 'Enter') { const elems = document.querySelectorAll('button.primary'); - if (elems.length == 1) { // We only allow this when there's one primary button. + if (elems.length === 1) { // We only allow this when there's one primary button. elems[0].click(); } } diff --git a/src/Header.svelte b/src/Header.svelte index eb6467afb..abbbe5204 100644 --- a/src/Header.svelte +++ b/src/Header.svelte @@ -185,9 +185,9 @@
- {#if config && config.network.name == 'rinkeby'} + {#if config && config.network.name === 'rinkeby'} Rinkeby - {:else if config && config.network.name == 'homestead'} + {:else if config && config.network.name === 'homestead'} {:else} No Network diff --git a/src/base/faucet/Index.svelte b/src/base/faucet/Index.svelte index f14277fee..49d5f7c46 100644 --- a/src/base/faucet/Index.svelte +++ b/src/base/faucet/Index.svelte @@ -98,7 +98,7 @@
- {#if config.network.name == "homestead"} + {#if config.network.name === "homestead"}
To get RAD tokens on {config.network.name}, please check the known exchanges. diff --git a/src/base/orgs/Org.ts b/src/base/orgs/Org.ts index 2b0d9cfa7..b350ce3cb 100644 --- a/src/base/orgs/Org.ts +++ b/src/base/orgs/Org.ts @@ -268,7 +268,7 @@ export class Org { static async getMulti(ids: string[], config: Config): Promise> { const results = await Promise.all(ids.map(addr => Org.get(addr, config))); - const orgs = results.filter((org): org is Org => org != null); + const orgs = results.filter((org): org is Org => org !== null); return orgs; } diff --git a/src/base/orgs/TransferOwnership.svelte b/src/base/orgs/TransferOwnership.svelte index 1141caf1e..fe33a318d 100644 --- a/src/base/orgs/TransferOwnership.svelte +++ b/src/base/orgs/TransferOwnership.svelte @@ -108,24 +108,24 @@
{:else} - +
🔑
Transfer ownership
- {#if state == State.Signing} + {#if state === State.Signing} Please confirm the transaction in your wallet. - {:else if state == State.Pending} + {:else if state === State.Pending} Waiting for transaction to be processed... - {:else if state == State.Proposing && org} + {:else if state === State.Proposing && org} Proposal is being submitted to the safe {formatAddress(org.owner)}, please sign the transaction in your wallet. - {:else if state == State.Idle} + {:else if state === State.Idle} Transfer the ownership of Org {formatAddress(org.address)} to a new address. - {:else if state == State.Failed} + {:else if state === State.Failed}
{error}
@@ -133,25 +133,25 @@
- {#if state == State.Idle} + {#if state === State.Idle} - {:else if state == State.Pending || state == State.Proposing || state == State.Signing} + {:else if state === State.Pending || state === State.Proposing || state === State.Signing} - {:else if state == State.Failed} + {:else if state === State.Failed} {/if}
- {#if state == State.Signing} + {#if state === State.Signing} - {:else if state == State.Pending} + {:else if state === State.Pending} - {:else if state == State.Failed} + {:else if state === State.Failed} diff --git a/src/base/profiles/AnchorActions.svelte b/src/base/profiles/AnchorActions.svelte index 9bf3a3a29..03ec73d21 100644 --- a/src/base/profiles/AnchorActions.svelte +++ b/src/base/profiles/AnchorActions.svelte @@ -148,39 +148,39 @@ - {#if state == State.Confirm} + {#if state === State.Confirm} Initiate the transaction... - {:else if state == State.Signing} + {:else if state === State.Signing} Sign the transaction in your wallet... - {:else if state == State.Submitting} + {:else if state === State.Submitting} Transaction is being confirmed... - {:else if state == State.Success} + {:else if state === State.Success} Transaction confirmed. - {:else if state == State.Failed} + {:else if state === State.Failed} Transaction failed {/if} - {#if state == State.Confirm} + {#if state === State.Confirm}
Project
{anchor.id}
Hash
{anchor.anchor.stateHash}
- {:else if state == State.Failed} + {:else if state === State.Failed}
{error}
{/if}
- {#if state == State.Confirm} + {#if state === State.Confirm} - {:else if state == State.Success || state == State.Failed} + {:else if state === State.Success || state === State.Failed} - {:else if state == State.Success || state == State.Failed} + {:else if state === State.Success || state === State.Failed}
{:else} {#if line} -
+
{/if}
{#each lineNumbers as lineNumber} diff --git a/src/base/projects/BranchSelector.spec.ts b/src/base/projects/BranchSelector.spec.ts index 7a835c9d8..e2686444c 100644 --- a/src/base/projects/BranchSelector.spec.ts +++ b/src/base/projects/BranchSelector.spec.ts @@ -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, diff --git a/src/base/projects/BranchSelector.svelte b/src/base/projects/BranchSelector.svelte index 084ee5110..62923025e 100644 --- a/src/base/projects/BranchSelector.svelte +++ b/src/base/projects/BranchSelector.svelte @@ -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; diff --git a/src/base/projects/Browser.svelte b/src/base/projects/Browser.svelte index 38e961b7e..496c525a3 100644 --- a/src/base/projects/Browser.svelte +++ b/src/base/projects/Browser.svelte @@ -33,7 +33,7 @@ let mobileFileTree = false; const loadBlob = async (path: string): Promise => { - 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;