Use flow-bin to typecheck locally, update ESLint to 2.0

Summary:Using local version of the Flow make it easy to have project specific version instead of relying on the user to have the correct version installed globally. For example, React Native uses an older version of Flow, while I have the latest version installed. Now I cannot typecheck the code because my version doesn't match the `.flowconfig`.

**Test plan (required)**

Run `npm run lint` and `npm run flow` to run `eslint` and `flow`.

cc bestander mkonicek
Closes https://github.com/facebook/react-native/pull/6145

Reviewed By: dmmiller

Differential Revision: D2976616

Pulled By: bestander

fb-gh-sync-id: bb08f6f8ceb09f644ec1d45c40b4cb7a9d3cfef5
shipit-source-id: bb08f6f8ceb09f644ec1d45c40b4cb7a9d3cfef5
This commit is contained in:
Satyajit Sahoo
2016-03-03 04:15:15 -08:00
committed by Facebook Github Bot 7
parent 6d5f9ddfff
commit 36f1961003
4 changed files with 1319 additions and 37 deletions

View File

@@ -113,7 +113,6 @@
"no-caller": 1, // disallow use of arguments.caller or arguments.callee
"no-div-regex": 1, // disallow division operators explicitly at beginning of regular expression (off by default)
"no-else-return": 0, // disallow else after a return in an if (off by default)
"no-empty-label": 1, // disallow use of labels for anything other then loops and switches
"no-eq-null": 0, // disallow comparisons to null without a type-checking operator (off by default)
"no-eval": 1, // disallow use of eval()
"no-extend-native": 1, // disallow adding to native types
@@ -182,6 +181,8 @@
// These rules are purely matters of style and are quite subjective.
"key-spacing": 0,
"keyword-spacing": 1, // enforce spacing before and after keywords
"jsx-quotes": [1, "prefer-double"],
"comma-spacing": 0,
"no-multi-spaces": 0,
"brace-style": 0, // enforce one true brace style (off by default)
@@ -205,11 +206,9 @@
"quote-props": 0, // require quotes around object literal property names (off by default)
"semi": 1, // require or disallow use of semicolons instead of ASI
"sort-vars": 0, // sort variables within the same declaration block (off by default)
"space-after-keywords": 1, // require a space after certain keywords (off by default)
"space-in-brackets": 0, // require or disallow spaces inside brackets (off by default)
"space-in-parens": 0, // require or disallow spaces inside parentheses (off by default)
"space-infix-ops": 1, // require spaces around operators
"space-return-throw-case": 1, // require a space after return, throw, and case
"space-unary-ops": [1, { "words": true, "nonwords": false }], // require or disallow spaces before/after unary operators (words on by default, nonwords off by default)
"max-nested-callbacks": 0, // specify the maximum depth callbacks can be nested (off by default)
"one-var": 0, // allow just one var statement per function (off by default)
@@ -227,7 +226,6 @@
"react/display-name": 0,
"react/jsx-boolean-value": 0,
"react/jsx-quotes": [1, "double", "avoid-escape"],
"react/jsx-no-undef": 1,
"react/jsx-sort-props": 0,
"react/jsx-uses-react": 0,

View File

@@ -16,7 +16,6 @@ install:
- rm -Rf "${TMPDIR}/jest_preprocess_cache"
- npm config set spin=false
- npm config set progress=false
- npm install -g flow-bin@`node -p "require('fs').readFileSync('.flowconfig', 'utf8').split('[version]')[1].trim()"`
- npm install
script:
@@ -30,9 +29,8 @@ script:
then
npm install github@0.2.4
cat <(echo eslint; npm run lint --silent -- --format=json; echo flow; flow --json) | GITHUB_TOKEN="af6ef0d15709bc91d""06a6217a5a826a226fb57b7" node bots/code-analysis-bot.js
flow check
npm test
cat <(echo eslint; npm run lint --silent -- --format=json; echo flow; npm run flow --silent -- --json) | GITHUB_TOKEN="af6ef0d15709bc91d""06a6217a5a826a226fb57b7" node bots/code-analysis-bot.js
npm run flow && npm test
elif [ "$TEST_TYPE" = e2e-objc ]
then

1331
npm-shrinkwrap.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -30,7 +30,10 @@
"parse",
"react-transform-hmr"
],
"platforms": ["ios", "android"]
"platforms": [
"ios",
"android"
]
},
"modulePathIgnorePatterns": [
"/node_modules/(?!react|fbjs|react-native|parse|react-transform-hmr|core-js|promise)/",
@@ -113,6 +116,7 @@
],
"scripts": {
"test": "NODE_ENV=test jest",
"flow": "flow",
"lint": "eslint Examples/ Libraries/",
"start": "/usr/bin/env bash -c './packager/packager.sh \"$@\" || true' --"
},
@@ -175,10 +179,11 @@
"yeoman-generator": "^0.20.3"
},
"devDependencies": {
"babel-eslint": "^5.0.0",
"eslint": "^2.2.0",
"eslint-plugin-react": "^4.1.0",
"flow-bin": "^0.21.0",
"jest-cli": "0.9.0-fb2",
"babel-eslint": "4.1.4",
"eslint": "1.3.1",
"eslint-plugin-react": "3.3.1",
"portfinder": "0.4.0"
}
}