style: update code style to please lint

This commit is contained in:
Benjy Cui 2016-01-08 14:41:05 +08:00
parent b0ed0fb0ec
commit aa5c4f9595
32 changed files with 137 additions and 128 deletions

View File

@ -19,6 +19,6 @@ function monthCellRender(value) {
ReactDOM.render(
<Calendar defaultValue={new Date('2010-10-10')}
dateCellRender={dateCellRender} monthCellRender={monthCellRender} />
dateCellRender={dateCellRender} monthCellRender={monthCellRender} />
, mountNode);
````

View File

@ -12,27 +12,27 @@ import { Calendar } from 'antd';
function getListData(value) {
let listData;
switch (value.getDayOfMonth()) {
case 8:
listData = [
{ type: 'warn', content: '这里是警告事项.' },
{ type: 'normal', content: '这里是普通事项.' }
]; break;
case 10:
listData = [
{ type: 'warn', content: '这里是警告事项.' },
{ type: 'normal', content: '这里是普通事项.' },
{ type: 'error', content: '这里是错误事项.' }
]; break;
case 15:
listData = [
{ type: 'warn', content: '这里是警告事项.' },
{ type: 'normal', content: '这里是普通事项好长啊。。....' },
{ type: 'error', content: '这里是错误事项.' },
{ type: 'error', content: '这里是错误事项.' },
{ type: 'error', content: '这里是错误事项.' },
{ type: 'error', content: '这里是错误事项.' }
]; break;
default:
case 8:
listData = [
{ type: 'warn', content: '这里是警告事项.' },
{ type: 'normal', content: '这里是普通事项.' }
]; break;
case 10:
listData = [
{ type: 'warn', content: '这里是警告事项.' },
{ type: 'normal', content: '这里是普通事项.' },
{ type: 'error', content: '这里是错误事项.' }
]; break;
case 15:
listData = [
{ type: 'warn', content: '这里是警告事项.' },
{ type: 'normal', content: '这里是普通事项好长啊。。....' },
{ type: 'error', content: '这里是错误事项.' },
{ type: 'error', content: '这里是错误事项.' },
{ type: 'error', content: '这里是错误事项.' },
{ type: 'error', content: '这里是错误事项.' }
]; break;
default:
}
return listData || [];
}

View File

@ -24,19 +24,19 @@ const App = React.createClass({
<p style={{marginBottom: '20px'}}>
<label>
<Checkbox checked={this.state.checked}
disabled={this.state.disabled}
onChange={this.onChange} />
disabled={this.state.disabled}
onChange={this.onChange} />
{label}
</label>
</p>
<p>
<Button type="primary" size="small"
onClick={this.toggleChecked}>
onClick={this.toggleChecked}>
{!this.state.checked ? '选中' : '取消'}
</Button>
<Button style={{marginLeft: '10px'}}
type="primary" size="small"
onClick={this.toggleDisable}>
type="primary" size="small"
onClick={this.toggleDisable}>
{!this.state.disabled ? '不可用' : '可用'}
</Button>
</p>

View File

@ -38,13 +38,13 @@ const DateRange = React.createClass({
return (
<div>
<DatePicker disabledDate={this.disabledStartDate}
value={this.state.startValue}
placeholder="开始日期"
onChange={this.onChange.bind(this, 'startValue')} />
value={this.state.startValue}
placeholder="开始日期"
onChange={this.onChange.bind(this, 'startValue')} />
<DatePicker disabledDate={this.disabledEndDate}
value={this.state.endValue}
placeholder="结束日期"
onChange={this.onChange.bind(this, 'endValue')} />
value={this.state.endValue}
placeholder="结束日期"
onChange={this.onChange.bind(this, 'endValue')} />
</div>
);
}

View File

@ -46,7 +46,7 @@ const SearchInput = React.createClass({
return (
<InputGroup className={searchCls} style={this.props.style}>
<Input {...this.props} value={this.state.value} onChange={this.handleInputChange}
onFocus={this.handleFocusBlur} onBlur={this.handleFocusBlur} />
onFocus={this.handleFocusBlur} onBlur={this.handleFocusBlur} />
<div className="ant-input-group-wrap">
<Button className={btnCls} onClick={this.handleSearch}>
<Icon type="search" />

View File

@ -32,12 +32,12 @@ const Sider = React.createClass({
render() {
return (
<Menu onClick={this.handleClick}
style={{width: 240}}
openKeys={this.state.openKeys}
onOpen={this.onToggle}
onClose={this.onToggle}
selectedKeys={[this.state.current]}
mode="inline">
style={{width: 240}}
openKeys={this.state.openKeys}
onOpen={this.onToggle}
onClose={this.onToggle}
selectedKeys={[this.state.current]}
mode="inline">
<SubMenu key="sub1" title={<span><Icon type="mail" /><span>导航一</span></span>}>
<Menu.Item key="1">选项1</Menu.Item>
<Menu.Item key="2">选项2</Menu.Item>

View File

@ -26,10 +26,10 @@ const Sider = React.createClass({
render() {
return (
<Menu onClick={this.handleClick}
style={{width: 240}}
defaultOpenKeys={['sub1']}
selectedKeys={[this.state.current]}
mode="inline">
style={{width: 240}}
defaultOpenKeys={['sub1']}
selectedKeys={[this.state.current]}
mode="inline">
<SubMenu key="sub1" title={<span><Icon type="mail" /><span>导航一</span></span>}>
<MenuItemGroup title="分组1">
<Menu.Item key="1">选项1</Menu.Item>

View File

@ -34,11 +34,11 @@ const Sider = React.createClass({
<br />
<br />
<Menu theme={this.state.theme}
onClick={this.handleClick}
style={{width: 240}}
defaultOpenKeys={['sub1']}
selectedKeys={[this.state.current]}
mode="inline">
onClick={this.handleClick}
style={{width: 240}}
defaultOpenKeys={['sub1']}
selectedKeys={[this.state.current]}
mode="inline">
<SubMenu key="sub1" title={<span><Icon type="mail" /><span>导航一</span></span>}>
<Menu.Item key="1">选项1</Menu.Item>
<Menu.Item key="2">选项2</Menu.Item>

View File

@ -44,10 +44,10 @@ const Test = React.createClass({
<div>
<Button type="primary" onClick={this.showModal}>显示对话框</Button>
<Modal title="对话框标题"
visible={this.state.visible}
onOk={this.handleOk}
confirmLoading={this.state.confirmLoading}
onCancel={this.handleCancel}>
visible={this.state.visible}
onOk={this.handleOk}
confirmLoading={this.state.confirmLoading}
onCancel={this.handleCancel}>
<p>{this.state.ModalText}</p>
</Modal>
</div>

View File

@ -34,7 +34,7 @@ const App = React.createClass({
<div>
<Button type="primary" onClick={this.showModal}>显示对话框</Button>
<Modal title="第一个 Modal" visible={this.state.visible}
onOk={this.handleOk} onCancel={this.handleCancel}>
onOk={this.handleOk} onCancel={this.handleCancel}>
<p>对话框的内容</p>
<p>对话框的内容</p>
<p>对话框的内容</p>

View File

@ -37,14 +37,14 @@ const Test = React.createClass({
显示对话框
</Button>
<Modal ref="modal"
visible={this.state.visible}
title="对话框标题" onOk={this.handleOk} onCancel={this.handleCancel}
footer={[
<Button key="back" type="ghost" size="large" onClick={this.handleCancel}>返 回</Button>,
<Button key="submit" type="primary" size="large" loading={this.state.loading} onClick={this.handleOk}>
提 交
</Button>
]}>
visible={this.state.visible}
title="对话框标题" onOk={this.handleOk} onCancel={this.handleCancel}
footer={[
<Button key="back" type="ghost" size="large" onClick={this.handleCancel}>返 回</Button>,
<Button key="submit" type="primary" size="large" loading={this.state.loading} onClick={this.handleOk}>
提 交
</Button>
]}>
<p>对话框的内容</p>
<p>对话框的内容</p>
<p>对话框的内容</p>

View File

@ -33,8 +33,8 @@ const LocalizedModal = React.createClass({
<div>
<Button type="primary" onClick={this.showModal}>Show Modal</Button>
<Modal title="Modal" visible={this.state.visible}
onOk={this.handleOk} onCancel={this.handleCancel}
okText="OK" cancelText="Cancel">
onOk={this.handleOk} onCancel={this.handleCancel}
okText="OK" cancelText="Cancel">
<p>Bla bla ...</p>
<p>Bla bla ...</p>
<p>Bla bla ...</p>

View File

@ -44,8 +44,8 @@ let App = React.createClass({
return (
<div>
<Popconfirm title="确定要删除这个任务吗?"
visible={this.state.visible} onVisibleChange={this.handleVisibleChange}
onConfirm={this.confirm} onCancel={this.cancel}>
visible={this.state.visible} onVisibleChange={this.handleVisibleChange}
onConfirm={this.confirm} onCancel={this.cancel}>
<a href="#">删除某任务</a>
</Popconfirm>
<br />

View File

@ -31,7 +31,7 @@ const App = React.createClass({
);
return (
<Popover overlay={content} title="标题" trigger="click"
visible={this.state.visible} onVisibleChange={this.handleVisibleChange}>
visible={this.state.visible} onVisibleChange={this.handleVisibleChange}>
<Button type="primary">点击弹出卡片</Button>
</Popover>
);

View File

@ -14,7 +14,7 @@ import { QueueAnim, Menu } from 'antd';
const App = React.createClass({
render() {
const key = this.props.location.pathname;
const keys = key.replace('/', '') ? [ key.replace('/', '') ] : [ 'home' ];
const keys = key.replace('/', '') ? [key.replace('/', '')] : ['home'];
return (
<div>
<Menu style={{marginBottom: 10}} mode="horizontal" selectedKeys={keys}>

View File

@ -35,10 +35,10 @@ const Test = React.createClass({
// filterOption 需要设置为 false数据是动态设置的
return (
<Select combobox
style={{width: 200}}
onChange={this.handleChange}
filterOption={false}
searchPlaceholder="请输入账户名">
style={{width: 200}}
onChange={this.handleChange}
filterOption={false}
searchPlaceholder="请输入账户名">
{this.state.options}
</Select>
);

View File

@ -22,8 +22,8 @@ function handleChange(value) {
ReactDOM.render(
<Select multiple
style={{width: 400}}
defaultValue={['a10', 'c12']} onChange={handleChange}>
style={{width: 400}}
defaultValue={['a10', 'c12']} onChange={handleChange}>
{children}
</Select>
, mountNode);

View File

@ -17,9 +17,9 @@ function handleChange(value) {
ReactDOM.render(
<Select defaultValue="lucy"
style={{width: 200}}
showSearch={false}
onChange={handleChange}>
style={{width: 200}}
showSearch={false}
onChange={handleChange}>
<OptGroup label="Manager">
<Option value="jack">jack</Option>
<Option value="lucy">lucy</Option>

View File

@ -16,8 +16,8 @@ function handleChange(value) {
ReactDOM.render(
<Select defaultValue="lucy" showSearch style={{width: 200}}
searchPlaceholder="输入"
onChange={handleChange}>
searchPlaceholder="输入"
onChange={handleChange}>
<Option value="jack">jack</Option>
<Option value="lucy">lucy</Option>
<Option value="disabled" disabled>disabled</Option>

View File

@ -22,8 +22,8 @@ function handleChange(value) {
ReactDOM.render(
<Select tags
style={{width: '100%'}}
searchPlaceholder="标签模式"
style={{width: '100%'}}
searchPlaceholder="标签模式"
onChange={handleChange}>
{children}
</Select>

View File

@ -23,8 +23,8 @@ const Card = React.createClass({
render() {
const container = (
<Alert message="消息提示的文案"
description="消息提示的辅助性文字介绍消息提示的辅助性文字介绍消息提示的辅助性文字介绍"
type="info" />
description="消息提示的辅助性文字介绍消息提示的辅助性文字介绍消息提示的辅助性文字介绍"
type="info" />
);
return (
<div>

View File

@ -87,10 +87,10 @@ const Test = React.createClass({
render() {
return (
<Table columns={columns}
dataSource={this.state.data}
pagination={this.state.pagination}
loading={this.state.loading}
onChange={this.handleTableChange} />
dataSource={this.state.data}
pagination={this.state.pagination}
loading={this.state.loading}
onChange={this.handleTableChange} />
);
}
});

View File

@ -64,7 +64,7 @@ const App = React.createClass({
<div>
<div style={{marginBottom: 16}}>
<Button type="primary" onClick={this.start}
disabled={!hasSelected} loading={loading}>操作</Button>
disabled={!hasSelected} loading={loading}>操作</Button>
<span style={{marginLeft: 8}}>{hasSelected ? `选择了 ${selectedRowKeys.length} 个对象` : ''}</span>
</div>
<Table rowSelection={rowSelection} columns={columns} dataSource={data} />

View File

@ -26,7 +26,7 @@ const Demo = React.createClass({
<div style={{marginBottom: 16}}>
页签位置:
<Select value={this.state.tabPosition} onChange={this.changeTabPosition}
dropdownMatchSelectWidth={false}>
dropdownMatchSelectWidth={false}>
<Option value="top">top</Option>
<Option value="bottom">bottom</Option>
<Option value="left">left</Option>

View File

@ -43,7 +43,7 @@ const App = React.createClass({
renderFooter() {
return (
<Button type="ghost" size="small" style={{ float: 'right', margin: '5' }}
onClick={this.getMock}>
onClick={this.getMock}>
刷新
</Button>
);

View File

@ -42,7 +42,7 @@ const App = React.createClass({
renderFooter() {
return (
<Button type="primary" size="small" style={{ float: 'right', margin: '5' }}
onClick={this.getMock}>
onClick={this.getMock}>
刷新
</Button>
);

View File

@ -30,10 +30,10 @@ const Demo = React.createClass({
<div style={{margin: 20}}>
<h2>Single Select</h2>
<TreeSelect style={{width: 300}} showSearch
value={this.state.value} optionLabelProp="title"
dropdownMenuStyle={{maxHeight: 200, overflow: 'auto'}}
treeDefaultExpandAll
onChange={this.onChange}>
value={this.state.value} optionLabelProp="title"
dropdownMenuStyle={{maxHeight: 200, overflow: 'auto'}}
treeDefaultExpandAll
onChange={this.onChange}>
<TreeNode value="parent 1" title="parent 1" key="0-1">
<TreeNode value="parent 1-0" title="parent 1-0" key="0-1-1">
<TreeNode value="leaf1" title="my leaf" key="random" />

View File

@ -175,9 +175,9 @@ const Demo = React.createClass({
return (<div>
<h2>controlled</h2>
<Tree checkable multiple={this.props.multiple} defaultExpandAll
onExpand={this.onExpand} expandedKeys={this.state.expandedKeys}
onCheck={this.onCheck} checkedKeys={this.state.checkedKeys}
onSelect={this.onSelect} selectedKeys={this.state.selectedKeys}>
onExpand={this.onExpand} expandedKeys={this.state.expandedKeys}
onCheck={this.onCheck} checkedKeys={this.state.checkedKeys}
onSelect={this.onSelect} selectedKeys={this.state.selectedKeys}>
{loop(gData)}
</Tree>
</div>);

View File

@ -50,11 +50,11 @@ const Demo = React.createClass({
return (<div style={{margin: '0 20px'}}>
<h2>simple</h2>
<Tree className="myCls" showLine multiple checkable
defaultExpandedKeys={this.state.defaultExpandedKeys}
onExpand={this.onExpand}
defaultSelectedKeys={this.state.defaultSelectedKeys}
defaultCheckedKeys={this.state.defaultCheckedKeys}
onSelect={this.onSelect} onCheck={this.onCheck}>
defaultExpandedKeys={this.state.defaultExpandedKeys}
onExpand={this.onExpand}
defaultSelectedKeys={this.state.defaultSelectedKeys}
defaultCheckedKeys={this.state.defaultCheckedKeys}
onSelect={this.onSelect} onCheck={this.onCheck}>
<TreeNode title="parent 1" key="0-0">
<TreeNode title="parent 1-0" key="0-0-0" disabled>
<TreeNode title="leaf" key="0-0-0-0" disableCheckbox />

View File

@ -108,10 +108,9 @@ const Demo = React.createClass({
<p>drag a node into another node</p>
<div className="draggable-container">
<Tree defaultExpandedKeys={this.state.expandedKeys} openAnimation={{}} draggable
onTreeDragStart={this.onTreeDragStart}
onTreeDragEnter={this.onTreeDragEnter}
onTreeDrop={this.onTreeDrop}
>
onTreeDragStart={this.onTreeDragStart}
onTreeDragEnter={this.onTreeDragEnter}
onTreeDrop={this.onTreeDrop}>
{loop(this.state.gData)}
</Tree>
</div>

View File

@ -62,9 +62,9 @@ const Demo = React.createClass({
const status = this.state.status;
const classes = classNames({
'error': status[item].errors,
'validating': status[item].isValidating,
'success': formData[item] && !status[item].errors && !status[item].isValidating
error: status[item].errors,
validating: status[item].isValidating,
success: formData[item] && !status[item].errors && !status[item].isValidating
});
return classes;
@ -160,9 +160,15 @@ const Demo = React.createClass({
validateStatus={this.renderValidateStyle('pass')}
help={status.pass.errors ? status.pass.errors.join(',') : null}
required>
<Validator rules={[{required: true, whitespace: true, message: '请填写密码'}, {validator: this.checkPass}]} trigger="onChange">
<Input name="pass" id="confirmPass" type="password" onContextMenu={noop} onPaste={noop} onCopy={noop} onCut={noop} autoComplete="off" value={formData.pass}/>
</Validator>
<Validator rules={[
{required: true, whitespace: true, message: '请填写密码'},
{validator: this.checkPass}
]}
trigger="onChange">
<Input name="pass" id="confirmPass" type="password"
onContextMenu={noop} onPaste={noop} onCopy={noop} onCut={noop}
autoComplete="off" value={formData.pass}/>
</Validator>
</FormItem>
</Col>
<Col span="6">
@ -185,8 +191,10 @@ const Demo = React.createClass({
whitespace: true,
message: '请再次输入密码'
}, {validator: this.checkPass2}]}>
<Input name="rePass" id="confirmPass2" type="password" onContextMenu={noop} onPaste={noop} onCopy={noop} onCut={noop} autoComplete="off" value={formData.rePass}/>
</Validator>
<Input name="rePass" id="confirmPass2" type="password"
onContextMenu={noop} onPaste={noop} onCopy={noop} onCut={noop}
autoComplete="off" value={formData.rePass}/>
</Validator>
</FormItem>
</Col>
<Col span="6">

View File

@ -51,9 +51,9 @@ const Demo = React.createClass({
const status = this.state.status;
const classes = cx({
'error': status[item].errors,
'validating': status[item].isValidating,
'success': formData[item] && !status[item].errors && !status[item].isValidating
error: status[item].errors,
validating: status[item].isValidating,
success: formData[item] && !status[item].errors && !status[item].isValidating
});
return classes;
@ -112,15 +112,16 @@ const Demo = React.createClass({
validateStatus={this.renderValidateStyle('select')}
help={status.select.errors ? status.select.errors.join(',') : null}
required>
<Validator rules={[{required: true, message: '请选择您的国籍'}]}>
<Select size="large" placeholder="请选择国家" style={{width: '100%'}} name="select" value={formData.select}>
<Option value="china">中国</Option>
<Option value="use">美国</Option>
<Option value="japan">日本</Option>
<Option value="korean">韩国</Option>
<Option value="Thailand">泰国</Option>
</Select>
</Validator>
<Validator rules={[{required: true, message: '请选择您的国籍'}]}>
<Select size="large" placeholder="请选择国家" style={{width: '100%'}}
name="select" value={formData.select}>
<Option value="china">中国</Option>
<Option value="use">美国</Option>
<Option value="japan">日本</Option>
<Option value="korean">韩国</Option>
<Option value="Thailand">泰国</Option>
</Select>
</Validator>
</FormItem>
<FormItem
@ -131,7 +132,8 @@ const Demo = React.createClass({
help={status.multiSelect.errors ? status.multiSelect.errors.join(',') : null}
required>
<Validator rules={[{required: true, message: '请选择您喜欢的颜色', type: 'array'}]}>
<Select multiple size="large" placeholder="请选择颜色" style={{width: '100%'}} name="multiSelect" value={formData.multiSelect}>
<Select multiple size="large" placeholder="请选择颜色" style={{width: '100%'}}
name="multiSelect" value={formData.multiSelect}>
<Option value="red">红色</Option>
<Option value="orange">橙色</Option>
<Option value="yellow">黄色</Option>