Skip to content

Commit

Permalink
Adjust eslint rules & Add command line & Upgrade dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
wellyshen committed Aug 31, 2018
1 parent 7c3f804 commit 6178524
Show file tree
Hide file tree
Showing 5 changed files with 724 additions and 626 deletions.
35 changes: 18 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,22 +104,23 @@ Now the app should be running at [http://localhost:8080/](http://localhost:8080/

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:

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

## App Structure

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

### Boost App Performance by Shallow Compare

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.
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.

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.

Expand Down
51 changes: 26 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-cool-starter",
"version": "2.5.5",
"version": "2.5.6",
"description": "A starter boilerplate for an universal web application with the best development experience and best practices.",
"main": "index.js",
"engines": {
Expand Down Expand Up @@ -49,6 +49,7 @@
"flow:stop": "better-npm-run flow:stop",
"test": "better-npm-run test",
"test:watch": "yarn test --watch",
"test:update-snapshot": "yarn test -u",
"clean": "npm-run-all clean:build clean:test",
"clean:build": "better-npm-run clean:build",
"clean:test": "better-npm-run clean:test",
Expand Down Expand Up @@ -204,9 +205,9 @@
]
}
],
"lodash/prefer-lodash-method": "off",
"lodash/import-scope": "off",
"lodash/prefer-noop": "off",
"lodash/prefer-lodash-typecheck": "off",
"prettier/prettier": [
"error",
{
Expand Down Expand Up @@ -282,15 +283,15 @@
"last 2 versions"
],
"dependencies": {
"@babel/plugin-proposal-class-properties": "^7.0.0-rc.1",
"@babel/preset-env": "^7.0.0-rc.1",
"@babel/preset-flow": "^7.0.0-rc.1",
"@babel/preset-react": "^7.0.0-rc.1",
"@babel/register": "^7.0.0-rc.1",
"@babel/plugin-proposal-class-properties": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/preset-flow": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"@babel/register": "^7.0.0",
"asset-require-hook": "^1.2.0",
"autoprefixer": "^9.1.1",
"autoprefixer": "^9.1.3",
"axios": "^0.18.0",
"babel-plugin-dynamic-import-node": "^2.0.0",
"babel-plugin-dynamic-import-node": "^2.1.0",
"babel-plugin-lodash": "^3.3.4",
"babel-plugin-transform-remove-console": "^6.9.4",
"better-npm-run": "^0.1.1",
Expand All @@ -310,10 +311,10 @@
"normalize.css": "^8.0.0",
"prop-types": "^15.6.2",
"react": "^16.4.2",
"react-dev-utils": "^5.0.1",
"react-dev-utils": "^5.0.2",
"react-dom": "^16.4.2",
"react-helmet": "^5.2.0",
"react-hot-loader": "^4.3.4",
"react-hot-loader": "^4.3.5",
"react-redux": "^5.0.7",
"react-router-config": "^1.0.0-beta.4",
"react-router-dom": "^4.3.1",
Expand All @@ -324,18 +325,18 @@
"serve-favicon": "^2.5.0"
},
"devDependencies": {
"@babel/cli": "^7.0.0-rc.1",
"@babel/core": "^7.0.0-rc.1",
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"babel-core": "^7.0.0-bridge.0",
"babel-eslint": "^8.2.6",
"babel-eslint": "^9.0.0",
"babel-jest": "^23.4.2",
"babel-loader": "^8.0.0-beta.0",
"babel-plugin-istanbul": "^4.1.6",
"compression-webpack-plugin": "^1.1.11",
"babel-loader": "^8.0.0",
"babel-plugin-istanbul": "^5.0.1",
"compression-webpack-plugin": "^1.1.12",
"coveralls": "^3.0.2",
"css-loader": "^1.0.0",
"enzyme": "^3.4.4",
"enzyme-adapter-react-16": "^1.2.0",
"enzyme": "^3.5.0",
"enzyme-adapter-react-16": "^1.3.1",
"eslint": "^5.3.0",
"eslint-config-airbnb": "^17.1.0",
"eslint-config-prettier": "^3.0.1",
Expand All @@ -345,7 +346,7 @@
"eslint-plugin-lodash": "^2.7.0",
"eslint-plugin-prettier": "^2.6.2",
"eslint-plugin-react": "^7.11.0",
"file-loader": "^1.1.11",
"file-loader": "^2.0.0",
"flow-bin": "^0.79.1",
"friendly-errors-webpack-plugin": "^1.7.0",
"husky": "^0.14.3",
Expand All @@ -354,11 +355,11 @@
"jest": "^23.5.0",
"lint-staged": "^7.2.2",
"lodash-webpack-plugin": "^0.11.5",
"mini-css-extract-plugin": "^0.4.1",
"mini-css-extract-plugin": "^0.4.2",
"nock": "^9.6.1",
"nodemon": "^1.18.3",
"nodemon": "^1.18.4",
"npm-run-all": "^4.1.3",
"optimize-css-assets-webpack-plugin": "^5.0.0",
"optimize-css-assets-webpack-plugin": "^5.0.1",
"postcss": "^7.0.2",
"postcss-loader": "^3.0.0",
"prettier": "^1.14.2",
Expand All @@ -373,10 +374,10 @@
"stylelint-config-standard": "^18.2.0",
"stylelint-scss": "^3.3.0",
"url-loader": "^1.1.1",
"webpack": "^4.16.5",
"webpack": "^4.17.1",
"webpack-bundle-analyzer": "^2.13.1",
"webpack-cli": "^3.1.0",
"webpack-dev-middleware": "^3.1.3",
"webpack-dev-middleware": "^3.2.0",
"webpack-hot-middleware": "^2.22.3",
"webpack-manifest-plugin": "^2.0.3"
},
Expand Down
4 changes: 2 additions & 2 deletions public/webpack-assets.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"main.css": "/assets/main.e3430c49.css",
"main.js": "/assets/main.03209cb8.js",
"main.js.map": "/assets/main.03209cb8.js.map",
"main.js": "/assets/main.3dc8db05.js",
"main.js.map": "/assets/main.3dc8db05.js.map",
"vendors~main.css": "/assets/3.1736fc72.chunk.css",
"vendors~main.js": "/assets/3.0e582dad.chunk.js",
"vendors~main.js.map": "/assets/3.0e582dad.chunk.js.map"
Expand Down
3 changes: 1 addition & 2 deletions src/components/UserList/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* @flow */

import React from 'react';
import _ from 'lodash';

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

Expand All @@ -13,7 +12,7 @@ export default ({ list }: Props) => (
<div className={styles.UserList}>
<h4>User List</h4>
<ul>
{_.map(list, ({ id, name }) => (
{list.map(({ id, name }) => (
<li key={id}>
<Link to={`/UserInfo/${id}`}>{name}</Link>
</li>
Expand Down
Loading

0 comments on commit 6178524

Please sign in to comment.