Skip to content
This repository has been archived by the owner on Dec 28, 2018. It is now read-only.

[Proof of Concept]: Introduce Flowtype #811

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# https://flowtype.org/docs/advanced-configuration
[include]

[ignore]
# Generate dirs.
<PROJECT_ROOT>/__dist/.*
<PROJECT_ROOT>/__obj/.*
<PROJECT_ROOT>/__test_cache/.*

#

[libs]

[options]
module.system=node
module.system.node.resolve_dirname=node_modules

munge_underscores=true

suppress_comment= \\(.\\|\n\\)*\\$FlowFixMe

[version]
^0.33.0
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"build_development": "cross-env NODE_ENV=development npm run build",
"build": "gulp build",
"test": "gulp test",
"gulp": "gulp"
"gulp": "gulp",
"flow": "flow"
},
"keywords": [
"browser",
Expand Down Expand Up @@ -77,8 +78,11 @@
"autoprefixer": "^6.5.0",
"babel-cli": "^6.16.0",
"babel-core": "^6.17.0",
"babel-eslint": "^7.0.0",
"babel-loader": "^6.2.5",
"babel-plugin-syntax-flow": "^6.13.0",
"babel-plugin-transform-es2015-modules-commonjs": "^6.16.0",
"babel-plugin-transform-flow-strip-types": "^6.14.0",
"babel-plugin-transform-inline-environment-variables": "^6.8.0",
"babel-plugin-transform-node-env-inline": "^6.8.0",
"babel-plugin-transform-react-constant-elements": "^6.9.1",
Expand All @@ -92,6 +96,7 @@
"eslint": "^3.7.0",
"eslint-plugin-node": "^2.1.2",
"eslint-plugin-react": "^6.3.0",
"flow-bin": "^0.33.0",
"font-awesome": "^4.6.3",
"glob": "^7.1.0",
"gulp": "^3.9.1",
Expand Down
5 changes: 1 addition & 4 deletions src/server/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,10 @@
// ESLint Configuration Files enables to include comments.
// http://eslint.org/docs/configuring/#comments-in-configuration-files
module.exports = {
'parser': 'babel-eslint',

'parserOptions': {
'ecmaVersion': 8,
'sourceType': 'module',
'ecmaFeatures': {
'jsx': true
},
},

'settings': {
Expand Down
20 changes: 15 additions & 5 deletions src/server/models/Hostmask.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,23 @@
* THE SOFTWARE.
*/

// @flow

type Args = {
nick: string,
username: string,
hostname: string,
string: string,
}

export class Hostmask {

/**
* @constructor
* @param {?} attr
*/
constructor(attr) {
nick: string;
username: string;
hostname: string;
string: string;

constructor(attr: Args) {
const data = Object.assign({
nick: '',
username: '',
Expand Down
4 changes: 4 additions & 0 deletions tools/build/babelrc_for_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ module.exports = {
// for React
'syntax-jsx',
'transform-react-jsx',

// for flowtype
'plugin-syntax-flow',
'plugin-transform-flow-strip-types',
],

'env': {
Expand Down