Skip to content

Commit 4b7d38f

Browse files
Ashley BibizadehAshley Bibizadeh
authored andcommitted
added eslint and refactor tests
1 parent 196de00 commit 4b7d38f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+2236
-2745
lines changed

.babelrc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
2-
"presets": [
3-
"@babel/preset-env",
4-
"@babel/preset-react"
5-
],
6-
"plugins": [
7-
"@babel/plugin-proposal-class-properties"
8-
]
2+
"presets": [
3+
"@babel/preset-env",
4+
"@babel/preset-react"
5+
],
6+
"plugins": [
7+
"@babel/plugin-proposal-class-properties"
8+
]
99
}

.eslintrc.json

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"env": {
3+
"node": true,
4+
"browser": true,
5+
"es6": true,
6+
"jest": true
7+
},
8+
"extends": [
9+
"eslint:recommended",
10+
"plugin:react/recommended"
11+
],
12+
"globals": {
13+
"Atomics": "readonly",
14+
"SharedArrayBuffer": "readonly"
15+
},
16+
"parser": "babel-eslint",
17+
"parserOptions": {
18+
"ecmaFeatures": {
19+
"jsx": true
20+
},
21+
"ecmaVersion": 2018,
22+
"sourceType": "module"
23+
},
24+
"plugins": [
25+
"react"
26+
],
27+
"rules": {
28+
"indent": [
29+
"error",
30+
2
31+
],
32+
"react/jsx-filename-extension": [
33+
1,
34+
{
35+
"extensions": [
36+
".js",
37+
".jsx"
38+
]
39+
}
40+
],
41+
"react/prop-types": 0
42+
}
43+
}

Utils/testing.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const findByTestAtrr = (wrapper, attr) => {
2+
return wrapper.find(`[data-test='${attr}']`);
3+
};

assetsTransformer.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
const path = require('path');
3+
4+
module.exports = {
5+
process(src, filename, config, options) {
6+
return 'module.exports = ' + JSON.stringify(path.basename(filename)) + ';';
7+
},
8+
};

package.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,25 @@
1111
"dev:build-server": "webpack --config webpack.server.js --watch",
1212
"dev:build-client": "webpack --config webpack.client.js --watch",
1313
"dev:server": "nodemon --watch build --exec node build/bundle.js",
14+
"lint": "eslint src",
1415
"test": "jest",
16+
"test-watch": "jest --watch",
1517
"test-coverage": "jest --coverage"
1618
},
19+
"jest": {
20+
"moduleNameMapper": {
21+
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/assetsTransformer.js",
22+
"\\.(css|less|scss)$": "<rootDir>/assetsTransformer.js"
23+
},
24+
"setupFilesAfterEnv": [
25+
"<rootDir>/setupTests.js"
26+
]
27+
},
28+
"husky": {
29+
"hooks": {
30+
"pre-push": "eslint src && jest"
31+
}
32+
},
1733
"dependencies": {
1834
"apollo-boost": "0.3.1",
1935
"apollo-cache-inmemory": "1.5.1",
@@ -72,6 +88,12 @@
7288
"babel-eslint": "10.0.1",
7389
"babel-jest": "24.7.1",
7490
"babel-loader": "8.0.5",
91+
"eslint": "5.16.0",
92+
"eslint-config-airbnb": "17.1.0",
93+
"eslint-plugin-import": "2.17.1",
94+
"eslint-plugin-jsx-a11y": "6.2.1",
95+
"eslint-plugin-react": "7.12.4",
96+
"husky": "1.3.1",
7597
"enzyme": "3.9.0",
7698
"enzyme-adapter-react-16": "1.12.1",
7799
"jest": "24.7.1"

0 commit comments

Comments
 (0)