From 824a69fde2b5a7bbe9970bf3618b91e1332fb259 Mon Sep 17 00:00:00 2001 From: Nodari Chkuaselidze Date: Tue, 19 Sep 2023 14:56:59 +0400 Subject: [PATCH] pkg: add type defs for type lints. --- .github/workflows/build.yml | 5 ++++- package-lock.json | 9 ++++++++- package.json | 4 +++- tsconfig.json | 31 +++++++++++++++++++++++++++++++ 4 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 tsconfig.json diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 67fede4..6fd02cd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,7 +16,7 @@ jobs: node-version: 20.x - name: Install tools - run: npm install --location=global bslint + run: npm install --location=global bslint typescript - name: Install dependencies run: npm install @@ -24,6 +24,9 @@ jobs: - name: Lint run: npm run lint + - name: Lint types + run: npm run lint-types + test: name: Test runs-on: ${{ matrix.os }} diff --git a/package-lock.json b/package-lock.json index 628d6be..cc9af75 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,8 @@ "version": "0.1.5", "license": "MIT", "devDependencies": { - "bmocha": "^2.1.8" + "bmocha": "^2.1.8", + "bts-type-deps": "^0.0.3" }, "engines": { "node": ">=8.0.0" @@ -27,6 +28,12 @@ "engines": { "node": ">=8.0.0" } + }, + "node_modules/bts-type-deps": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/bts-type-deps/-/bts-type-deps-0.0.3.tgz", + "integrity": "sha512-OQHGWhX5amae6Vj6ShlGaQu0sNCICgJ5YspNZPRzfR5RobrD+wjm5vkZK/J3EH5b/ymxqSWo9VkiFNpCxjaG2Q==", + "dev": true } } } diff --git a/package.json b/package.json index 159e087..fe46bce 100644 --- a/package.json +++ b/package.json @@ -16,10 +16,12 @@ "main": "./lib/btcp.js", "scripts": { "lint": "eslint lib/ test/", + "lint-types": "tsc -p .", "test": "bmocha --reporter spec test/*-test.js" }, "devDependencies": { - "bmocha": "^2.1.8" + "bmocha": "^2.1.8", + "bts-type-deps": "^0.0.3" }, "engines": { "node": ">=8.0.0" diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..da7a94b --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,31 @@ +{ + "include": [ + "lib/**/*.js" + ], + "compilerOptions": { + "rootDir": ".", + "target": "ES2020", + "lib": [ + "ES2020" + ], + + "noEmit": true, + + "allowJs": true, + "checkJs": true, + "maxNodeModuleJsDepth": 10, + + "module": "commonjs", + "moduleResolution": "node", + "resolveJsonModule": true, + + "stripInternal": true, + "noImplicitThis": true, + "noUnusedLocals": true, + "noUnusedParameters": false, + + "typeRoots": [ + "node_modules/bts-type-deps/types" + ] + } +}