瀏覽代碼

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
vanilla_orig
David Luzar 5 年之前
父節點
當前提交
b7a6ceba68
No account linked to committer's email address
共有 3 個文件被更改,包括 9 次插入11 次删除
  1. 1
    1
      .lintstagedrc.js
  2. 7
    7
      package.json
  3. 1
    3
      src/clipboard.ts

+ 1
- 1
.lintstagedrc.js 查看文件

@@ -7,7 +7,7 @@ const cli = new CLIEngine({});
7 7
 module.exports = {
8 8
   "*.{js,ts,tsx}": files => {
9 9
     return (
10
-      "eslint --fix " + files.filter(file => !cli.isPathIgnored(file)).join(" ")
10
+      "eslint --max-warnings=0 --fix " + files.filter(file => !cli.isPathIgnored(file)).join(" ")
11 11
     );
12 12
   },
13 13
   "*.{css,scss,json,md,html,yml}": ["prettier --write"],

+ 7
- 7
package.json 查看文件

@@ -39,9 +39,9 @@
39 39
       "prettier"
40 40
     ],
41 41
     "rules": {
42
-      "curly": "error",
42
+      "curly": "warn",
43 43
       "no-console": [
44
-        "error",
44
+        "warn",
45 45
         {
46 46
           "allow": [
47 47
             "warn",
@@ -50,16 +50,16 @@
50 50
           ]
51 51
         }
52 52
       ],
53
-      "no-else-return": "error",
54
-      "no-useless-return": "error",
53
+      "no-else-return": "warn",
54
+      "no-useless-return": "warn",
55 55
       "prefer-const": [
56
-        "error",
56
+        "warn",
57 57
         {
58 58
           "destructuring": "all"
59 59
         }
60 60
       ],
61
-      "prefer-template": "error",
62
-      "prettier/prettier": "error"
61
+      "prefer-template": "warn",
62
+      "prettier/prettier": "warn"
63 63
     }
64 64
   },
65 65
   "homepage": "https://excalidraw.com",

+ 1
- 3
src/clipboard.ts 查看文件

@@ -62,10 +62,8 @@ export function parseClipboardEvent(
62 62
     const text = e.clipboardData?.getData("text/plain").trim();
63 63
     if (text && !PREFER_APP_CLIPBOARD) {
64 64
       return { text };
65
-      // eslint-disable-next-line no-else-return
66
-    } else {
67
-      return getAppClipboard();
68 65
     }
66
+    return getAppClipboard();
69 67
   } catch (e) {}
70 68
 
71 69
   return {};

Loading…
取消
儲存