-
Notifications
You must be signed in to change notification settings - Fork 57
Add flow type annotations. #47
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
"use strict" | ||
|
||
module.exports = { | ||
// Have not used webpack so just copied proposed setup from | ||
// https://babeljs.io/docs/setup/#installation | ||
webpack: { | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.js$/, | ||
exclude: /node_modules/, | ||
loader: "babel-loader" | ||
} | ||
] | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"env": { | ||
"development": { | ||
"sourceMaps": "inline", | ||
"comments": false, | ||
"presets": [ | ||
[ | ||
"env", | ||
{ | ||
"targets": { | ||
"node": "current" | ||
} | ||
} | ||
], | ||
"flow-node" | ||
] | ||
}, | ||
"umd": { | ||
"comments": false, | ||
"presets": [ | ||
[ | ||
"env", | ||
{ | ||
"modules": false, | ||
"targets": { | ||
"browsers": "last 2 versions" | ||
} | ||
} | ||
], | ||
"flow-node" | ||
] | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[ignore] | ||
.*/node_modules/documentation/* | ||
|
||
[libs] | ||
|
||
[include] | ||
|
||
[options] | ||
suppress_comment= \\(.\\|\n\\)*\\@FlowIgnore |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,3 +35,4 @@ node_modules | |
|
||
dist | ||
docs | ||
lib |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"editor.formatOnSave": false, | ||
"json.format.enable": false | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ install: | |
- npm install | ||
|
||
test_script: | ||
- npm run build:node | ||
- npm run test:node | ||
|
||
build: off |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,19 +2,30 @@ | |
"name": "multihashes", | ||
"version": "0.4.13", | ||
"description": "multihash implementation", | ||
"main": "src/index.js", | ||
"main": "lib/index.js", | ||
"scripts": { | ||
"lint": "aegir lint", | ||
"lint": "lint-staged && npm run type-check", | ||
"test:browser": "aegir test --target browser", | ||
"test:node": "aegir test --target node", | ||
"build": "aegir build", | ||
"test": "aegir test", | ||
"type-check": "flow check", | ||
"build": "npm run build:node && BABEL_ENV=umd aegir build", | ||
"test": "npm run build:node && aegir test", | ||
"docs": "aegir docs", | ||
"release": "aegir release --docs", | ||
"release-minor": "aegir release --type minor --docs", | ||
"release-major": "aegir release --type major --docs", | ||
"coverage": "aegir coverage", | ||
"coverage-publish": "aegir coverage --provider coveralls" | ||
"coverage-publish": "aegir coverage --provider coveralls", | ||
"build:types": "flow-copy-source --verbose src lib", | ||
"build:lib": "babel --out-dir lib src", | ||
"build:node": "npm run build:types && npm run build:lib", | ||
"start": "flow-copy-source --watch --verbose src lib & babel --watch --out-dir lib src" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it be possible to also add the type checking to the npm start command? It would be nice to be warned if there are any type errors introduced. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In practice there should be impossible to introduce type errors as that would fail In CI and there for won’t be merged. Also given that initail run of type checking takes quite bit time I don’t think running that on start would be a good option. |
||
}, | ||
"lint-staged": { | ||
"*.js": [ | ||
"prettier --no-semi --write", | ||
"git add" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had bad experiences with a |
||
] | ||
}, | ||
"pre-commit": [ | ||
"lint", | ||
|
@@ -43,10 +54,21 @@ | |
}, | ||
"devDependencies": { | ||
"aegir": "^12.3.0", | ||
"babel-cli": "6.26.0", | ||
"babel-core": "6.26.0", | ||
"babel-loader": "7.1.2", | ||
"babel-preset-flow-node": "2.0.1", | ||
"buffer-equal": "1.0.0", | ||
"chai": "^4.1.2", | ||
"dirty-chai": "^2.0.1", | ||
"pre-commit": "^1.2.2" | ||
"flow-bin": "^0.66.0", | ||
"flow-copy-source": "^1.2.0", | ||
"lint-staged": "^6.0.0", | ||
"pre-commit": "^1.2.2", | ||
"prettier": "1.10.2", | ||
"rollup": "0.56.1", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why was There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wondered the same. I'm in the process of pushing an updated version of this PR. There I don't use the rollup module and it still seems to work. |
||
"rollup.config.flow": "1.0.0", | ||
"source-map-support": "0.5.3" | ||
}, | ||
"contributors": [ | ||
"Alan Shaw <[email protected]>", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this file is meant to be in this PR.