Setup ESLint and Flow

This commit is contained in:
Satyajit Sahoo
2016-10-23 23:56:56 +05:30
parent 5963ff982d
commit 06aed55bc4
5 changed files with 71 additions and 27 deletions

1
.eslintignore Normal file
View File

@@ -0,0 +1 @@
node_modules/

View File

@@ -15,7 +15,6 @@
},
"plugins": [
"ava",
"babel",
"import",
"react",
@@ -235,26 +234,6 @@
"require-jsdoc": 0,
"require-yield": 0,
"ava/assertion-message": [0, "always"],
"ava/max-asserts": [0, 5],
"ava/no-cb-test": 0,
"ava/no-identical-title": 2,
"ava/no-ignored-test-files": 2,
"ava/no-invalid-end": 2,
"ava/no-only-test": 2,
"ava/no-skip-assert": 2,
"ava/no-skip-test": 2,
"ava/no-statement-after-end": 2,
"ava/no-todo-test": 1,
"ava/no-unknown-modifiers": 2,
"ava/prefer-power-assert": 0,
"ava/test-ended": 2,
"ava/test-title": [2, "if-multiple"],
"ava/use-t-well": 2,
"ava/use-t": 2,
"ava/use-test": 2,
"ava/use-true-false": 2,
"babel/generator-star-spacing": [2, "before"],
"babel/new-cap": 0,
"babel/array-bracket-spacing": [1, "always"],

View File

@@ -1,8 +1,65 @@
[ignore]
# Ignore node_modules folder
<PROJECT_ROOT>/node_modules
<PROJECT_ROOT>/ReactNativePaperExample
# We fork some components by platform.
.*/*[.]android.js
# Ignore templates with `@flow` in header
.*/local-cli/generator.*
# Ignore malformed json
.*/node_modules/y18n/test/.*\.json
# Ignore the website subdir
<PROJECT_ROOT>/website/.*
# Ignore BUCK generated dirs
<PROJECT_ROOT>/\.buckd/
# Ignore unexpected extra @providesModule
.*/node_modules/commoner/test/source/widget/share.js
# Ignore duplicate module providers
# For RN Apps installed via npm, "Libraries" folder is inside node_modules/react-native but in the source repo it is in the root
.*/Libraries/react-native/React.js
.*/Libraries/react-native/ReactNative.js
.*/node_modules/jest-runtime/build/__tests__/.*
# Ignore duplicate modules under example/
.*/example/node_modules/fbjs
.*/example/node_modules/react
.*/example/node_modules/react-native
.*/example/\.buckd/
[include]
[libs]
node_modules/react-native/Libraries/react-native/react-native-interface.js
node_modules/react-native/flow
[options]
module.system=haste
esproposal.decorators=ignore
esproposal.class_static_fields=enable
esproposal.class_instance_fields=enable
esproposal.export_star_as=enable
unsafe.enable_getters_and_setters=true
experimental.strict_type_args=true
munge_underscores=true
module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub'
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FixMe
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(3[0-2]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(3[0-2]\\|1[0-9]\\|[1-2][0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
[version]
^0.33.0
^0.32.0

View File

@@ -1,2 +1,2 @@
// @flow
export {default as ThemeProvider} from './src/styles/ThemeProvider';
export { default as ThemeProvider } from './src/styles/ThemeProvider';

View File

@@ -5,6 +5,7 @@
"main": "index.js",
"scripts": {
"flow": "flow",
"lint": "eslint .",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
@@ -22,7 +23,13 @@
"react-native": "*"
},
"devDependencies": {
"flow-bin": "^0.33.0",
"babel-eslint": "^7.0.0",
"eslint": "^3.8.1",
"eslint-plugin-babel": "^3.3.0",
"eslint-plugin-import": "^2.0.1",
"eslint-plugin-react": "^6.4.1",
"eslint-plugin-react-native": "^2.0.0",
"flow-bin": "^0.32.0",
"react": "latest",
"react-native": "latest"
}