Quellcode durchsuchen

fix eslint and typescript import

Shawn Lu vor 1 Jahr
Ursprung
Commit
dd05287b3b
6 geänderte Dateien mit 15 neuen und 918 gelöschten Zeilen
  1. 1 0
      .eslintrc.json
  2. 1 4
      __tests__/main.test.ts
  3. 6 6
      package.json
  4. 2 7
      src/main.ts
  5. 4 0
      tsconfig.json
  6. 1 901
      yarn.lock

+ 1 - 0
.eslintrc.json

@@ -38,6 +38,7 @@
     "@typescript-eslint/no-inferrable-types": 0,
     "@typescript-eslint/no-unused-vars": 2,
     "@typescript-eslint/no-var-requires": 0,
+    "@typescript-eslint/no-explicit-any": 0,
     // disable error for unused vars
     "no-unused-vars": 0
   }

+ 1 - 4
__tests__/main.test.ts

@@ -29,10 +29,7 @@ describe('greeter function', () => {
   // Assert if setTimeout was called properly
   it('delays the greeting by 2 seconds', () => {
     expect(setTimeout).toHaveBeenCalledTimes(1)
-    expect(setTimeout).toHaveBeenLastCalledWith(
-      expect.any(Function),
-      Delays.Long,
-    )
+    expect(setTimeout).toHaveBeenLastCalledWith(expect.any(Function), Delays.Long)
   })
 
   // Assert greeter result

+ 6 - 6
package.json

@@ -20,16 +20,16 @@
     "rimraf": "~5.0",
     "ts-api-utils": "~1.0",
     "ts-jest": "~29.1",
-    "typescript": "~5.3"
+    "tsc-alias": "1.8.8",
+    "typescript": "~5.1.0"
   },
   "scripts": {
     "prestart": "npm run build",
     "start": "node build/src/main.js",
     "clean": "rimraf coverage build tmp",
-    "prebuild": "npm run lint",
-    "build": "tsc -p tsconfig.json",
-    "build:watch": "tsc -w -p tsconfig.json",
-    "build:release": "npm run clean && tsc -p tsconfig.release.json",
+    "build": "tsc -p tsconfig.json && tsc-alias",
+    "build:watch": "tsc -w -p tsconfig.json && tsc-alias",
+    "build:release": "npm run clean && tsc -p tsconfig.release.json && tsc-alias",
     "lint": "eslint . --ext .ts --ext .mts",
     "test": "jest --coverage",
     "prettier": "prettier --config .prettierrc --write .",
@@ -37,7 +37,7 @@
   },
   "license": "Apache-2.0",
   "dependencies": {
-    "tslib": "~2.6"
+    "tslib": "~2.6.2"
   },
   "volta": {
     "node": "18.12.1"

+ 2 - 7
src/main.ts

@@ -14,13 +14,8 @@ export enum Delays {
  * @param {number=} [delay=Delays.Medium] - A number of milliseconds to delay resolution of the Promise.
  * @returns {Promise<string>}
  */
-function delayedHello(
-  name: string,
-  delay: number = Delays.Medium,
-): Promise<string> {
-  return new Promise((resolve: (value?: string) => void) =>
-    setTimeout(() => resolve(`Hello, ${name}`), delay),
-  )
+function delayedHello(name: string, delay: number = Delays.Medium): Promise<string> {
+  return new Promise((resolve: (value?: string) => void) => setTimeout(() => resolve(`Hello, ${name}`), delay))
 }
 
 // Please see the comment in the .eslintrc.json file about the suppressed rule!

+ 4 - 0
tsconfig.json

@@ -22,5 +22,9 @@
     "resolveJsonModule": true,
     "skipLibCheck": true
   },
+  "tsc-alias": {
+    "resolveFullPaths": true,
+    "verbose": false
+  },
   "include": ["src/**/*", "__tests__/**/*"]
 }

Datei-Diff unterdrückt, da er zu groß ist
+ 1 - 901
yarn.lock


Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden.