Fix more tslint problems

This commit is contained in:
afc163 2016-07-13 17:22:23 +08:00
parent aee2b2c5ad
commit 2e41e35cc6
22 changed files with 53 additions and 51 deletions

View File

@ -48,12 +48,6 @@ export interface AffixProps {
}
export default class Affix extends React.Component<AffixProps, any> {
scrollEvent: any;
resizeEvent: any;
refs: {
fixedNode: any;
};
static propTypes = {
offsetTop: React.PropTypes.number,
offsetBottom: React.PropTypes.number,
@ -63,6 +57,12 @@ export default class Affix extends React.Component<AffixProps, any> {
onChange() {},
};
scrollEvent: any;
resizeEvent: any;
refs: {
fixedNode: any;
};
constructor(props) {
super(props);
this.state = {

View File

@ -17,7 +17,9 @@ export default class BreadcrumbItem extends React.Component {
};
render() {
const [{ prefixCls, separator, children }, restProps] = splitObject(this.props, ['prefixCls', 'separator', 'children']);
const [{ prefixCls, separator, children }, restProps] = splitObject(
this.props, ['prefixCls', 'separator', 'children']
);
let link;
if ('href' in this.props) {
link = <a className={`${prefixCls}-link`} {...restProps}>{children}</a>;

View File

@ -4,7 +4,7 @@ import splitObject from '../_util/splitObject';
export default props => {
const [{
prefixCls = 'ant-card', className, extra, bodyStyle,
title, loading, bordered = true
title, loading, bordered = true,
}, others] = splitObject(props,
['prefixCls', 'className', 'children', 'extra', 'bodyStyle', 'title', 'loading', 'bordered']);
let children = props.children;

View File

@ -33,7 +33,7 @@ export interface CarouselProps {
/** 切换面板的回调 */
beforeChange?: (from: number, to: number) => void;
/** 切换面板的回调 */
afterChange?: (current:number) => void;
afterChange?: (current: number) => void;
/** 行内样式 */
style?: React.CSSProperties;
}

View File

@ -23,9 +23,9 @@ export interface CascaderProps {
/** 指定选中项 */
value?: Array<CascaderOptionType>;
/** 选择完成后的回调 */
onChange?: (value:string, selectedOptions?:Array<CascaderOptionType>) => void;
onChange?: (value: string, selectedOptions?: Array<CascaderOptionType>) => void;
/** 选择后展示的渲染函数 */
displayRender?: (label:Array<string>, selectedOptions?:Array<CascaderOptionType>) => React.ReactNode;
displayRender?: (label: Array<string>, selectedOptions?: Array<CascaderOptionType>) => React.ReactNode;
/** 自定义样式 */
style?: React.CSSProperties;
/** 自定义类名 */

View File

@ -1,7 +1,6 @@
import * as React from 'react';
import Checkbox from './index';
import PureRenderMixin from 'react-addons-pure-render-mixin';
import assign from 'object-assign';
export interface CheckboxOptionType {
label: string;

View File

@ -26,7 +26,9 @@ export default class Checkbox extends React.Component<CheckboxProps, any> {
return PureRenderMixin.shouldComponentUpdate.apply(this, args);
}
render() {
const [{ prefixCls, style, children, className }, restProps] = splitObject(this.props, ['prefixCls', 'style', 'children', 'className']);
const [{ prefixCls, style, children, className }, restProps] = splitObject(
this.props, ['prefixCls', 'style', 'children', 'className']
);
const classString = classNames({
[className]: !!className,
[`${prefixCls}-wrapper`]: true,

View File

@ -6,9 +6,9 @@ export interface CollapseProps {
/** 初始化选中面板的key */
defaultActiveKey?: Array<string>;
/** accordion 为 true 的时候,一次只可以打开一个面板 */
accordion?:boolean;
accordion?: boolean;
/** 切换面板的回调 */
onChange?: (key:string) => void;
onChange?: (key: string) => void;
style?: React.CSSProperties;
}

View File

@ -22,7 +22,7 @@ export default class FormItem extends React.Component {
className: React.PropTypes.string,
id: React.PropTypes.string,
children: React.PropTypes.node,
colon: React.PropTypes.bool
colon: React.PropTypes.bool,
};
static contextTypes = {

View File

@ -32,4 +32,3 @@ export { Timeline }
import Tooltip from './tooltip';
export { Tooltip }

View File

@ -1,4 +1,4 @@
import React, { Component, PropTypes } from 'react';
import { Component, PropTypes } from 'react';
import classNames from 'classnames';
import calculateNodeHeight from './calculateNodeHeight';
import assign from 'object-assign';

View File

@ -33,7 +33,7 @@ export default class Line extends React.Component {
render() {
const [{
prefixCls, status, format, percent, trailColor,
type, strokeWidth, width, className, showInfo
type, strokeWidth, width, className, showInfo,
}, restProps] = splitObject(this.props,
['prefixCls', 'status', 'format', 'percent', 'trailColor', 'type', 'strokeWidth', 'width',
'className', 'showInfo']);

View File

@ -12,6 +12,11 @@ export default class Spin extends React.Component {
spinning: true,
};
static propTypes = {
className: React.PropTypes.string,
size: React.PropTypes.oneOf(['small', 'default', 'large']),
};
constructor(props) {
super(props);
const spinning = this.getSpinning(props);
@ -20,11 +25,6 @@ export default class Spin extends React.Component {
};
}
static propTypes = {
className: React.PropTypes.string,
size: React.PropTypes.oneOf(['small', 'default', 'large']),
};
isNestedPattern() {
return !!(this.props && this.props.children);
}
@ -66,7 +66,7 @@ export default class Spin extends React.Component {
render() {
const [{
className, size, prefixCls, tip
className, size, prefixCls, tip,
}, restProps] = splitObject(this.props,
['className', 'size', 'prefixCls', 'tip']);
const { spinning } = this.state;

View File

@ -729,7 +729,7 @@ export default class Table extends React.Component {
render() {
const [{
style, className
style, className,
}, restProps] = splitObject(this.props, ['style', 'className']);
const data = this.getCurrentPageData();
let columns = this.renderRowSelection();

View File

@ -1,11 +1,7 @@
import RcTabs from 'rc-tabs';
// import React, { cloneElement } from 'react';
import * as React from 'react';
const {cloneElement} = React;
const { cloneElement } = React;
import classNames from 'classnames';
import Icon from '../icon';
type TabsType = 'line' | 'card' | 'editable-card'
@ -36,12 +32,10 @@ export interface TabsProps {
style?: React.CSSProperties;
}
// Tabs
export interface TabPaneProps {
/** 选项卡头显示文字*/
/** 选项卡头显示文字 */
tab: React.ReactNode | string;
style?: React.CSSProperties;
}

View File

@ -61,7 +61,7 @@ export default class Tag extends React.Component<TagProps, any> {
render() {
const [{
prefixCls, closable, color, className, children
prefixCls, closable, color, className, children,
}, otherProps] = splitObject(
this.props,
['prefixCls', 'closable', 'color', 'className', 'children']

View File

@ -8,4 +8,3 @@ const locale = assign({}, {
}, TimepickerLocale);
export default locale;

View File

@ -8,6 +8,7 @@ export interface TimelineProps {
pending?: boolean | React.ReactNode;
style?: React.CSSProperties;
}
export default class Timeline extends React.Component<TimelineProps, any> {
static defaultProps = {
prefixCls: 'ant-timeline',
@ -15,7 +16,7 @@ export default class Timeline extends React.Component<TimelineProps, any> {
render() {
const [{
prefixCls, children, pending, className
prefixCls, children, pending, className,
}, restProps] = splitObject(this.props,
['prefixCls', 'children', 'pending', 'className']);
const pendingNode = typeof pending === 'boolean' ? null : pending;

View File

@ -20,7 +20,7 @@ export default class TimelineItem extends React.Component<TimeLineItemProps, any
render() {
const [{
prefixCls, color, last, children, pending, className, dot
prefixCls, color, last, children, pending, className, dot,
}, restProps] = splitObject(this.props,
['prefixCls', 'color', 'last', 'children', 'pending', 'className', 'dot']);

View File

@ -7,11 +7,17 @@ const placements = getPlacements({
verticalArrowShift: 8,
});
type PopoverPlacement = 'top' | 'left' | 'right' | 'bottom' | 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' | 'leftTop' | 'leftBottom' | 'rightTop' | 'rightBottom'
type PopoverPlacement =
'top' | 'left' | 'right' | 'bottom' | 'topLeft' |
'topRight' | 'bottomLeft' | 'bottomRight' | 'leftTop' |
'leftBottom' | 'rightTop' | 'rightBottom'
// Tooltip
export interface TooltipProps {
/** 气泡框位置,可选 `top` `left` `right` `bottom` `topLeft` `topRight` `bottomLeft` `bottomRight` `leftTop` `leftBottom` `rightTop` `rightBottom`*/
/**
`top` `left` `right` `bottom` `topLeft` `topRight` `bottomLeft`
`bottomRight` `leftTop` `leftBottom` `rightTop` `rightBottom`
*/
placement?: PopoverPlacement;
/** 提示文字 */
title?: string | React.ReactNode;

View File

@ -19,11 +19,11 @@ export interface TransferProps {
/** 数据源 */
dataSource: Array<TransferItem>;
/** 每行数据渲染函数 */
render?: (record:TransferItem) => any;
render?: (record: TransferItem) => any;
/** 显示在右侧框数据的key集合 */
targetKeys: Array<string>;
/** 变化时回调函数 */
onChange?: (targetKeys:Array<TransferItem>, direction:string, moveKeys:any) => void;
onChange?: (targetKeys: Array<TransferItem>, direction: string, moveKeys: any) => void;
/** 两个穿梭框的自定义样式 */
listStyle?: React.CSSProperties;
/** 自定义类*/
@ -39,7 +39,7 @@ export interface TransferProps {
/** 当列表为空时显示的内容 */
notFoundContent?: React.ReactNode | string;
/** 底部渲染函数 */
footer?: (props:any) => any;
footer?: (props: any) => any;
style?: React.CSSProperties;
}

View File

@ -29,9 +29,9 @@ export interface TreeNodeMouseEvent {
export interface TreeProps {
showLine?: boolean;
className?:string;
className?: string;
/** 是否支持多选 */
multiple?:boolean;
multiple?: boolean;
/**是否自动展开父节点 */
autoExpandParent?: boolean;
/**checkable状态下节点选择完全受控父子节点选中状态不再关联*/
@ -53,7 +53,7 @@ export interface TreeProps {
/** 默认选中的树节点 */
defaultSelectedKeys?: Array<string>;
/** 展开/收起节点时触发 */
onExpand?: (expandedKeys: Array<string>, {node: TreeNode, expanded: boolean}) => void | PromiseLike<any>;
onExpand?: (expandedKeys: Array<string>, info: { node: TreeNode, expanded: boolean }) => void | PromiseLike<any>;
/** 点击复选框触发 */
onCheck?: (checkedKeys: Array<string>, e: TreeNodeEvent) => void;
/** 点击树节点触发 */
@ -67,15 +67,15 @@ export interface TreeProps {
/** 设置节点可拖拽IE>8*/
draggable?: boolean;
/** 开始拖拽时调用 */
onDragStart?: (options:TreeNodeMouseEvent) => void;
onDragStart?: (options: TreeNodeMouseEvent) => void;
/** dragenter 触发时调用 */
onDragEnter?: (options:TreeNodeMouseEvent) => void;
onDragEnter?: (options: TreeNodeMouseEvent) => void;
/** dragover 触发时调用 */
onDragOver?: (options:TreeNodeMouseEvent) => void;
onDragOver?: (options: TreeNodeMouseEvent) => void;
/** dragleave 触发时调用 */
onDragLeave?: (options:TreeNodeMouseEvent) => void;
onDragLeave?: (options: TreeNodeMouseEvent) => void;
/** drop 触发时调用 */
onDrop?: (options:TreeNodeMouseEvent) => void;
onDrop?: (options: TreeNodeMouseEvent) => void;
style?: React.CSSProperties;
prefixCls?: string;
}