From b7a6ceba68529a1bc3c21b753dae65a73463f76e Mon Sep 17 00:00:00 2001 From: David Luzar Date: Wed, 5 Feb 2020 17:41:14 +0100 Subject: [PATCH] Eslint tweaks (#696) * make eslint styleguide into warnings & drop no-else-return * reintroduce max-warnings=0 * remove unnecessary eslint line disable * reintroduce no-else-return rule --- .lintstagedrc.js | 2 +- package.json | 14 +++++++------- src/clipboard.ts | 4 +--- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/.lintstagedrc.js b/.lintstagedrc.js index 06fb1d16..9de68ddf 100644 --- a/.lintstagedrc.js +++ b/.lintstagedrc.js @@ -7,7 +7,7 @@ const cli = new CLIEngine({}); module.exports = { "*.{js,ts,tsx}": files => { return ( - "eslint --fix " + files.filter(file => !cli.isPathIgnored(file)).join(" ") + "eslint --max-warnings=0 --fix " + files.filter(file => !cli.isPathIgnored(file)).join(" ") ); }, "*.{css,scss,json,md,html,yml}": ["prettier --write"], diff --git a/package.json b/package.json index aaeb46eb..882c3fc4 100644 --- a/package.json +++ b/package.json @@ -39,9 +39,9 @@ "prettier" ], "rules": { - "curly": "error", + "curly": "warn", "no-console": [ - "error", + "warn", { "allow": [ "warn", @@ -50,16 +50,16 @@ ] } ], - "no-else-return": "error", - "no-useless-return": "error", + "no-else-return": "warn", + "no-useless-return": "warn", "prefer-const": [ - "error", + "warn", { "destructuring": "all" } ], - "prefer-template": "error", - "prettier/prettier": "error" + "prefer-template": "warn", + "prettier/prettier": "warn" } }, "homepage": "https://excalidraw.com", diff --git a/src/clipboard.ts b/src/clipboard.ts index 372f123e..3bb50930 100644 --- a/src/clipboard.ts +++ b/src/clipboard.ts @@ -62,10 +62,8 @@ export function parseClipboardEvent( const text = e.clipboardData?.getData("text/plain").trim(); if (text && !PREFER_APP_CLIPBOARD) { return { text }; - // eslint-disable-next-line no-else-return - } else { - return getAppClipboard(); } + return getAppClipboard(); } catch (e) {} return {};