Skip to content

Commit

Permalink
feat: add type declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
shadowgate15 committed Dec 29, 2021
1 parent 48f4b16 commit 0ce7ab2
Show file tree
Hide file tree
Showing 6 changed files with 847 additions and 40 deletions.
38 changes: 35 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"codecov": "latest",
"cross-env": "latest",
"delay": "^5.0.0",
"dtslint": "^4.2.1",
"eslint": "latest",
"eslint-config-xo-lass": "latest",
"fixpack": "latest",
Expand All @@ -43,7 +44,8 @@
"node": ">= 12.11.0"
},
"files": [
"src"
"src",
"types/index.d.ts"
],
"homepage": "https://github.com/breejs/ts-worker",
"keywords": [
Expand All @@ -58,6 +60,9 @@
],
"license": "MIT",
"main": "src/index.js",
"peerDependencies": {
"bree": "7.x"
},
"publishConfig": {
"access": "public"
},
Expand All @@ -66,15 +71,18 @@
"url": "https://github.com/breejs/ts-worker"
},
"scripts": {
"ava": "cross-env NODE_ENV=test ava",
"coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov",
"dtslint": "cross-env NODE_ENV=test dtslint types",
"lint": "yarn run lint:js && yarn run lint:md",
"lint:js": "xo",
"lint:md": "remark . -qfo",
"prepare": "husky install",
"pretest": "yarn run lint",
"test": "cross-env NODE_ENV=test ava",
"test": "yarn run ava && yarn run dtslint",
"test-coverage": "cross-env NODE_ENV=test nyc yarn run test"
},
"types": "types",
"xo": {
"prettier": true,
"space": true,
Expand All @@ -84,6 +92,30 @@
"rules": {
"import/extensions": "off",
"unicorn/prefer-module": "off"
}
},
"overrides": [
{
"files": [
"*.ts"
],
"parserOptions": {
"project": [
"types/tsconfig.json"
]
}
},
{
"files": [
"types/tests.ts"
],
"rules": {
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-call": "off"
}
}
],
"parser": "@typescript-eslint/parser"
}
}
7 changes: 7 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Definitions by: Taylor Schley <https://github.com/shadowgate15>

import { PluginFunc } from 'bree';

export = plugin;

declare const plugin: PluginFunc;
4 changes: 4 additions & 0 deletions types/tests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import * as Bree from 'bree';
import { plugin } from '@breejs/ts-worker';

Bree.extend(plugin, {});
19 changes: 19 additions & 0 deletions types/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es6"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"baseUrl": "../",
"paths": {
"bree": ["."]
},
"moduleResolution": "node"
},
"include": ["src"]
}
7 changes: 7 additions & 0 deletions types/tslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "dtslint/dtslint.json",
"rule": {
"semicolon": true,
"indent": [true, "spaces", 2]
}
}
Loading

0 comments on commit 0ce7ab2

Please sign in to comment.