Skip to content

Commit 6178524

Browse files
committed
Adjust eslint rules & Add command line & Upgrade dependencies
1 parent 7c3f804 commit 6178524

File tree

5 files changed

+724
-626
lines changed

5 files changed

+724
-626
lines changed

README.md

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -104,22 +104,23 @@ Now the app should be running at [http://localhost:8080/](http://localhost:8080/
104104

105105
I use [better-npm-run](https://github.com/benoror/better-npm-run) to manage the scripts in a better way, which also provides the compatibility of cross-platform. All of the scripts are listed as following:
106106

107-
| `yarn <script>` | Description |
108-
| --------------- | -------------------------------------------------------------------------------- |
109-
| `dev` | Run your app on the development server at `localhost:3000`. HMR will be enabled. |
110-
| `start` | Run your app on the production server only at `localhost:8080`. |
111-
| `build` | Remove the previous bundled files and bundle it to `./public/assets`. |
112-
| `analyze` | Viusalize the contents of all your bundles. |
113-
| `lint` | Lint all `.js` and `.scss` files. |
114-
| `lint:js` | Lint all `.js` files (With `--fix` to auto fix eslint errors). |
115-
| `lint:style` | Lint all `.scss` files (With `--fix` to auto fix stylelint errors). |
116-
| `flow` | Run type checking for `.js` files. |
117-
| `flow:stop` | Stop type checking. |
118-
| `test` | Run testing once (with code coverage reports). |
119-
| `test:watch` | Run testing on every test file change. |
120-
| `clean` | Remove the client/server bundled stuff and the coverage report. |
121-
| `clean:build` | Remove the `./public/assets` folder to clean the client bundled files. |
122-
| `clean:test` | Remove the `./coverage` folder to clean the code coverage report. |
107+
| `yarn <script>` | Description |
108+
| ---------------------- | -------------------------------------------------------------------------------- |
109+
| `dev` | Run your app on the development server at `localhost:3000`. HMR will be enabled. |
110+
| `start` | Run your app on the production server only at `localhost:8080`. |
111+
| `build` | Remove the previous bundled files and bundle it to `./public/assets`. |
112+
| `analyze` | Visualize the contents of all your bundles. |
113+
| `lint` | Lint all `.js` and `.scss` files. |
114+
| `lint:js` | Lint all `.js` files (With `--fix` to auto fix eslint errors). |
115+
| `lint:style` | Lint all `.scss` files (With `--fix` to auto fix stylelint errors). |
116+
| `flow` | Run type checking for `.js` files. |
117+
| `flow:stop` | Stop type checking. |
118+
| `test` | Run testing once (with code coverage reports). |
119+
| `test:watch` | Run testing on every test file change. |
120+
| `test:update-snapshot` | Update jest snapshot. |
121+
| `clean` | Remove the client/server bundled stuff and the coverage report. |
122+
| `clean:build` | Remove the `./public/assets` folder to clean the client bundled files. |
123+
| `clean:test` | Remove the `./coverage` folder to clean the code coverage report. |
123124

124125
## App Structure
125126

@@ -444,7 +445,7 @@ $fa-font-path:"../node_modules/font-awesome/fonts";
444445

445446
### Boost App Performance by Shallow Compare
446447

447-
If your React component's render() function renders the same result given the same props and state, you can use [React.PureComponent](https://facebook.github.io/react/docs/react-api.html#react.purecomponent) for a performance boost.
448+
If your React component's render() function renders the same result given the same props and state, you can use [React.PureComponent](https://reactjs.org/docs/react-api.html#reactpurecomponent) for a performance boost.
448449

449450
React.PureComponent is exactly like React.Component but implements `shouldComponentUpdate()` with a shallow prop and state comparison. See the [Optimizing Performance](https://facebook.github.io/react/docs/optimizing-performance.html#examples) topic for more info.
450451

package.json

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-cool-starter",
3-
"version": "2.5.5",
3+
"version": "2.5.6",
44
"description": "A starter boilerplate for an universal web application with the best development experience and best practices.",
55
"main": "index.js",
66
"engines": {
@@ -49,6 +49,7 @@
4949
"flow:stop": "better-npm-run flow:stop",
5050
"test": "better-npm-run test",
5151
"test:watch": "yarn test --watch",
52+
"test:update-snapshot": "yarn test -u",
5253
"clean": "npm-run-all clean:build clean:test",
5354
"clean:build": "better-npm-run clean:build",
5455
"clean:test": "better-npm-run clean:test",
@@ -204,9 +205,9 @@
204205
]
205206
}
206207
],
208+
"lodash/prefer-lodash-method": "off",
207209
"lodash/import-scope": "off",
208210
"lodash/prefer-noop": "off",
209-
"lodash/prefer-lodash-typecheck": "off",
210211
"prettier/prettier": [
211212
"error",
212213
{
@@ -282,15 +283,15 @@
282283
"last 2 versions"
283284
],
284285
"dependencies": {
285-
"@babel/plugin-proposal-class-properties": "^7.0.0-rc.1",
286-
"@babel/preset-env": "^7.0.0-rc.1",
287-
"@babel/preset-flow": "^7.0.0-rc.1",
288-
"@babel/preset-react": "^7.0.0-rc.1",
289-
"@babel/register": "^7.0.0-rc.1",
286+
"@babel/plugin-proposal-class-properties": "^7.0.0",
287+
"@babel/preset-env": "^7.0.0",
288+
"@babel/preset-flow": "^7.0.0",
289+
"@babel/preset-react": "^7.0.0",
290+
"@babel/register": "^7.0.0",
290291
"asset-require-hook": "^1.2.0",
291-
"autoprefixer": "^9.1.1",
292+
"autoprefixer": "^9.1.3",
292293
"axios": "^0.18.0",
293-
"babel-plugin-dynamic-import-node": "^2.0.0",
294+
"babel-plugin-dynamic-import-node": "^2.1.0",
294295
"babel-plugin-lodash": "^3.3.4",
295296
"babel-plugin-transform-remove-console": "^6.9.4",
296297
"better-npm-run": "^0.1.1",
@@ -310,10 +311,10 @@
310311
"normalize.css": "^8.0.0",
311312
"prop-types": "^15.6.2",
312313
"react": "^16.4.2",
313-
"react-dev-utils": "^5.0.1",
314+
"react-dev-utils": "^5.0.2",
314315
"react-dom": "^16.4.2",
315316
"react-helmet": "^5.2.0",
316-
"react-hot-loader": "^4.3.4",
317+
"react-hot-loader": "^4.3.5",
317318
"react-redux": "^5.0.7",
318319
"react-router-config": "^1.0.0-beta.4",
319320
"react-router-dom": "^4.3.1",
@@ -324,18 +325,18 @@
324325
"serve-favicon": "^2.5.0"
325326
},
326327
"devDependencies": {
327-
"@babel/cli": "^7.0.0-rc.1",
328-
"@babel/core": "^7.0.0-rc.1",
328+
"@babel/cli": "^7.0.0",
329+
"@babel/core": "^7.0.0",
329330
"babel-core": "^7.0.0-bridge.0",
330-
"babel-eslint": "^8.2.6",
331+
"babel-eslint": "^9.0.0",
331332
"babel-jest": "^23.4.2",
332-
"babel-loader": "^8.0.0-beta.0",
333-
"babel-plugin-istanbul": "^4.1.6",
334-
"compression-webpack-plugin": "^1.1.11",
333+
"babel-loader": "^8.0.0",
334+
"babel-plugin-istanbul": "^5.0.1",
335+
"compression-webpack-plugin": "^1.1.12",
335336
"coveralls": "^3.0.2",
336337
"css-loader": "^1.0.0",
337-
"enzyme": "^3.4.4",
338-
"enzyme-adapter-react-16": "^1.2.0",
338+
"enzyme": "^3.5.0",
339+
"enzyme-adapter-react-16": "^1.3.1",
339340
"eslint": "^5.3.0",
340341
"eslint-config-airbnb": "^17.1.0",
341342
"eslint-config-prettier": "^3.0.1",
@@ -345,7 +346,7 @@
345346
"eslint-plugin-lodash": "^2.7.0",
346347
"eslint-plugin-prettier": "^2.6.2",
347348
"eslint-plugin-react": "^7.11.0",
348-
"file-loader": "^1.1.11",
349+
"file-loader": "^2.0.0",
349350
"flow-bin": "^0.79.1",
350351
"friendly-errors-webpack-plugin": "^1.7.0",
351352
"husky": "^0.14.3",
@@ -354,11 +355,11 @@
354355
"jest": "^23.5.0",
355356
"lint-staged": "^7.2.2",
356357
"lodash-webpack-plugin": "^0.11.5",
357-
"mini-css-extract-plugin": "^0.4.1",
358+
"mini-css-extract-plugin": "^0.4.2",
358359
"nock": "^9.6.1",
359-
"nodemon": "^1.18.3",
360+
"nodemon": "^1.18.4",
360361
"npm-run-all": "^4.1.3",
361-
"optimize-css-assets-webpack-plugin": "^5.0.0",
362+
"optimize-css-assets-webpack-plugin": "^5.0.1",
362363
"postcss": "^7.0.2",
363364
"postcss-loader": "^3.0.0",
364365
"prettier": "^1.14.2",
@@ -373,10 +374,10 @@
373374
"stylelint-config-standard": "^18.2.0",
374375
"stylelint-scss": "^3.3.0",
375376
"url-loader": "^1.1.1",
376-
"webpack": "^4.16.5",
377+
"webpack": "^4.17.1",
377378
"webpack-bundle-analyzer": "^2.13.1",
378379
"webpack-cli": "^3.1.0",
379-
"webpack-dev-middleware": "^3.1.3",
380+
"webpack-dev-middleware": "^3.2.0",
380381
"webpack-hot-middleware": "^2.22.3",
381382
"webpack-manifest-plugin": "^2.0.3"
382383
},

public/webpack-assets.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"main.css": "/assets/main.e3430c49.css",
3-
"main.js": "/assets/main.03209cb8.js",
4-
"main.js.map": "/assets/main.03209cb8.js.map",
3+
"main.js": "/assets/main.3dc8db05.js",
4+
"main.js.map": "/assets/main.3dc8db05.js.map",
55
"vendors~main.css": "/assets/3.1736fc72.chunk.css",
66
"vendors~main.js": "/assets/3.0e582dad.chunk.js",
77
"vendors~main.js.map": "/assets/3.0e582dad.chunk.js.map"

src/components/UserList/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/* @flow */
22

33
import React from 'react';
4-
import _ from 'lodash';
54

65
import { Link } from 'react-router-dom';
76

@@ -13,7 +12,7 @@ export default ({ list }: Props) => (
1312
<div className={styles.UserList}>
1413
<h4>User List</h4>
1514
<ul>
16-
{_.map(list, ({ id, name }) => (
15+
{list.map(({ id, name }) => (
1716
<li key={id}>
1817
<Link to={`/UserInfo/${id}`}>{name}</Link>
1918
</li>

0 commit comments

Comments
 (0)