ajoute le support pour flow

pull/239/head
Johan Girod 2018-05-15 12:39:53 +02:00
parent 782e78363f
commit 835e5ae4f3
6 changed files with 392 additions and 1061 deletions

View File

@ -13,6 +13,7 @@ parser: babel-eslint
plugins:
- react
- flowtype
env:
browser: true
commonjs: true
@ -25,8 +26,10 @@ overrides:
extends:
- eslint:recommended
- plugin:flowtype/recommended
- plugin:react/recommended
- prettier
- prettier/flowtype
- prettier/react
parserOptions:
ecmaFeatures:

21
.flowconfig Normal file
View File

@ -0,0 +1,21 @@
[ignore]
<PROJECT_ROOT>/documentation/.*
<PROJECT_ROOT>/node_modules/.*
[include]
[libs]
[options]
esproposal.class_static_fields=enable
esproposal.class_instance_fields=enable
suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FixMe
suppress_type=$FlowExpectedError
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy

1
.gitignore vendored
View File

@ -5,3 +5,4 @@ dist/
.DS_Store
package-lock.json
yarn-error.log
flow-typed

View File

@ -6,12 +6,9 @@
"url": "git@github.com:betagouv/syso.git"
},
"engines": {
"node": ">=8.10.0"
"node": ">=8.10.0 <10.0.0"
},
"browserslist": [
"> 1% in FR",
"not ie < 11"
],
"browserslist": ["> 1% in FR", "not ie < 11"],
"dependencies": {
"@babel/core": "=7.0.0-beta.46",
"@babel/plugin-proposal-decorators": "=7.0.0-beta.46",
@ -29,7 +26,6 @@
"babel-plugin-transform-decorators": "^6.24.1",
"babel-plugin-transform-do-expressions": "^6.22.0",
"babel-plugin-webpack-alias": "^2.1.2",
"chai": "^4.1.2",
"classnames": "^2.2.5",
"core-js": "^2.5.3",
"css-loader": "^0.28.11",
@ -42,8 +38,6 @@
"fantasy-land": "^3.5.0",
"fantasy-tuples": "^1.0.0",
"file-loader": "^1.1.11",
"flow": "^0.2.3",
"focus-trap": "^2.4.5",
"focus-trap-react": "^3.1.2",
"fuse.js": "^3.2.0",
"global": "^4.3.2",
@ -59,7 +53,6 @@
"marked": "^0.3.17",
"nearley": "^2.13.0",
"nearley-loader": "^2.0.0",
"npm": "^5.7.1",
"postcss-loader": "^2.1.2",
"ramda": "^0.25.0",
"ramda-fantasy": "^0.8.0",
@ -87,6 +80,7 @@
"redux-devtools-dock-monitor": "^1.1.3",
"redux-devtools-log-monitor": "^1.4.0",
"redux-form": "^7.3.0",
"redux-persist": "^5.9.1",
"reselect": "^3.0.1",
"screenfull": "^3.3.2",
"source-map-support": "^0.5.4",
@ -99,26 +93,41 @@
"yaml-loader": "^0.5.0"
},
"scripts": {
"pretest": "LIST=`git diff --name-only HEAD..HEAD^ | grep .*\\.js | grep -v json`; if [ \"$LIST\" ]; then eslint $LIST; fi",
"pretest":
"LIST=`git diff --name-only HEAD..HEAD^ | grep .*\\.js | grep -v json`; if [ \"$LIST\" ]; then eslint $LIST; fi && flow check",
"start": "node source/server.js",
"externalize": "node source/externalize.js",
"prepare": "flow-typed install",
"compile": "webpack --config source/webpack.prod.js",
"test": "mocha-webpack --webpack-config source/webpack.test.js --require source-map-support/register --include componentTestSetup.js --require test/helpers/browser.js \"./{,!(node_modules)/**/}!(webpack).test.js\"",
"test-watch": "mocha-webpack --webpack-config source/webpack.test.js --require source-map-support/register --require test/helpers/browser.js \"test/**/*.test.js\" --watch",
"test-meca": "mocha-webpack --webpack-config source/webpack.test.js --require source-map-support/register --require test/helpers/browser.js test/mecanisms.test.js --watch",
"test-rules": "mocha-webpack --webpack-config source/webpack.test.js --require source-map-support/register --require test/helpers/browser.js test/real-rules.test.js --watch",
"test-inversions": "mocha-webpack --webpack-config source/webpack.test.js --require source-map-support/register --require test/helpers/browser.js \"test/inversion.test.js\" --watch",
"test-components": "mocha-webpack --webpack-config source/webpack.test.js --require source-map-support/register --include componentTestSetup.js --require test/helpers/browser.js \"source/components/**/*.test.js\" --watch",
"test":
"mocha-webpack --webpack-config source/webpack.test.js --require source-map-support/register --include componentTestSetup.js --require test/helpers/browser.js \"./{,!(node_modules)/**/}!(webpack).test.js\"",
"test-watch":
"mocha-webpack --webpack-config source/webpack.test.js --require source-map-support/register --require test/helpers/browser.js \"test/**/*.test.js\" --watch",
"test-meca":
"mocha-webpack --webpack-config source/webpack.test.js --require source-map-support/register --require test/helpers/browser.js test/mecanisms.test.js --watch",
"test-rules":
"mocha-webpack --webpack-config source/webpack.test.js --require source-map-support/register --require test/helpers/browser.js test/real-rules.test.js --watch",
"test-inversions":
"mocha-webpack --webpack-config source/webpack.test.js --require source-map-support/register --require test/helpers/browser.js \"test/inversion.test.js\" --watch",
"test-components":
"mocha-webpack --webpack-config source/webpack.test.js --require source-map-support/register --include componentTestSetup.js --require test/helpers/browser.js \"source/components/**/*.test.js\" --watch",
"heroku-postbuild": "yarn install --production=false && yarn compile",
"eslint": "LIST=`git diff --cached --name-only HEAD | grep .*\\.js | grep -v json`; if [ \"$LIST\" ]; then eslint $LIST; fi",
"eslint-check": "eslint --print-config .eslintrc | eslint-config-prettier-check"
"eslint":
"LIST=`git diff --cached --name-only HEAD | grep .*\\.js | grep -v json`; if [ \"$LIST\" ]; then eslint $LIST; fi",
"eslint-check":
"eslint --print-config .eslintrc | eslint-config-prettier-check"
},
"devDependencies": {
"@babel/preset-flow": "^7.0.0-beta.47",
"chai": "^4.1.2",
"enzyme": "^3.3.0",
"enzyme-adapter-react-16": "^1.1.1",
"eslint": "^4.19.0",
"eslint-config-prettier": "^2.9.0",
"eslint-plugin-flowtype": "^2.46.3",
"eslint-plugin-react": "^7.7.0",
"flow-bin": "^0.72.0",
"flow-typed": "^2.4.0",
"intl": "^1.2.5",
"intl-locales-supported": "^1.0.0",
"mocha": "^5.0.4",

View File

@ -1,20 +1,24 @@
{
"presets": [
["@babel/env", {
"targets": {
"browsers": ["last 2 versions", "safari >= 7"]
},
"modules": false
}],
"@babel/react"
],
"plugins": [
["@babel/plugin-proposal-decorators",{"legacy": true}],
"transform-do-expressions",
"@babel/plugin-proposal-object-rest-spread",
"transform-class-properties",
"syntax-dynamic-import",
"react-hot-loader/babel",
["webpack-alias", { "config": "./source/webpack.dev.js" }]
]
"presets": [
[
"@babel/env",
{
"targets": {
"browsers": ["last 2 versions", "safari >= 7"]
},
"modules": false
}
],
"@babel/react",
"@babel/flow"
],
"plugins": [
["@babel/plugin-proposal-decorators", { "legacy": true }],
"transform-do-expressions",
"@babel/plugin-proposal-object-rest-spread",
"transform-class-properties",
"syntax-dynamic-import",
"react-hot-loader/babel",
["webpack-alias", { "config": "./source/webpack.dev.js" }]
]
}

1343
yarn.lock

File diff suppressed because it is too large Load Diff