Skip to content

Commit

Permalink
Use eslint-plugin-lodash & Code refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
wellyshen committed Jul 16, 2018
1 parent d13a288 commit d5c4f68
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 4 deletions.
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-cool-starter",
"version": "2.5.2",
"version": "2.5.3",
"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 @@ -145,11 +145,13 @@
"eslintConfig": {
"parser": "babel-eslint",
"extends": [
"plugin:lodash/recommended",
"airbnb",
"prettier",
"prettier/react"
],
"plugins": [
"lodash",
"react",
"prettier"
],
Expand Down Expand Up @@ -195,6 +197,8 @@
]
}
],
"lodash/import-scope": "off",
"lodash/prefer-noop": "off",
"prettier/prettier": [
"error",
{
Expand Down Expand Up @@ -330,6 +334,7 @@
"eslint-loader": "^2.0.0",
"eslint-plugin-import": "^2.12.0",
"eslint-plugin-jsx-a11y": "^6.0.3",
"eslint-plugin-lodash": "^2.7.0",
"eslint-plugin-prettier": "^2.6.2",
"eslint-plugin-react": "^7.9.1",
"file-loader": "^1.1.11",
Expand Down
3 changes: 2 additions & 1 deletion src/components/UserList/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* @flow */

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

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

Expand All @@ -12,7 +13,7 @@ export default ({ list }: Props) => (
<div className={styles.UserList}>
<h4>User List</h4>
<ul>
{list.map(({ id, name }) => (
{_.map(list, ({ id, name }) => (
<li key={id}>
<Link to={`/UserInfo/${id}`}>{name}</Link>
</li>
Expand Down
2 changes: 1 addition & 1 deletion src/utils/configureStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default (history: Object, initialState: Object = {}): Store => {
// Use Redux DevTools Extension in development
const composeEnhancers =
(__DEV__ &&
typeof window === 'object' &&
typeof window !== 'undefined' &&
window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) ||
compose;
const enhancers = composeEnhancers(
Expand Down
2 changes: 2 additions & 0 deletions src/utils/renderHtml.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable lodash/prefer-lodash-method */

import serialize from 'serialize-javascript';
import { minify } from 'html-minifier';

Expand Down
8 changes: 7 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3771,6 +3771,12 @@ eslint-plugin-jsx-a11y@^6.0.3:
emoji-regex "^6.1.0"
jsx-ast-utils "^2.0.0"

eslint-plugin-lodash@^2.7.0:
version "2.7.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-lodash/-/eslint-plugin-lodash-2.7.0.tgz#66cdc1070b7c9d4b749368b54820886380a14c35"
dependencies:
lodash "~4.17.0"

eslint-plugin-prettier@^2.6.2:
version "2.6.2"
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-2.6.2.tgz#71998c60aedfa2141f7bfcbf9d1c459bf98b4fad"
Expand Down Expand Up @@ -6799,7 +6805,7 @@ lodash.uniq@^4.5.0:
version "4.5.0"
resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773"

"lodash@>=3.5 <5", lodash@^4.0.0, lodash@^4.13.1, lodash@^4.15.0, lodash@^4.17.10, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.0, lodash@^4.3.0, lodash@^4.7.0, lodash@~4.17.10:
"lodash@>=3.5 <5", lodash@^4.0.0, lodash@^4.13.1, lodash@^4.15.0, lodash@^4.17.10, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.0, lodash@^4.3.0, lodash@^4.7.0, lodash@~4.17.0, lodash@~4.17.10:
version "4.17.10"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7"

Expand Down

0 comments on commit d5c4f68

Please sign in to comment.