Skip to content
This repository was archived by the owner on Jan 13, 2025. It is now read-only.

Commit 4766279

Browse files
committed
Migrate to TypeScript and add type definitions
1 parent cc1a5dc commit 4766279

File tree

8 files changed

+401
-330
lines changed

8 files changed

+401
-330
lines changed

.eslintrc.js

+12-14
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
module.exports = {
2-
extends: 'google',
3-
env: {
4-
node: true,
5-
mocha: true
6-
},
2+
root: true,
3+
parser: '@typescript-eslint/parser',
74
plugins: [
8-
'pabigot'
5+
'@typescript-eslint',
6+
],
7+
extends: [
8+
'eslint:recommended',
9+
'plugin:@typescript-eslint/recommended',
910
],
1011
rules: {
12+
'@typescript-eslint/no-explicit-any': 'off',
13+
'@typescript-eslint/explicit-module-boundary-types': 'off',
14+
'@typescript-eslint/no-unused-vars': 'off',
1115
'guard-for-in': 'off',
1216
'prefer-rest-params': 'off',
1317
'prefer-spread': 'off',
@@ -23,12 +27,6 @@ module.exports = {
2327
'no-irregular-whitespace': ['error', {skipComments: true}],
2428
'no-multi-spaces': ['error', {ignoreEOLComments: true}],
2529
'operator-linebreak': ['error', 'before'],
26-
'pabigot/affixed-ids': ['error', {
27-
allowedSuffixes: [
28-
'_dCel',
29-
'_ppt'
30-
]
31-
}],
3230
quotes: ['error', 'single', {
3331
avoidEscape: true,
3432
allowTemplateLiterals: true
@@ -40,6 +38,6 @@ module.exports = {
4038
yoda: ['error', 'always', {exceptRange: true}]
4139
},
4240
parserOptions: {
43-
sourceType: 'module'
41+
project: './tsconfig.json',
4442
}
45-
}
43+
};

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/CHANGELOG.html
22
/coverage/
33
/node_modules/
4+
/lib/

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Change Log
22

3+
## [3.0.0] - 2021-07-08
4+
5+
* **API** Renamed `const` function to [constant][doc:constant].
6+
* Migrate to TypeScript and make type definitions available from npm.
7+
38
## [2.0.0] - 2021-07-08
49

510
* Improve [browser compatibility][pr#28] by adding a browser polyfill

package.json

+16-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "buffer-layout",
3-
"version": "2.0.0",
3+
"version": "3.0.0",
44
"description": "Translation between JavaScript values and Buffers",
55
"keywords": [
66
"Buffer",
@@ -17,27 +17,34 @@
1717
"license": "MIT",
1818
"author": "Peter A. Bigot <[email protected]>",
1919
"main": "./lib/Layout.js",
20+
"types": "./lib/Layout.d.ts",
21+
"files": [
22+
"/lib"
23+
],
2024
"dependencies": {
2125
"buffer": "~6.0.3"
2226
},
2327
"devDependencies": {
28+
"@typescript-eslint/eslint-plugin": "^4.28.2",
29+
"@typescript-eslint/parser": "^4.28.2",
2430
"coveralls": "^3.0.0",
25-
"eslint": "~4.18.2",
26-
"eslint-config-google": "~0.9.1",
27-
"eslint-plugin-pabigot": "~1.1.0",
31+
"eslint": "~7.30.0",
2832
"istanbul": "~0.4.5",
2933
"jsdoc": "~3.5.5",
3034
"lodash": "~4.17.5",
31-
"mocha": "~5.0.4"
35+
"mocha": "~5.0.4",
36+
"typescript": "~4.3.5"
3237
},
3338
"engines": {
3439
"node": ">=5.10"
3540
},
3641
"scripts": {
37-
"coverage": "istanbul cover _mocha -- -u tdd",
38-
"coveralls": "istanbul cover _mocha --report lcovonly -- -u tdd && cat ./coverage/lcov.info | coveralls",
39-
"eslint": "eslint lib/ test/",
42+
"build": "tsc",
43+
"coverage": "npm run build && istanbul cover _mocha -- -u tdd",
44+
"coveralls": "npm run build && istanbul cover _mocha --report lcovonly -- -u tdd && cat ./coverage/lcov.info | coveralls",
45+
"eslint": "eslint src/ --ext .ts",
4046
"jsdoc": "jsdoc -c jsdoc/conf.json",
41-
"test": "mocha -u tdd"
47+
"prepare": "npm run build",
48+
"test": "npm run build && mocha -u tdd"
4249
}
4350
}

0 commit comments

Comments
 (0)