Skip to content

Commit 977b57c

Browse files
jessebeachbeefancohen
authored andcommitted
Add the Flow project (#155)
* Add the Flow project * Remove node_modules dir from the flowconfig ignore * Add the ast-types-flow project * Add babel-plugin-transform-flow-strip-types; update yarn.lock * Add the transform-flow-strip-types babel plugin to the babelrc * Run flow on prepubish and test scripts * Use the babel-eslint parser to deal with import type declarations * yarn upgrade * Remove ast-types-flow from the devDependencies * Declare the parser in eslintrc after the extends property
1 parent 9ee1242 commit 977b57c

File tree

5 files changed

+59
-37
lines changed

5 files changed

+59
-37
lines changed

.babelrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"presets": ["es2015"],
33
"plugins": [
4-
"transform-object-rest-spread"
4+
"transform-object-rest-spread",
5+
"transform-flow-strip-types",
56
]
67
}

.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
extends: "airbnb-base",
3+
parser: "babel-eslint",
34
rules: {
45
'no-template-curly-in-string': 'off'
56
}

.flowconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[ignore]
2+
<PROJECT_ROOT>/lib/.*
3+
<PROJECT_ROOT>/docs/.*
4+
<PROJECT_ROOT>/reports/.*

package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@
1818
"main": "lib/index.js",
1919
"scripts": {
2020
"build": "rimraf lib && babel src --out-dir lib && cp -R src/util/attributes lib/util/attributes",
21-
"prepublish": "npm run lint && npm run test && npm run build",
21+
"prepublish": "npm run lint && npm run flow && npm run test && npm run build",
2222
"coveralls": "cat ./reports/lcov.info | coveralls",
23+
"flow": "flow; test $? -eq 0 -o $? -eq 2",
2324
"lint": "eslint --config .eslintrc src __tests__",
2425
"lint:fix": "npm run lint -- --fix",
25-
"pretest": "npm run lint:fix",
26+
"pretest": "npm run lint:fix && npm run flow",
2627
"test": "jest --coverage",
2728
"create": "node ./scripts/create-rule"
2829
},
@@ -31,6 +32,7 @@
3132
"babel-core": "^6.14.0",
3233
"babel-eslint": "^7.0.0",
3334
"babel-jest": "^18.0.0",
35+
"babel-plugin-transform-flow-strip-types": "^6.21.0",
3436
"babel-plugin-transform-object-rest-spread": "^6.20.2",
3537
"babel-polyfill": "^6.16.0",
3638
"babel-preset-es2015": "^6.14.0",
@@ -39,6 +41,7 @@
3941
"eslint-config-airbnb-base": "^11.0.0",
4042
"eslint-plugin-import": "^2.2.0",
4143
"expect": "^1.20.2",
44+
"flow-bin": "^0.37.4",
4245
"jest": "^18.1.0",
4346
"jscodeshift": "^0.3.30",
4447
"minimist": "^1.2.0",
@@ -50,6 +53,7 @@
5053
},
5154
"license": "MIT",
5255
"dependencies": {
56+
"ast-types-flow": "0.0.7",
5357
"damerau-levenshtein": "^1.0.0",
5458
"emoji-regex": "^6.1.0",
5559
"jsx-ast-utils": "^1.0.0",

yarn.lock

Lines changed: 46 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ ajv-keywords@^1.0.0:
3939
resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-1.5.0.tgz#c11e6859eafff83e0dafc416929472eca946aa2c"
4040

4141
ajv@^4.7.0:
42-
version "4.10.3"
43-
resolved "https://registry.yarnpkg.com/ajv/-/ajv-4.10.3.tgz#3e4fea9675b157de7888b80dd0ed735b83f28e11"
42+
version "4.10.4"
43+
resolved "https://registry.yarnpkg.com/ajv/-/ajv-4.10.4.tgz#c0974dd00b3464984892d6010aa9c2c945933254"
4444
dependencies:
4545
co "^4.6.0"
4646
json-stable-stringify "^1.0.1"
@@ -159,6 +159,10 @@ ast-traverse@~0.1.1:
159159
version "0.1.1"
160160
resolved "https://registry.yarnpkg.com/ast-traverse/-/ast-traverse-0.1.1.tgz#69cf2b8386f19dcda1bb1e05d68fe359d8897de6"
161161

162+
163+
version "0.0.7"
164+
resolved "https://registry.yarnpkg.com/ast-types-flow/-/ast-types-flow-0.0.7.tgz#f70b735c6bca1a5c9c22d982c3e39e7feba3bdad"
165+
162166
163167
version "0.8.12"
164168
resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.8.12.tgz#a0d90e4351bb887716c83fd637ebf818af4adfcc"
@@ -486,13 +490,13 @@ babel-plugin-inline-environment-variables@^1.0.1:
486490
resolved "https://registry.yarnpkg.com/babel-plugin-inline-environment-variables/-/babel-plugin-inline-environment-variables-1.0.1.tgz#1f58ce91207ad6a826a8bf645fafe68ff5fe3ffe"
487491

488492
babel-plugin-istanbul@^3.0.0:
489-
version "3.0.0"
490-
resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-3.0.0.tgz#da7324520ae0b8a44b6a078e72e883374a9fab76"
493+
version "3.1.2"
494+
resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-3.1.2.tgz#11d5abde18425ec24b5d648c7e0b5d25cd354a22"
491495
dependencies:
492496
find-up "^1.1.2"
493-
istanbul-lib-instrument "^1.1.4"
497+
istanbul-lib-instrument "^1.4.2"
494498
object-assign "^4.1.0"
495-
test-exclude "^3.2.2"
499+
test-exclude "^3.3.0"
496500

497501
babel-plugin-jest-hoist@^18.0.0:
498502
version "18.0.0"
@@ -808,7 +812,7 @@ babel-plugin-transform-export-extensions@^6.3.13:
808812
babel-plugin-syntax-export-extensions "^6.8.0"
809813
babel-runtime "^6.0.0"
810814

811-
babel-plugin-transform-flow-strip-types@^6.8.0:
815+
babel-plugin-transform-flow-strip-types@^6.21.0, babel-plugin-transform-flow-strip-types@^6.8.0:
812816
version "6.21.0"
813817
resolved "https://registry.yarnpkg.com/babel-plugin-transform-flow-strip-types/-/babel-plugin-transform-flow-strip-types-6.21.0.tgz#2eea3f8b5bb234339b47283feac155cfb237b948"
814818
dependencies:
@@ -972,8 +976,8 @@ babylon@^5.8.38:
972976
resolved "https://registry.yarnpkg.com/babylon/-/babylon-5.8.38.tgz#ec9b120b11bf6ccd4173a18bf217e60b79859ffd"
973977

974978
babylon@^6.11.0, babylon@^6.13.0, babylon@^6.8.1:
975-
version "6.14.1"
976-
resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.14.1.tgz#956275fab72753ad9b3435d7afe58f8bf0a29815"
979+
version "6.15.0"
980+
resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.15.0.tgz#ba65cfa1a80e1759b0e89fb562e27dccae70348e"
977981

978982
balanced-match@^0.4.1:
979983
version "0.4.2"
@@ -1516,8 +1520,8 @@ escope@^3.6.0:
15161520
estraverse "^4.1.1"
15171521

15181522
eslint-config-airbnb-base@^11.0.0:
1519-
version "11.0.0"
1520-
resolved "https://registry.yarnpkg.com/eslint-config-airbnb-base/-/eslint-config-airbnb-base-11.0.0.tgz#a3eddc1e49fd6492509d582340fd6f58785623bd"
1523+
version "11.0.1"
1524+
resolved "https://registry.yarnpkg.com/eslint-config-airbnb-base/-/eslint-config-airbnb-base-11.0.1.tgz#5401dba284c6b7d7c8fb1c2ee19aba018f9dfa21"
15211525

15221526
eslint-import-resolver-node@^0.2.0:
15231527
version "0.2.3"
@@ -1550,8 +1554,8 @@ eslint-plugin-import@^2.2.0:
15501554
pkg-up "^1.0.0"
15511555

15521556
eslint@^3.12.2:
1553-
version "3.12.2"
1554-
resolved "https://registry.yarnpkg.com/eslint/-/eslint-3.12.2.tgz#6be5a9aa29658252abd7f91e9132bab1f26f3c34"
1557+
version "3.13.1"
1558+
resolved "https://registry.yarnpkg.com/eslint/-/eslint-3.13.1.tgz#564d2646b5efded85df96985332edd91a23bff25"
15551559
dependencies:
15561560
babel-code-frame "^6.16.0"
15571561
chalk "^1.1.3"
@@ -1583,7 +1587,7 @@ eslint@^3.12.2:
15831587
require-uncached "^1.0.2"
15841588
shelljs "^0.7.5"
15851589
strip-bom "^3.0.0"
1586-
strip-json-comments "~1.0.1"
1590+
strip-json-comments "~2.0.1"
15871591
table "^3.7.8"
15881592
text-table "~0.2.0"
15891593
user-home "^2.0.0"
@@ -1695,7 +1699,7 @@ fast-levenshtein@~2.0.4:
16951699

16961700
fb-watchman@^1.8.0, fb-watchman@^1.9.0:
16971701
version "1.9.0"
1698-
resolved "https://registry.yarnpkg.com/fb-watchman/-/fb-watchman-1.9.0.tgz#6f268f1f347a6b3c875d1e89da7e1ed79adfc0ec"
1702+
resolved "http://registry.npmjs.org/fb-watchman/-/fb-watchman-1.9.0.tgz#6f268f1f347a6b3c875d1e89da7e1ed79adfc0ec"
16991703
dependencies:
17001704
bser "^1.0.2"
17011705

@@ -1750,6 +1754,10 @@ flat-cache@^1.2.1:
17501754
graceful-fs "^4.1.2"
17511755
write "^0.2.1"
17521756

1757+
flow-bin@^0.37.4:
1758+
version "0.37.4"
1759+
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.37.4.tgz#3d8da2ef746e80e730d166e09040f4198969b76b"
1760+
17531761
flow-parser@^0.*:
17541762
version "0.37.0"
17551763
resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.37.0.tgz#1065c612a30f037ac3ee60053f6e797a6d9be8d6"
@@ -1805,8 +1813,8 @@ fs.realpath@^1.0.0:
18051813
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
18061814

18071815
fsevents@^1.0.0:
1808-
version "1.0.15"
1809-
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.0.15.tgz#fa63f590f3c2ad91275e4972a6cea545fb0aae44"
1816+
version "1.0.17"
1817+
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.0.17.tgz#8537f3f12272678765b4fd6528c0f1f66f8f4558"
18101818
dependencies:
18111819
nan "^2.3.0"
18121820
node-pre-gyp "^0.6.29"
@@ -1923,7 +1931,7 @@ globby@^5.0.0:
19231931
pify "^2.0.0"
19241932
pinkie-promise "^2.0.0"
19251933

1926-
graceful-fs@^4.1.2, graceful-fs@^4.1.4, graceful-fs@^4.1.6:
1934+
graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.4, graceful-fs@^4.1.6:
19271935
version "4.1.11"
19281936
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658"
19291937

@@ -2313,9 +2321,9 @@ istanbul-lib-hook@^1.0.0-alpha.4:
23132321
dependencies:
23142322
append-transform "^0.3.0"
23152323

2316-
istanbul-lib-instrument@^1.1.1, istanbul-lib-instrument@^1.1.4, istanbul-lib-instrument@^1.3.0:
2317-
version "1.3.1"
2318-
resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-1.3.1.tgz#112c25a4f2f9bc361d13d14bbff992331b974e52"
2324+
istanbul-lib-instrument@^1.1.1, istanbul-lib-instrument@^1.3.0, istanbul-lib-instrument@^1.4.2:
2325+
version "1.4.2"
2326+
resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-1.4.2.tgz#0e2fdfac93c1dabf2e31578637dc78a19089f43e"
23192327
dependencies:
23202328
babel-generator "^6.18.0"
23212329
babel-template "^6.16.0"
@@ -2908,8 +2916,8 @@ [email protected]:
29082916
resolved "https://registry.yarnpkg.com/node-dir/-/node-dir-0.1.8.tgz#55fb8deb699070707fb67f91a460f0448294c77d"
29092917

29102918
node-emoji@^1.4.1:
2911-
version "1.4.3"
2912-
resolved "https://registry.yarnpkg.com/node-emoji/-/node-emoji-1.4.3.tgz#5272f70b823c4df6d7c39f84fd8203f35b3e5d36"
2919+
version "1.5.0"
2920+
resolved "https://registry.yarnpkg.com/node-emoji/-/node-emoji-1.5.0.tgz#9a0d9fe03fd43afa357d6d8e439aa31e599959b7"
29132921
dependencies:
29142922
string.prototype.codepointat "^0.2.0"
29152923

@@ -3000,7 +3008,7 @@ object-assign@^4.0.1, object-assign@^4.1.0:
30003008

30013009
object-inspect@^1.1.0:
30023010
version "1.2.1"
3003-
resolved "http://registry.npmjs.org/object-inspect/-/object-inspect-1.2.1.tgz#3b62226eb8f6d441751c7d8f22a20ff80ac9dc3f"
3011+
resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.2.1.tgz#3b62226eb8f6d441751c7d8f22a20ff80ac9dc3f"
30043012

30053013
object-keys@^1.0.8, object-keys@^1.0.9:
30063014
version "1.0.11"
@@ -3541,8 +3549,8 @@ shebang-regex@^1.0.0:
35413549
resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3"
35423550

35433551
shelljs@^0.7.5:
3544-
version "0.7.5"
3545-
resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.5.tgz#2eef7a50a21e1ccf37da00df767ec69e30ad0675"
3552+
version "0.7.6"
3553+
resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.6.tgz#379cccfb56b91c8601e4793356eb5382924de9ad"
35463554
dependencies:
35473555
glob "^7.0.0"
35483556
interpret "^1.0.0"
@@ -3678,7 +3686,7 @@ string_decoder@~0.10.x:
36783686

36793687
stringmap@~0.2.2:
36803688
version "0.2.2"
3681-
resolved "http://registry.npmjs.org/stringmap/-/stringmap-0.2.2.tgz#556c137b258f942b8776f5b2ef582aa069d7d1b1"
3689+
resolved "https://registry.yarnpkg.com/stringmap/-/stringmap-0.2.2.tgz#556c137b258f942b8776f5b2ef582aa069d7d1b1"
36823690

36833691
stringset@~0.2.1:
36843692
version "0.2.1"
@@ -3708,10 +3716,14 @@ strip-bom@^3.0.0:
37083716
version "3.0.0"
37093717
resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3"
37103718

3711-
strip-json-comments@~1.0.1, strip-json-comments@~1.0.4:
3719+
strip-json-comments@~1.0.4:
37123720
version "1.0.4"
37133721
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-1.0.4.tgz#1e15fbcac97d3ee99bf2d73b4c656b082bbafb91"
37143722

3723+
strip-json-comments@~2.0.1:
3724+
version "2.0.1"
3725+
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a"
3726+
37153727
supports-color@^0.2.0:
37163728
version "0.2.0"
37173729
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-0.2.0.tgz#d92de2694eb3f67323973d7ae3d8b55b4c22190a"
@@ -3769,7 +3781,7 @@ temp@^0.8.1:
37693781
os-tmpdir "^1.0.0"
37703782
rimraf "~2.2.6"
37713783

3772-
test-exclude@^3.2.2:
3784+
test-exclude@^3.3.0:
37733785
version "3.3.0"
37743786
resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-3.3.0.tgz#7a17ca1239988c98367b0621456dbb7d4bc38977"
37753787
dependencies:
@@ -3933,8 +3945,8 @@ whatwg-encoding@^1.0.1:
39333945
iconv-lite "0.4.13"
39343946

39353947
whatwg-url@^4.1.0:
3936-
version "4.1.1"
3937-
resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-4.1.1.tgz#567074923352de781e3500d64a86aa92a971b4a4"
3948+
version "4.2.0"
3949+
resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-4.2.0.tgz#abf1a3f5ff4bc2005b3f0c2119382631789d8e44"
39383950
dependencies:
39393951
tr46 "~0.0.3"
39403952
webidl-conversions "^3.0.0"
@@ -3990,10 +4002,10 @@ wrappy@1:
39904002
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
39914003

39924004
write-file-atomic@^1.2.0:
3993-
version "1.2.0"
3994-
resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-1.2.0.tgz#14c66d4e4cb3ca0565c28cf3b7a6f3e4d5938fab"
4005+
version "1.3.1"
4006+
resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-1.3.1.tgz#7d45ba32316328dd1ec7d90f60ebc0d845bb759a"
39954007
dependencies:
3996-
graceful-fs "^4.1.2"
4008+
graceful-fs "^4.1.11"
39974009
imurmurhash "^0.1.4"
39984010
slide "^1.1.5"
39994011

0 commit comments

Comments
 (0)