Browse Source

better jsx-wrap-multilines eslint rule

pull/507/head
afc163 8 years ago
parent
commit
2885fa9518
  1. 9
      .eslintrc
  2. 5
      src/components/AvatarList/index.js
  3. 5
      src/components/EditableItem/index.js
  4. 23
      src/components/PageHeader/index.js
  5. 5
      src/routes/Profile/AdvancedProfile.js
  6. 2
      src/utils/utils.js

9
.eslintrc

@ -20,6 +20,15 @@
"react/jsx-no-bind": [0], "react/jsx-no-bind": [0],
"react/prop-types": [0], "react/prop-types": [0],
"react/prefer-stateless-function": [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-else-return": [0],
"no-restricted-syntax": [0], "no-restricted-syntax": [0],
"import/no-extraneous-dependencies": [0], "import/no-extraneous-dependencies": [0],

5
src/components/AvatarList/index.js

@ -28,12 +28,11 @@ const Item = ({ src, size, tips, onClick = (() => {}) }) => {
return ( return (
<li className={cls} onClick={onClick} > <li className={cls} onClick={onClick} >
{ {
tips ? tips ? (
<Tooltip title={tips}> <Tooltip title={tips}>
<Avatar src={src} size={size} style={{ cursor: 'pointer' }} /> <Avatar src={src} size={size} style={{ cursor: 'pointer' }} />
</Tooltip> </Tooltip>
: ) : <Avatar src={src} size={size} />
<Avatar src={src} size={size} />
} }
</li> </li>
); );

5
src/components/EditableItem/index.js

@ -25,7 +25,7 @@ export default class EditableItem extends PureComponent {
return ( return (
<div className={styles.editableItem}> <div className={styles.editableItem}>
{ {
editable ? editable ? (
<div className={styles.wrapper}> <div className={styles.wrapper}>
<Input <Input
value={value} value={value}
@ -38,7 +38,7 @@ export default class EditableItem extends PureComponent {
onClick={this.check} onClick={this.check}
/> />
</div> </div>
: ) : (
<div className={styles.wrapper}> <div className={styles.wrapper}>
<span>{value || ' '}</span> <span>{value || ' '}</span>
<Icon <Icon
@ -47,6 +47,7 @@ export default class EditableItem extends PureComponent {
onClick={this.edit} onClick={this.edit}
/> />
</div> </div>
)
} }
</div> </div>
); );

23
src/components/PageHeader/index.js

@ -144,17 +144,18 @@ export default class PageHeader extends PureComponent {
</div> </div>
{ {
tabList && tabList &&
tabList.length && tabList.length && (
<Tabs <Tabs
className={styles.tabs} className={styles.tabs}
defaultActiveKey={(tabDefaultValue && tabDefaultValue.key)} defaultActiveKey={(tabDefaultValue && tabDefaultValue.key)}
activeKey={activeTabKey} activeKey={activeTabKey}
onChange={this.onChange} onChange={this.onChange}
> >
{ {
tabList.map(item => <TabPane tab={item.tab} key={item.key} />) tabList.map(item => <TabPane tab={item.tab} key={item.key} />)
} }
</Tabs> </Tabs>
)
} }
</div> </div>
); );

5
src/routes/Profile/AdvancedProfile.js

@ -97,12 +97,11 @@ const popoverContent = (
</div> </div>
); );
const customDot = (dot, { status }) => (status === 'process' ? const customDot = (dot, { status }) => (status === 'process' ? (
<Popover placement="topLeft" arrowPointAtCenter content={popoverContent}> <Popover placement="topLeft" arrowPointAtCenter content={popoverContent}>
{dot} {dot}
</Popover> </Popover>
: dot ) : dot);
);
const operationTabList = [{ const operationTabList = [{
key: 'tab1', key: 'tab1',

2
src/utils/utils.js

@ -95,7 +95,7 @@ export function digitUppercase(n) {
function getRelation(str1, str2) { function getRelation(str1, str2) {
if (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 arr1 = str1.split('/');
const arr2 = str2.split('/'); const arr2 = str2.split('/');

Loading…
Cancel
Save