浏览代码

lint: add explicit function return type rule (no implicit any / missing return type)

sschmid 4 年之前
父节点
当前提交
c6767c433d
共有 2 个文件被更改,包括 3 次插入2 次删除
  1. 1 0
      .eslintrc.js
  2. 2 2
      src/OpenSheetMusicDisplay/AJAX.ts

+ 1 - 0
.eslintrc.js

@@ -30,6 +30,7 @@ module.exports = {
     ],
     "rules": {
         "@typescript-eslint/dot-notation": "error",
+        "@typescript-eslint/explicit-function-return-type": "error",
         "@typescript-eslint/explicit-member-accessibility": [
             "off",
             {

+ 2 - 2
src/OpenSheetMusicDisplay/AJAX.ts

@@ -20,7 +20,7 @@ export class AJAX {
         }
         xhttp.timeout = timeout;
         return new Promise((resolve: (value: string) => void, reject: (error: any) => void) => {
-            xhttp.onreadystatechange = () => {
+            xhttp.onreadystatechange = (): void => {
                 if (xhttp.readyState === XMLHttpRequest.DONE) {
                     if (xhttp.status === 200) {
                         resolve(xhttp.responseText);
@@ -32,7 +32,7 @@ export class AJAX {
                     }
                 }
             };
-            xhttp.ontimeout = (e) => {
+            xhttp.ontimeout = (e): void => {
                 // For IE and node
                 reject(new Error("Server request Timeout"));
             };