style: lint

pull/309/head
tangjinzhou 2018-12-14 09:56:40 +08:00
parent 326d5b9d12
commit 24549cfbbb
28 changed files with 29 additions and 105 deletions

View File

@ -2,3 +2,4 @@ node_modules/
**/*.spec.* **/*.spec.*
**/style/ **/style/
*.html *.html
/components/test/*

View File

@ -4,7 +4,7 @@ import addEventListener from '../_util/Dom/addEventListener'
import Affix from '../affix' import Affix from '../affix'
import getScroll from '../_util/getScroll' import getScroll from '../_util/getScroll'
import raf from 'raf' import raf from 'raf'
import { initDefaultProps, getClass, getStyle } from '../_util/props-util' import { initDefaultProps, getClass } from '../_util/props-util'
import BaseMixin from '../_util/BaseMixin' import BaseMixin from '../_util/BaseMixin'
function getDefaultContainer () { function getDefaultContainer () {

View File

@ -2,7 +2,6 @@ import Moment from 'moment'
import { mount } from '@vue/test-utils' import { mount } from '@vue/test-utils'
import { asyncExpect } from '@/tests/utils' import { asyncExpect } from '@/tests/utils'
import MockDate from 'mockdate' import MockDate from 'mockdate'
import Vue from 'vue'
import Calendar from '..' import Calendar from '..'
function $$ (className) { function $$ (className) {

View File

@ -4,7 +4,7 @@ import Row from '../row'
import Col from '../col' import Col from '../col'
import PropTypes from '../_util/vue-types' import PropTypes from '../_util/vue-types'
import addEventListener from '../_util/Dom/addEventListener' import addEventListener from '../_util/Dom/addEventListener'
import { getComponentFromProp, getSlotOptions, isEmptyElement, filterEmpty } from '../_util/props-util' import { getComponentFromProp, getSlotOptions, filterEmpty } from '../_util/props-util'
import throttleByAnimationFrame from '../_util/throttleByAnimationFrame' import throttleByAnimationFrame from '../_util/throttleByAnimationFrame'
import BaseMixin from '../_util/BaseMixin' import BaseMixin from '../_util/BaseMixin'

View File

@ -1,5 +1,3 @@
import PropTypes from '../_util/vue-types'
import animation from '../_util/openAnimation' import animation from '../_util/openAnimation'
import { getOptionProps, initDefaultProps } from '../_util/props-util' import { getOptionProps, initDefaultProps } from '../_util/props-util'
import VcCollapse, { collapseProps } from '../vc-collapse' import VcCollapse, { collapseProps } from '../vc-collapse'

View File

@ -1,10 +1,9 @@
import warning from 'warning'
import classNames from 'classnames' import classNames from 'classnames'
import VcDrawer from '../vc-drawer/src' import VcDrawer from '../vc-drawer/src'
import PropTypes from '../_util/vue-types' import PropTypes from '../_util/vue-types'
import BaseMixin from '../_util/BaseMixin' import BaseMixin from '../_util/BaseMixin'
import Icon from '../icon' import Icon from '../icon'
import { getComponentFromProp, getOptionProps, getClass } from '../_util/props-util' import { getComponentFromProp, getOptionProps } from '../_util/props-util'
const Drawer = { const Drawer = {
name: 'ADrawer', name: 'ADrawer',

View File

@ -6,7 +6,7 @@ import Row from '../grid/Row'
import Col, { ColProps } from '../grid/Col' import Col, { ColProps } from '../grid/Col'
import warning from '../_util/warning' import warning from '../_util/warning'
import { FIELD_META_PROP, FIELD_DATA_PROP } from './constants' import { FIELD_META_PROP, FIELD_DATA_PROP } from './constants'
import { initDefaultProps, getComponentFromProp, filterEmpty, getSlotOptions, isValidElement, getSlots, getAllChildren } from '../_util/props-util' import { initDefaultProps, getComponentFromProp, filterEmpty, getSlotOptions, isValidElement, getAllChildren } from '../_util/props-util'
import getTransitionProps from '../_util/getTransitionProps' import getTransitionProps from '../_util/getTransitionProps'
import BaseMixin from '../_util/BaseMixin' import BaseMixin from '../_util/BaseMixin'
import { cloneElement, cloneVNodes } from '../_util/vnode' import { cloneElement, cloneVNodes } from '../_util/vnode'

View File

@ -1,8 +1,6 @@
import PropTypes from '../_util/vue-types' import PropTypes from '../_util/vue-types'
import BaseMixin from '../_util/BaseMixin' import BaseMixin from '../_util/BaseMixin'
import { cloneElement } from '../_util/vnode'
import { isEmptyElement, getStyle, getOptionProps } from '../_util/props-util'
// matchMedia polyfill for // matchMedia polyfill for
// https://github.com/WickyNilliams/enquire.js/issues/82 // https://github.com/WickyNilliams/enquire.js/issues/82
let enquire = null let enquire = null

View File

@ -1,7 +1,6 @@
import { mount } from '@vue/test-utils' import { mount } from '@vue/test-utils'
import Icon from '..' import Icon from '..'
import VueIcon from '@ant-design/icons-vue' import VueIcon from '@ant-design/icons-vue'
import Tooltip from '../../tooltip'
import { getThemeFromTypeName, withThemeSuffix } from '../utils' import { getThemeFromTypeName, withThemeSuffix } from '../utils'
import { cloneElement } from '../../_util/vnode' import { cloneElement } from '../../_util/vnode'
@ -125,7 +124,6 @@ describe('Icon', () => {
render () { render () {
const component = { const component = {
render () { render () {
console.log(this.$slots.default)
return ( return (
<svg> <svg>
<defs> <defs>
@ -137,7 +135,6 @@ describe('Icon', () => {
{ {
this.$slots.default.map( this.$slots.default.map(
child => { child => {
console.log(child)
cloneElement(child, { attrs: child.type === 'path' ? { fill: 'scriptUrl(#gradient)' } : {}}) cloneElement(child, { attrs: child.type === 'path' ? { fill: 'scriptUrl(#gradient)' } : {}})
} }
) )

View File

@ -1,5 +1,4 @@
import { mount } from '@vue/test-utils' import { mount } from '@vue/test-utils'
import { asyncExpect } from '@/tests/utils'
import List from '..' import List from '..'
import Icon from '../../icon' import Icon from '../../icon'

View File

@ -1,7 +1,6 @@
import { Item, itemProps } from '../vc-menu' import { Item, itemProps } from '../vc-menu'
import { getClass, getStyle, getOptionProps } from '../_util/props-util' import { getOptionProps } from '../_util/props-util'
import { cloneVNodes } from '../_util/vnode'
import Tooltip from '../tooltip' import Tooltip from '../tooltip'
function noop () {} function noop () {}
export default { export default {

View File

@ -24,7 +24,7 @@ describe('Menu', () => {
// jest.useRealTimers() // jest.useRealTimers()
}) })
it('If has select nested submenu item ,the menu items on the grandfather level should be highlight', async () => { it('If has select nested submenu item ,the menu items on the grandfather level should be highlight', async () => {
const wrapper = mount({ mount({
render () { render () {
return ( return (
<Menu defaultSelectedKeys={['1-3-2']} mode='vertical'> <Menu defaultSelectedKeys={['1-3-2']} mode='vertical'>
@ -46,7 +46,7 @@ describe('Menu', () => {
}) })
}) })
it('should accept defaultOpenKeys in mode horizontal', async () => { it('should accept defaultOpenKeys in mode horizontal', async () => {
const wrapper = mount({ mount({
render () { render () {
return ( return (
<Menu defaultOpenKeys={['1']} mode='horizontal'> <Menu defaultOpenKeys={['1']} mode='horizontal'>
@ -65,7 +65,7 @@ describe('Menu', () => {
}) })
it('should accept defaultOpenKeys in mode inline', async () => { it('should accept defaultOpenKeys in mode inline', async () => {
const wrapper = mount({ mount({
render () { render () {
return ( return (
<Menu defaultOpenKeys={['1']} mode='inline'> <Menu defaultOpenKeys={['1']} mode='inline'>
@ -84,7 +84,7 @@ describe('Menu', () => {
}) })
it('should accept defaultOpenKeys in mode vertical', async () => { it('should accept defaultOpenKeys in mode vertical', async () => {
const wrapper = mount({ mount({
render () { render () {
return ( return (
<Menu defaultOpenKeys={['1']} mode='vertical'> <Menu defaultOpenKeys={['1']} mode='vertical'>

View File

@ -5,10 +5,10 @@ function $$ (className) {
return document.body.querySelectorAll(className) return document.body.querySelectorAll(className)
} }
describe('Popconfirm', () => { describe('Popconfirm', () => {
const eventObject = expect.objectContaining({ // const eventObject = expect.objectContaining({
target: expect.anything(), // target: expect.anything(),
preventDefault: expect.any(Function), // preventDefault: expect.any(Function),
}) // })
it('should popup Popconfirm dialog', async () => { it('should popup Popconfirm dialog', async () => {
const onVisibleChange = jest.fn() const onVisibleChange = jest.fn()

View File

@ -1,5 +1,4 @@
import Radio from './Radio' import Radio from './Radio'
import Wave from '../_util/wave'
import { getOptionProps } from '../_util/props-util' import { getOptionProps } from '../_util/props-util'
export default { export default {

View File

@ -1,5 +1,4 @@
import { mount } from '@vue/test-utils' import { mount } from '@vue/test-utils'
import { asyncExpect } from '@/tests/utils'
import Tabs from '..' import Tabs from '..'
const { TabPane } = Tabs const { TabPane } = Tabs

View File

@ -1,7 +1,6 @@
import { asyncExpect } from '@/tests/utils' import { asyncExpect } from '@/tests/utils'
import { mount } from '@vue/test-utils' import { mount } from '@vue/test-utils'
import Tooltip from '..' import Tooltip from '..'
import Button from '../../button'
describe('Tooltip', () => { describe('Tooltip', () => {
it('check `onVisibleChange` arguments', async () => { it('check `onVisibleChange` arguments', async () => {

View File

@ -4,14 +4,9 @@ import BaseMixin from '../_util/BaseMixin'
import classNames from 'classnames' import classNames from 'classnames'
import List from './list' import List from './list'
import Operation from './operation' import Operation from './operation'
// import Search from './search'
import warning from '../_util/warning'
import LocaleReceiver from '../locale-provider/LocaleReceiver' import LocaleReceiver from '../locale-provider/LocaleReceiver'
import defaultLocale from '../locale-provider/default' import defaultLocale from '../locale-provider/default'
// function noop () {
// }
export const TransferDirection = 'left' | 'right' export const TransferDirection = 'left' | 'right'
export const TransferItem = { export const TransferItem = {

View File

@ -191,7 +191,7 @@ export default {
}, },
getDialogElement () { getDialogElement () {
const { closable, prefixCls, width, height, const { closable, prefixCls, width, height,
title, footer: tempFooter, bodyStyle, visible, bodyProps, $props } = this title, footer: tempFooter, bodyStyle, visible, bodyProps } = this
const dest = {} const dest = {}
if (width !== undefined) { if (width !== undefined) {
dest.width = typeof width === 'number' ? `${width}px` : width dest.width = typeof width === 'number' ? `${width}px` : width

View File

@ -1,15 +1,10 @@
import Drawer from '../src/index' import Drawer from '../src/index'
import Menu from '../../menu/index'
import Icon from '../../icon/index'
import Button from '../../button/index' import Button from '../../button/index'
import '../assets/index.less' import '../assets/index.less'
import '../../menu/style/index' import '../../menu/style/index'
import '../../icon/style/index' import '../../icon/style/index'
import '../../button/style/index' import '../../button/style/index'
const SubMenu = Menu.SubMenu
const MenuItemGroup = Menu.ItemGroup
export default { export default {
data () { data () {
return { return {

View File

@ -1,8 +1,6 @@
import Drawer from '../src/index' import Drawer from '../src/index'
import Menu from '../../menu/index' import Menu from '../../menu/index'
import Icon from '../../icon/index' import Icon from '../../icon/index'
import Button from '../../button/index'
import Select from '../../select/index'
import '../assets/index.less' import '../assets/index.less'
import '../../menu/style/index' import '../../menu/style/index'
import '../../icon/style/index' import '../../icon/style/index'
@ -11,7 +9,6 @@ import '../../select/style/index'
const SubMenu = Menu.SubMenu const SubMenu = Menu.SubMenu
const MenuItemGroup = Menu.ItemGroup const MenuItemGroup = Menu.ItemGroup
const Option = Select.Option
export default { export default {
data () { data () {

View File

@ -12,6 +12,12 @@ export default {
return ( return (
<div> <div>
<CombinationKeyFormat /> <CombinationKeyFormat />
<Custom />
<Decimal />
<Formatter/>
<SimpleUseTouch/>
<Simple/>
<SimpleStep/>
</div> </div>
) )
}, },

View File

@ -4,7 +4,7 @@ import SubMenu from './SubMenu'
import BaseMixin from '../_util/BaseMixin' import BaseMixin from '../_util/BaseMixin'
import { getWidth, setStyle, menuAllProps } from './util' import { getWidth, setStyle, menuAllProps } from './util'
import { cloneElement } from '../_util/vnode' import { cloneElement } from '../_util/vnode'
import { getClass, getPropsData, filterEmpty } from '../_util/props-util' import { getClass, getPropsData } from '../_util/props-util'
const canUseDOM = !!( const canUseDOM = !!(
typeof window !== 'undefined' && typeof window !== 'undefined' &&
@ -104,7 +104,7 @@ const DOMWrap = {
// put all the overflowed item inside a submenu // put all the overflowed item inside a submenu
// with a title of overflow indicator ('...') // with a title of overflow indicator ('...')
const copy = this.$slots.default[0] const copy = this.$slots.default[0]
const { title, eventKey, ...rest } = getPropsData(copy) const { title, eventKey, ...rest } = getPropsData(copy) // eslint-disable-line no-unused-vars
let style = {} let style = {}
let key = `${keyPrefix}-overflowed-indicator` let key = `${keyPrefix}-overflowed-indicator`

View File

@ -5,7 +5,7 @@ import ColGroup from './ColGroup'
import TableHeader from './TableHeader' import TableHeader from './TableHeader'
import TableRow from './TableRow' import TableRow from './TableRow'
import ExpandableRow from './ExpandableRow' import ExpandableRow from './ExpandableRow'
import { mergeProps, getOptionProps } from '../../_util/props-util' import { mergeProps } from '../../_util/props-util'
import { connect } from '../../_util/store' import { connect } from '../../_util/store'
function noop () {} function noop () {}
const BaseTable = { const BaseTable = {

View File

@ -1,58 +1,6 @@
import PropTypes from '../../_util/vue-types' import PropTypes from '../../_util/vue-types'
import { SHOW_ALL, SHOW_PARENT, SHOW_CHILD } from './strategies' import { SHOW_ALL, SHOW_PARENT, SHOW_CHILD } from './strategies'
function nonEmptyStringType (props, propsName) {
const value = props[propsName]
if (typeof value !== 'string' || !value) {
return new Error() // Just a flag, so don't need message.
}
}
function valueType (props, propName, componentName) {
const labelInValueShape = PropTypes.shape({
value: nonEmptyStringType,
label: PropTypes.node,
})
if (props.labelInValue) {
const validate = PropTypes.oneOfType([
PropTypes.arrayOf(labelInValueShape),
labelInValueShape,
])
const error = validate(...arguments)
if (error) {
return new Error(
`Invalid prop \`${propName}\` supplied to \`${componentName}\`, ` +
`when \`labelInValue\` is \`true\`, \`${propName}\` should in ` +
`shape of \`{ value: string, label?: string }\`.`
)
}
} else if (props.treeCheckable && props.treeCheckStrictly) {
const validate = PropTypes.oneOfType([
PropTypes.arrayOf(labelInValueShape),
labelInValueShape,
])
const error = validate(...arguments)
if (error) {
return new Error(
`Invalid prop \`${propName}\` supplied to \`${componentName}\`, ` +
`when \`treeCheckable\` and \`treeCheckStrictly\` are \`true\`, ` +
`\`${propName}\` should in shape of \`{ value: string, label?: string }\`.`
)
}
} else if (props.multiple && props[propName] === '') {
return new Error(
`Invalid prop \`${propName}\` of type \`string\` supplied to \`${componentName}\`, ` +
`expected \`array\` when \`multiple\` is \`true\`.`
)
} else {
const validate = PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.string),
PropTypes.string,
])
return validate(...arguments)
}
}
export const SelectPropTypes = { export const SelectPropTypes = {
// className: PropTypes.string, // className: PropTypes.string,
prefixCls: PropTypes.string, prefixCls: PropTypes.string,

View File

@ -1,6 +1,5 @@
import PropTypes from '../../_util/vue-types' import PropTypes from '../../_util/vue-types'
import classnames from 'classnames' import classnames from 'classnames'
import omit from 'omit.js'
import Trigger from '../../vc-trigger' import Trigger from '../../vc-trigger'
import Tree, { TreeNode } from '../../vc-tree' import Tree, { TreeNode } from '../../vc-tree'
import { SelectPropTypes } from './PropTypes' import { SelectPropTypes } from './PropTypes'
@ -10,12 +9,10 @@ import {
flatToHierarchy, flatToHierarchy,
getValuePropValue, getValuePropValue,
labelCompatible, labelCompatible,
saveRef,
} from './util' } from './util'
import { cloneElement } from '../../_util/vnode' import { cloneElement } from '../../_util/vnode'
import { isEmptyElement, getSlotOptions, getKey, getAllProps, getComponentFromProp } from '../../_util/props-util' import { getSlotOptions, getKey, getAllProps, getComponentFromProp } from '../../_util/props-util'
import { noop } from '../../_util/vue-types/utils'
const BUILT_IN_PLACEMENTS = { const BUILT_IN_PLACEMENTS = {
bottomLeft: { bottomLeft: {

View File

@ -1,4 +1,4 @@
import { getPropsData, getAllProps, getKey, getAttrs, getSlotOptions, filterEmpty, getSlots } from '../../_util/props-util' import { getPropsData, getAllProps, getKey, getAttrs, getSlotOptions, getSlots } from '../../_util/props-util'
import { cloneVNodes, cloneElement } from '../../_util/vnode' import { cloneVNodes, cloneElement } from '../../_util/vnode'
export function toTitle (title) { export function toTitle (title) {
if (typeof title === 'string') { if (typeof title === 'string') {

View File

@ -1,7 +1,7 @@
/* eslint no-console:0 */ /* eslint no-console:0 */
/* eslint no-alert:0 */ /* eslint no-alert:0 */
import PropTypes from '../../_util/vue-types' import PropTypes from '../../_util/vue-types'
import Tree, { TreeNode } from '../index' import Tree from '../index'
import '../assets/index.less' import '../assets/index.less'
import './basic.less' import './basic.less'
@ -63,7 +63,7 @@ export default {
}, },
render () { render () {
const customLabel = ( const customLabel = ( // eslint-disable-line
<span class='cus-label'> <span class='cus-label'>
<span>operations: </span> <span>operations: </span>
<span style={{ color: 'blue' }} onClick={this.onEdit}>Edit</span>&nbsp; <span style={{ color: 'blue' }} onClick={this.onEdit}>Edit</span>&nbsp;

View File

@ -3,7 +3,6 @@ import PropTypes from '../_util/vue-types'
import Align from '../vc-align' import Align from '../vc-align'
import PopupInner from './PopupInner' import PopupInner from './PopupInner'
import LazyRenderBox from './LazyRenderBox' import LazyRenderBox from './LazyRenderBox'
import { noop } from './utils'
import animate from '../_util/css-animation' import animate from '../_util/css-animation'
export default { export default {
@ -143,7 +142,7 @@ export default {
const { align, visible, prefixCls, animation, popupStyle, getClassNameFromAlign, const { align, visible, prefixCls, animation, popupStyle, getClassNameFromAlign,
destroyPopupOnHide, stretch, destroyPopupOnHide, stretch,
} = props } = props
const { mouseenter, mouseleave } = $listeners // const { mouseenter, mouseleave } = $listeners
const className = this.getClassName(this.currentAlignClassName || const className = this.getClassName(this.currentAlignClassName ||
getClassNameFromAlign(align)) getClassNameFromAlign(align))
// const hiddenClassName = `${prefixCls}-hidden` // const hiddenClassName = `${prefixCls}-hidden`