From 2885fa95181c34616b7212cc9eba4859fcd45672 Mon Sep 17 00:00:00 2001 From: afc163 Date: Tue, 26 Dec 2017 14:58:30 +0800 Subject: [PATCH] better jsx-wrap-multilines eslint rule --- .eslintrc | 9 +++++++++ src/components/AvatarList/index.js | 5 ++--- src/components/EditableItem/index.js | 5 +++-- src/components/PageHeader/index.js | 23 ++++++++++++----------- src/routes/Profile/AdvancedProfile.js | 5 ++--- src/utils/utils.js | 2 +- 6 files changed, 29 insertions(+), 20 deletions(-) diff --git a/.eslintrc b/.eslintrc index 812519ed..db4c05c4 100755 --- a/.eslintrc +++ b/.eslintrc @@ -20,6 +20,15 @@ "react/jsx-no-bind": [0], "react/prop-types": [0], "react/prefer-stateless-function": [0], + "react/jsx-wrap-multilines": ["error", { + "declaration": "parens-new-line", + "assignment": "parens-new-line", + "return": "parens-new-line", + "arrow": "parens-new-line", + "condition": "parens-new-line", + "logical": "parens-new-line", + "prop": "ignore" + }], "no-else-return": [0], "no-restricted-syntax": [0], "import/no-extraneous-dependencies": [0], diff --git a/src/components/AvatarList/index.js b/src/components/AvatarList/index.js index fcd0f020..08c502f1 100644 --- a/src/components/AvatarList/index.js +++ b/src/components/AvatarList/index.js @@ -28,12 +28,11 @@ const Item = ({ src, size, tips, onClick = (() => {}) }) => { return (
  • { - tips ? + tips ? ( - : - + ) : }
  • ); diff --git a/src/components/EditableItem/index.js b/src/components/EditableItem/index.js index ea2f4477..b0563c17 100644 --- a/src/components/EditableItem/index.js +++ b/src/components/EditableItem/index.js @@ -25,7 +25,7 @@ export default class EditableItem extends PureComponent { return (
    { - editable ? + editable ? (
    - : + ) : (
    {value || ' '}
    + ) }
    ); diff --git a/src/components/PageHeader/index.js b/src/components/PageHeader/index.js index 8680585e..c5e13bb7 100644 --- a/src/components/PageHeader/index.js +++ b/src/components/PageHeader/index.js @@ -144,17 +144,18 @@ export default class PageHeader extends PureComponent { { tabList && - tabList.length && - - { - tabList.map(item => ) - } - + tabList.length && ( + + { + tabList.map(item => ) + } + + ) } ); diff --git a/src/routes/Profile/AdvancedProfile.js b/src/routes/Profile/AdvancedProfile.js index 671dac88..b2350317 100644 --- a/src/routes/Profile/AdvancedProfile.js +++ b/src/routes/Profile/AdvancedProfile.js @@ -97,12 +97,11 @@ const popoverContent = ( ); -const customDot = (dot, { status }) => (status === 'process' ? +const customDot = (dot, { status }) => (status === 'process' ? ( {dot} - : dot -); +) : dot); const operationTabList = [{ key: 'tab1', diff --git a/src/utils/utils.js b/src/utils/utils.js index ee479df5..89476c9e 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -95,7 +95,7 @@ export function digitUppercase(n) { function getRelation(str1, str2) { if (str1 === str2) { - console.warn('Two path are equal!'); + console.warn('Two path are equal!'); // eslint-disable-line } const arr1 = str1.split('/'); const arr2 = str2.split('/'); -- GitLab