Skip to content

Commit

Permalink
configure workspace and eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
ahnafalfariza committed Jul 21, 2020
1 parent b06bc33 commit 5961940
Show file tree
Hide file tree
Showing 7 changed files with 147 additions and 3 deletions.
27 changes: 25 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"es2020": true
},
"extends": ["eslint:recommended", "plugin:react/recommended"],
"plugins": ["react"],
"parser": "babel-eslint",
"parserOptions": {
"ecmaFeatures": {
Expand All @@ -12,6 +13,28 @@
"ecmaVersion": 11,
"sourceType": "module"
},
"plugins": ["react"],
"rules": {}
"settings": {
"react": {
"createClass": "createReactClass", // Regex for Component Factory to use,
// default to "createReactClass"
"pragma": "React", // Pragma to use, default to "React"
"version": "detect", // React version. "detect" automatically picks the version you have installed.
// You can also use `16.0`, `16.3`, etc, if you want to override the detected value.
// default to latest and warns if missing
// It will default to "detect" in the future
"flowVersion": "0.53" // Flow version
},
"propWrapperFunctions": [
// The names of any function used to wrap propTypes, e.g. `forbidExtraProps`. If this isn't set, any propTypes wrapped in a function will be skipped.
"forbidExtraProps",
{ "property": "freeze", "object": "Object" },
{ "property": "myFavoriteWrapper" }
],
"linkComponents": [
// Components used as alternatives to <a> for linking, eg. <Link to={ url } />
"Hyperlink",
{ "name": "Link", "linkAttribute": "to" }
]
},
"rules": { "react/display-name": [1, { "ignoreTranspilerName": false }] }
}
1 change: 1 addition & 0 deletions __tests__/App-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import App from '../App';
// Note: test renderer must be required after react-native.
import renderer from 'react-test-renderer';

// eslint-disable-next-line no-undef
it('renders correctly', () => {
renderer.create(<App />);
});
1 change: 1 addition & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// eslint-disable-next-line no-undef
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
};
1 change: 1 addition & 0 deletions metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* @format
*/

// eslint-disable-next-line no-undef
module.exports = {
transformer: {
getTransformOptions: async () => ({
Expand Down
111 changes: 111 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
"lint": "./node_modules/.bin/eslint --ignore-path .gitignore . --fix"
},
"dependencies": {
"babel-eslint": "^10.1.0",
Expand All @@ -23,11 +23,17 @@
"babel-jest": "^26.1.0",
"eslint": "^7.5.0",
"eslint-plugin-react": "^7.20.3",
"husky": "^4.2.5",
"jest": "^26.1.0",
"metro-react-native-babel-preset": "^0.60.0",
"react-test-renderer": "16.13.1"
},
"jest": {
"preset": "react-native"
},
"husky": {
"hooks": {
"pre-commit": "npm run lint"
}
}
}
1 change: 1 addition & 0 deletions react-native.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// eslint-disable-next-line no-undef
module.exports = {
assets: ['./src/assets/fonts/']
};

0 comments on commit 5961940

Please sign in to comment.