Skip to content

Commit

Permalink
fix: fix eslint warning
Browse files Browse the repository at this point in the history
  • Loading branch information
yiyunwan committed Jul 4, 2022
1 parent 1ce30fa commit f34b0ea
Show file tree
Hide file tree
Showing 15 changed files with 20 additions and 32 deletions.
1 change: 1 addition & 0 deletions packages/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"@typescript-eslint/explicit-module-boundary-types": 0,
"@typescript-eslint/triple-slash-reference": 0,
"@typescript-eslint/no-empty-function": 0,
"vue/require-prop-types": 0,
"no-console": [
"error",
{
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/__builtins__/shared/create-context.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Component, DefineComponent } from 'vue'
import type { DefineComponent } from 'vue'
import {
defineComponent,
provide,
Expand Down Expand Up @@ -32,7 +32,7 @@ export const createContext = <T>(defaultValue?: T): CreateContext<T> => {
},
setup(props, { slots }) {
const value = toRef(props, 'value' as never)
provide(injectKey, readonly(value))
provide(injectKey, readonly(value as never))
return () => slots?.default?.()
},
}),
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/__builtins__/shared/portal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const createPortalProvider = (id: string | symbol) => {
},
},

setup(props, { slots }) {
setup(props) {
onBeforeUnmount(() => {
const { id } = props
if (id && PortalMap.has(id)) {
Expand Down
3 changes: 0 additions & 3 deletions packages/components/src/array-base/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,6 @@ const ArrayBaseItem = defineComponent({
const ArrayBaseSortHandle = defineComponent({
name: 'ArrayBaseSortHandle',
props: ['index'],
directives: {
// handle: HandleDirective,
},
setup(props, { attrs }) {
const array = useArray()
const prefixCls = `${stylePrefix}-array-base`
Expand Down
6 changes: 3 additions & 3 deletions packages/components/src/array-table/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,9 @@ const StatusSelect = observer(
return (props.options as { label: string; value: number }[])?.map(
({ label, value }) => {
const hasError = errors.some(({ address }) => {
const currentIndex = parseIndex(address!)
const startIndex = (value - 1) * props.pageSize!
const endIndex = value * props.pageSize!
const currentIndex = parseIndex(address)
const startIndex = (value - 1) * props.pageSize
const endIndex = value * props.pageSize
return (
currentIndex >= startIndex && currentIndex <= endIndex
)
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/array-tabs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export const ArrayTabs = observer(
onEdit(null, 'add')
!(attrs as any)?.['tab-add']?.()
},
onChange: (...args: any[]) => {},
onChange: () => {},
},
{
default: () => [renderItems()],
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/cascader/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineComponent, h } from 'vue'
import { connect, mapProps, mapReadPretty, useField } from '@formily/vue'
import { useField } from '@formily/vue'
import { observer } from '@formily/reactive-vue'
import { isVoidField, Field } from '@formily/core'
import { ElCascader } from 'element-plus'
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/checkbox/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ const CheckboxGroupOption: Component = defineComponent({
optionType: customProps.optionType,
},
slots?.option
? { default: () => slots.option!({ option }) }
? { default: () => slots.option({ option }) }
: {}
)
} else {
Expand All @@ -117,7 +117,7 @@ const CheckboxGroupOption: Component = defineComponent({
optionType: customProps.optionType,
},
slots?.option
? { default: () => slots.option!({ option }) }
? { default: () => slots.option({ option }) }
: {}
)
}
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/form-collapse/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
import { observer } from '@formily/reactive-vue'
import { Schema, SchemaKey } from '@formily/json-schema'
import { ElCollapse, ElCollapseItem, ElBadge } from 'element-plus'
import type { ElCollapseItem as ElCollapseItemProps } from 'element-plus'
import { toArr } from '@formily/shared'
import { GeneralField } from '@formily/core'

Expand Down Expand Up @@ -105,6 +104,7 @@ const FormCollapse = observer(
type: [String, Number],
},
},
emits: ['input'],
setup(props, { attrs, emit }) {
const field = useField()
const schema = useFieldSchema()
Expand Down
9 changes: 2 additions & 7 deletions packages/components/src/form-item/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {
ref,
defineComponent,
onMounted,
Ref,
onBeforeUnmount,
watch,
Expand All @@ -11,10 +10,6 @@ import {
import { isVoidField } from '@formily/core'
import { connect, mapProps } from '@formily/vue'

// error: () => h('i', { class: 'el-icon-circle-close' }, {}),
// success: () => h('i', { class: 'el-icon-circle-check' }, {}),
// warning: () => h('i', { class: 'el-icon-warning-outline' }, {}),

import {
InfoFilled,
CircleClose,
Expand All @@ -26,7 +21,7 @@ import { composeExport, resolveComponent, stylePrefix } from '../__builtins__'
import { Component } from 'vue'
import { ElTooltip, ElIcon } from 'element-plus'
import ResizeObserver from 'resize-observer-polyfill'
import { IFormGridProps, useGridColumn } from '../form-grid'
import { useGridColumn } from '../form-grid'

export type FormItemProps = {
className?: string
Expand Down Expand Up @@ -149,7 +144,7 @@ export const FormBaseItem = defineComponent({
bordered: { default: true },
inset: { default: false },
},
setup(props, { slots, attrs }) {
setup(props, { slots }) {
const active = ref(false)
const deepLayoutRef = useFormLayout()
const prefixCls = `${stylePrefix}-form-item`
Expand Down
10 changes: 2 additions & 8 deletions packages/components/src/form-layout/useResponsiveFormLayout.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { isArr, isValid } from '@formily/shared'
import { onMounted, Ref, ref, getCurrentInstance } from 'vue'
import type, { ComponentInternalInstance } from 'vue'
import { onMounted, ref, getCurrentInstance } from 'vue'
import type { ComponentInternalInstance } from 'vue'

interface IProps {
breakpoints?: number[]
Expand All @@ -24,12 +24,6 @@ interface ICalculateProps {
(target: Element, props: IProps): IProps
}

interface IUseResponsiveFormLayout {
(props: IProps): {
props: Ref<IProps>
}
}

const calcBreakpointIndex: ICalcBreakpointIndex = (breakpoints, width) => {
for (let i = 0; i < breakpoints.length; i++) {
if (width <= breakpoints[i]) {
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/form-tab/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ const FormTab = observer(
type: String,
},
},
emits: ['input'],
setup(props, { attrs, emit }: any) {
const field = useField()
const prefixCls = `${stylePrefix}-form-tab`
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/form/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, VNode, defineComponent } from 'vue'
import type, { SetupContext } from 'vue'
import type { SetupContext } from 'vue'
import { Form as FormType, IFormFeedback } from '@formily/core'
import { FormProvider as _FormProvider, useForm, h } from '@formily/vue'

Expand Down
1 change: 0 additions & 1 deletion packages/components/src/preview-text/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { observer } from '@formily/reactive-vue'
import { useField } from '@formily/vue'
import { isArr, isValid } from '@formily/shared'
import { stylePrefix } from '../__builtins__/configs'
import { InputProps } from '../input'
import type { SelectProps } from '../select'
import type { CascaderProps } from '../cascader'
import type { DatePickerProps } from '../date-picker'
Expand Down
3 changes: 2 additions & 1 deletion packages/components/src/upload/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@ const UploadWrapper = defineComponent({
type: Array,
},
},
emits: ['change'],
setup(curProps: any, { slots, attrs, emit }) {
return () => {
const fieldRef = useField<Field>()
const setFeedBack = (error?: ErrorEvent) => {
const message = curProps.errorAdaptor!(error)
const message = curProps.errorAdaptor(error)

fieldRef.value.setFeedback({
type: 'error',
Expand Down

0 comments on commit f34b0ea

Please sign in to comment.