[eslint] Add rules matching codebase style

This commit is contained in:
Alexis Sellier
2021-06-14 10:52:00 +02:00
parent 618d49e201
commit 50d2bc944f
3 changed files with 16 additions and 5 deletions
+11 -2
View File
@@ -23,8 +23,17 @@ module.exports = {
}
],
rules: {
indent: ["error", 2, { "SwitchCase": 1 }],
semi: "off", // We use the typescript-specific rule as it's more accurate.
"indent": ["error", 2, { "SwitchCase": 1 }],
"semi": "off", // We use the typescript-specific rule as it's more accurate.
"curly": ["error", "multi-line", "consistent"],
"keyword-spacing": ["error"],
"no-trailing-spaces": ["error"],
"space-before-function-paren": ["error", {
"anonymous": "always",
"named": "never",
"asyncArrow": "always",
}],
"eol-last": ["error"],
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/semi": ["error"],
"@typescript-eslint/member-delimiter-style": [
+2 -1
View File
@@ -5,8 +5,9 @@ export async function get(
params: Record<string, any>,
config: Config
): Promise<any> {
if (! config.seed.api)
if (! config.seed.api) {
throw new Error("Seed HTTP API unavailable");
}
const query: Record<string, string> = {};
for (const [key, val] of Object.entries(params)) {
+3 -2
View File
@@ -163,8 +163,9 @@ export const loadState = (initial: State): Store => {
case Connection.Connected:
// In case of locking Metamask the accountsChanged event returns undefined.
// To prevent out of sync state, the wallet gets disconnected.
if (address === undefined) disconnectWallet();
else {
if (address === undefined) {
disconnectWallet();
} else {
s.session.address = address;
window.localStorage.setItem("session", JSON.stringify({ address, tokenBalance: s.session.tokenBalance, tx: s.session.tx }));
}