-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #77 from ChainSafe/typescript
Refactor to use Typescript
- Loading branch information
Showing
27 changed files
with
458 additions
and
277 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// from https://dev.to/itmayziii/typescript-eslint-and-standardjs-5hmd | ||
module.exports = { | ||
'parser': '@typescript-eslint/parser', | ||
'parserOptions': { | ||
'project': './tsconfig.json', // Required to have rules that rely on Types. | ||
'tsconfigRootDir': './' | ||
}, | ||
'extends': [ | ||
'plugin:@typescript-eslint/recommended', // Out of the box Typescript rules | ||
'standard' // Out of the box StandardJS rules | ||
], | ||
'plugins': [ | ||
'@typescript-eslint' // Let's us override rules below. | ||
], | ||
'rules': { | ||
'@typescript-eslint/member-delimiter-style': ['error', { // Prevents us from using any delimiter for interface properties. | ||
'multiline': { | ||
'delimiter': 'none', | ||
'requireLast': false | ||
}, | ||
'singleline': { | ||
'delimiter': 'comma', | ||
'requireLast': false | ||
} | ||
}], | ||
'@typescript-eslint/indent': 'off', // This is the job of StandardJS, they are competing rules so we turn off the Typescript one. | ||
'node/no-unsupported-features/es-syntax': 'off', // Allows us to use Import and Export keywords. | ||
'@typescript-eslint/no-non-null-assertion': 'off', | ||
'no-mixed-operators': 'off' | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"name": "libp2p-gossipsub", | ||
"version": "0.4.2", | ||
"description": "A javascript implementation of gossipsub", | ||
"description": "A typescript implementation of gossipsub", | ||
"leadMaintainer": "Cayman Nava <[email protected]>", | ||
"main": "src/index.js", | ||
"files": [ | ||
|
@@ -10,9 +10,11 @@ | |
], | ||
"types": "src/index.d.ts", | ||
"scripts": { | ||
"lint": "aegir lint", | ||
"lint": "eslint --ext .ts ts", | ||
"release": "aegir release", | ||
"prebuild": "tsc", | ||
"build": "aegir build", | ||
"pretest": "tsc", | ||
"test": "aegir test", | ||
"test:node": "aegir test --target node", | ||
"test:browser": "aegir test --target browser" | ||
|
@@ -41,27 +43,36 @@ | |
"it-pipe": "^1.0.1", | ||
"libp2p-pubsub": "^0.5.0", | ||
"p-map": "^4.0.0", | ||
"peer-id": "~0.13.3", | ||
"peer-id": "~0.13.12", | ||
"protons": "^1.0.1", | ||
"time-cache": "^0.3.0" | ||
}, | ||
"devDependencies": { | ||
"@types/chai": "^4.2.3", | ||
"@types/mocha": "^7.0.2", | ||
"@typescript-eslint/eslint-plugin": "^3.0.2", | ||
"@typescript-eslint/parser": "^3.0.2", | ||
"aegir": "^21.10.2", | ||
"benchmark": "^2.1.4", | ||
"chai": "^4.2.0", | ||
"chai-spies": "^1.0.0", | ||
"detect-node": "^2.0.4", | ||
"dirty-chai": "^2.0.1", | ||
"eslint": "^7.1.0", | ||
"eslint-config-standard": "^14.1.1", | ||
"eslint-plugin-import": "^2.20.2", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-promise": "^4.2.1", | ||
"eslint-plugin-standard": "^4.0.1", | ||
"it-pair": "^1.0.0", | ||
"libp2p-floodsub": "^0.21.0", | ||
"lodash": "^4.17.15", | ||
"mocha": "^7.1.1", | ||
"p-times": "^2.1.0", | ||
"p-wait-for": "^3.1.0", | ||
"promisify-es6": "^1.0.3", | ||
"sinon": "^9.0.2" | ||
"sinon": "^9.0.2", | ||
"typescript": "^3.9.3" | ||
}, | ||
"contributors": [ | ||
"Cayman <[email protected]>", | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
'use strict' | ||
|
||
const second = exports.second = 1000 | ||
const minute = exports.minute = 60 * second | ||
|
||
// Protocol identifiers | ||
export const FloodSubID = '/floodsub/1.0.0' | ||
export const GossipsubID = '/meshsub/1.0.0' | ||
|
||
// Overlay parameters | ||
export const GossipsubD = 6 | ||
export const GossipsubDlo = 4 | ||
export const GossipsubDhi = 12 | ||
|
||
// Gossip parameters | ||
export const GossipsubHistoryLength = 5 | ||
export const GossipsubHistoryGossip = 3 | ||
|
||
// Heartbeat interval | ||
export const GossipsubHeartbeatInitialDelay = 100 / second | ||
export const GossipsubHeartbeatInterval = second | ||
|
||
// Fanout ttl | ||
export const GossipsubFanoutTTL = minute |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.