style: lint

This commit is contained in:
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.*
**/style/
*.html
/components/test/*

View File

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

View File

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

View File

@ -4,7 +4,7 @@ import Row from '../row'
import Col from '../col'
import PropTypes from '../_util/vue-types'
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 BaseMixin from '../_util/BaseMixin'

View File

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

View File

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

View File

@ -6,7 +6,7 @@ import Row from '../grid/Row'
import Col, { ColProps } from '../grid/Col'
import warning from '../_util/warning'
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 BaseMixin from '../_util/BaseMixin'
import { cloneElement, cloneVNodes } from '../_util/vnode'

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -4,7 +4,7 @@ import SubMenu from './SubMenu'
import BaseMixin from '../_util/BaseMixin'
import { getWidth, setStyle, menuAllProps } from './util'
import { cloneElement } from '../_util/vnode'
import { getClass, getPropsData, filterEmpty } from '../_util/props-util'
import { getClass, getPropsData } from '../_util/props-util'
const canUseDOM = !!(
typeof window !== 'undefined' &&
@ -104,7 +104,7 @@ const DOMWrap = {
// put all the overflowed item inside a submenu
// with a title of overflow indicator ('...')
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 key = `${keyPrefix}-overflowed-indicator`

View File

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

View File

@ -1,58 +1,6 @@
import PropTypes from '../../_util/vue-types'
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 = {
// className: PropTypes.string,
prefixCls: PropTypes.string,

View File

@ -1,6 +1,5 @@
import PropTypes from '../../_util/vue-types'
import classnames from 'classnames'
import omit from 'omit.js'
import Trigger from '../../vc-trigger'
import Tree, { TreeNode } from '../../vc-tree'
import { SelectPropTypes } from './PropTypes'
@ -10,12 +9,10 @@ import {
flatToHierarchy,
getValuePropValue,
labelCompatible,
saveRef,
} from './util'
import { cloneElement } from '../../_util/vnode'
import { isEmptyElement, getSlotOptions, getKey, getAllProps, getComponentFromProp } from '../../_util/props-util'
import { noop } from '../../_util/vue-types/utils'
import { getSlotOptions, getKey, getAllProps, getComponentFromProp } from '../../_util/props-util'
const BUILT_IN_PLACEMENTS = {
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'
export function toTitle (title) {
if (typeof title === 'string') {

View File

@ -1,7 +1,7 @@
/* eslint no-console:0 */
/* eslint no-alert:0 */
import PropTypes from '../../_util/vue-types'
import Tree, { TreeNode } from '../index'
import Tree from '../index'
import '../assets/index.less'
import './basic.less'
@ -63,7 +63,7 @@ export default {
},
render () {
const customLabel = (
const customLabel = ( // eslint-disable-line
<span class='cus-label'>
<span>operations: </span>
<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 PopupInner from './PopupInner'
import LazyRenderBox from './LazyRenderBox'
import { noop } from './utils'
import animate from '../_util/css-animation'
export default {
@ -143,7 +142,7 @@ export default {
const { align, visible, prefixCls, animation, popupStyle, getClassNameFromAlign,
destroyPopupOnHide, stretch,
} = props
const { mouseenter, mouseleave } = $listeners
// const { mouseenter, mouseleave } = $listeners
const className = this.getClassName(this.currentAlignClassName ||
getClassNameFromAlign(align))
// const hiddenClassName = `${prefixCls}-hidden`