diff --git a/web3.js/.eslintrc.js b/web3.js/.eslintrc.js index ae1e91e10..5d99ed31c 100644 --- a/web3.js/.eslintrc.js +++ b/web3.js/.eslintrc.js @@ -8,12 +8,14 @@ module.exports = { 'eslint:recommended', 'plugin:import/errors', 'plugin:import/warnings', + 'plugin:flowtype/recommended', ], parser: 'babel-eslint', parserOptions: { sourceType: 'module', ecmaVersion: 8, }, + plugins: ['flowtype'], rules: { 'no-trailing-spaces': ['error'], 'import/first': ['error'], @@ -45,6 +47,7 @@ module.exports = { ], 'require-await': ['error'], semi: ['error', 'always'], + 'flowtype/generic-spacing': [0], }, // Used to lint the TypeScript type declaration file diff --git a/web3.js/package-lock.json b/web3.js/package-lock.json index 2a7680949..fc1ddeeb7 100644 --- a/web3.js/package-lock.json +++ b/web3.js/package-lock.json @@ -9550,6 +9550,15 @@ "pkg-dir": "^2.0.0" } }, + "eslint-plugin-flowtype": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-flowtype/-/eslint-plugin-flowtype-4.6.0.tgz", + "integrity": "sha512-W5hLjpFfZyZsXfo5anlu7HM970JBDqbEshAJUkeczP6BFCIfJXuiIBQXyberLRtOStT0OGPF8efeTbxlHk4LpQ==", + "dev": true, + "requires": { + "lodash": "^4.17.15" + } + }, "eslint-plugin-import": { "version": "2.20.1", "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.20.1.tgz", diff --git a/web3.js/package.json b/web3.js/package.json index 896aa2fae..0444c0bc1 100644 --- a/web3.js/package.json +++ b/web3.js/package.json @@ -107,6 +107,7 @@ "esdoc-standard-plugin": "^1.0.0", "eslint": "6.8.0", "eslint-config-prettier": "^6.0.0", + "eslint-plugin-flowtype": "^4.6.0", "eslint-plugin-import": "2.20.1", "eslint-plugin-jest": "22.19.0", "eslint-plugin-prettier": "^3.0.0", diff --git a/web3.js/test/__mocks__/rpc-websockets.js b/web3.js/test/__mocks__/rpc-websockets.js index 51cb342dd..801cffffd 100644 --- a/web3.js/test/__mocks__/rpc-websockets.js +++ b/web3.js/test/__mocks__/rpc-websockets.js @@ -1,3 +1,5 @@ +// @flow + import {Client as RpcWebSocketClient} from 'rpc-websockets'; // Define TEST_LIVE in the environment to test against the real full node