Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: lint 问题解决 #1406

Merged
merged 1 commit into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ module.exports = {
'no-param-reassign': 0,
'prefer-destructuring': 0,
'react/require-default-props': 0,
'react/no-unused-class-component-methods': 0,
'react/jsx-no-constructed-context-values': 0,
'react/no-unstable-nested-components': 0,
'react/sort-comp': [
0,
{
Expand Down
4 changes: 3 additions & 1 deletion src/packages/avatar/avatar.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,9 @@ export const Avatar: FunctionComponent<
<div className="text">
{parent?.propAvatarGroup?.maxContent
? parent?.propAvatarGroup?.maxContent
: `+ ${avatarIndex - parent?.propAvatarGroup?.max}`}
: `+ ${
avatarIndex - Number(parent?.propAvatarGroup?.max || 0)
}`}
</div>
)}
</div>
Expand Down
4 changes: 3 additions & 1 deletion src/packages/avatar/avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,9 @@ export const Avatar: FunctionComponent<
<div className="text">
{parent?.propAvatarGroup?.maxContent
? parent?.propAvatarGroup?.maxContent
: `+ ${avatarIndex - parent?.propAvatarGroup?.max}`}
: `+ ${
avatarIndex - Number(parent?.propAvatarGroup?.max || 0)
}`}
</div>
)}
</div>
Expand Down
5 changes: 3 additions & 2 deletions src/packages/barrage/barrage.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,9 @@ const InternalBarrage: ForwardRefRenderFunction<
)
}

export const Barrage =
React.forwardRef<unknown, Partial<BarrageProps>>(InternalBarrage)
export const Barrage = React.forwardRef<unknown, Partial<BarrageProps>>(
InternalBarrage
)

Barrage.defaultProps = defaultProps
Barrage.displayName = 'NutBarrage'
5 changes: 3 additions & 2 deletions src/packages/barrage/barrage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,9 @@ const InternalBarrage: ForwardRefRenderFunction<
)
}

export const Barrage =
React.forwardRef<unknown, Partial<BarrageProps>>(InternalBarrage)
export const Barrage = React.forwardRef<unknown, Partial<BarrageProps>>(
InternalBarrage
)

Barrage.defaultProps = defaultProps
Barrage.displayName = 'NutBarrage'
5 changes: 4 additions & 1 deletion src/packages/cascader/__tests__/cascader.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import { CascaderOption } from '../types'
import Tree from '../tree'
import { formatTree, convertListToOptions } from '../helper'

const later = (t = 0) => new Promise((r) => setTimeout(r, t))
const later = (t = 0) =>
new Promise((r) => {
setTimeout(r, t)
})
const mockOptions = [
{
value: '浙江',
Expand Down
17 changes: 8 additions & 9 deletions src/packages/checkboxgroup/context.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { createContext } from 'react'

const CheckboxGroupContext =
createContext<{
labelPosition: 'left' | 'right'
disabled: boolean | undefined
value: string[]
max: number | undefined
check: (value: string) => void
uncheck: (value: string) => void
} | null>(null)
const CheckboxGroupContext = createContext<{
labelPosition: 'left' | 'right'
disabled: boolean | undefined
value: string[]
max: number | undefined
check: (value: string) => void
uncheck: (value: string) => void
} | null>(null)

export default CheckboxGroupContext
5 changes: 3 additions & 2 deletions src/packages/countdown/countdown.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,9 @@ const InternalCountDown: ForwardRefRenderFunction<
)
}

export const CountDown =
React.forwardRef<unknown, Partial<CountDownProps>>(InternalCountDown)
export const CountDown = React.forwardRef<unknown, Partial<CountDownProps>>(
InternalCountDown
)

CountDown.defaultProps = defaultProps
CountDown.displayName = 'NutCountDown'
5 changes: 3 additions & 2 deletions src/packages/countdown/countdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,9 @@ const InternalCountDown: ForwardRefRenderFunction<
)
}

export const CountDown =
React.forwardRef<unknown, Partial<CountDownProps>>(InternalCountDown)
export const CountDown = React.forwardRef<unknown, Partial<CountDownProps>>(
InternalCountDown
)

CountDown.defaultProps = defaultProps
CountDown.displayName = 'NutCountDown'
2 changes: 1 addition & 1 deletion src/packages/ellipsis/ellipsis.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export const Ellipsis: FunctionComponent<
if (direction === 'end') {
ellipsis.current.leading = ellipsis.current?.leading?.slice(
0,
ellipsis.current?.leading.length - 1
(ellipsis.current?.leading?.length || 0) - 1
)
} else {
ellipsis.current.tailing = ellipsis.current?.tailing?.slice(
Expand Down
4 changes: 2 additions & 2 deletions src/packages/inputnumber/inputnumber.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ export const InputNumber: FunctionComponent<
const changeFormatValue = (e: ChangeEvent<HTMLInputElement>) => {
const input = e.target.value

const numReg = new RegExp('^[0-9]*$')
const numReg = /^[0-9]*$/
const numValue = input.replace(/[^0-9|.]/gi, '')

if (formatter) {
Expand All @@ -223,7 +223,7 @@ export const InputNumber: FunctionComponent<
const burFormatValue = (e: ChangeEvent<HTMLInputElement>) => {
const input = e.target.value

const numReg = new RegExp('^[0-9]*$')
const numReg = /^[0-9]*$/
const numValue = input.replace(/[^0-9|.]/gi, '')
if (formatter) {
if (formatter(numValue) === input) {
Expand Down
4 changes: 2 additions & 2 deletions src/packages/inputnumber/inputnumber.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ export const InputNumber: FunctionComponent<
const changeFormatValue = (e: ChangeEvent<HTMLInputElement>) => {
const input = e.target.value

const numReg = new RegExp('^[0-9]*$')
const numReg = /^[0-9]*$/
const numValue = input.replace(/[^0-9|.]/gi, '')

if (formatter) {
Expand All @@ -223,7 +223,7 @@ export const InputNumber: FunctionComponent<
const burFormatValue = (e: ChangeEvent<HTMLInputElement>) => {
const input = e.target.value

const numReg = new RegExp('^[0-9]*$')
const numReg = /^[0-9]*$/
const numValue = input.replace(/[^0-9|.]/gi, '')
if (formatter) {
if (formatter(numValue) === input) {
Expand Down
13 changes: 8 additions & 5 deletions src/packages/noticebar/noticebar.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -314,10 +314,13 @@ export const NoticeBar: FunctionComponent<
const autoplay = () => {
if (childCount <= 1) return
stopAutoPlay()
swiperRef.current.autoplayTimer = setTimeout(() => {
next()
autoplay()
}, Number(duration) + 100 * speed)
swiperRef.current.autoplayTimer = setTimeout(
() => {
next()
autoplay()
},
Number(duration) + 100 * speed
)
}

// 切换方法
Expand Down Expand Up @@ -365,7 +368,7 @@ export const NoticeBar: FunctionComponent<
const target = innerRef.current
let _offset = 0
// 容器高度-元素高度
const val = rect?.height - height
const val = (rect?.height || 0) - height
_offset = moveOffset + Number(active === childCount - 1 && val / 2)

target.style.transitionDuration = `${
Expand Down
11 changes: 7 additions & 4 deletions src/packages/noticebar/noticebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -308,10 +308,13 @@ export const NoticeBar: FunctionComponent<
const autoplay = () => {
if (childCount <= 1) return
stopAutoPlay()
swiperRef.current.autoplayTimer = setTimeout(() => {
next()
autoplay()
}, Number(duration) + 100 * speed)
swiperRef.current.autoplayTimer = setTimeout(
() => {
next()
autoplay()
},
Number(duration) + 100 * speed
)
}

// 切换方法
Expand Down
Loading