Skip to content

Commit 96a4da5

Browse files
authored
fix: eslint fixes (#2946)
* fix(picker/datepicker): popup minHeight is too high and causes blank space * refactor: new components are generated automatically * feat: add test * refactor: optimize * fix: 移除picker的pr * fix: 暂时移除判断 * chore: 更新lock * fix: update ai pr * fix: eslint fixes
1 parent efc1d66 commit 96a4da5

File tree

1 file changed

+52
-40
lines changed

1 file changed

+52
-40
lines changed

scripts/demo.js

Lines changed: 52 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ var demoModel = function (name, cName, desc) {
22
var temp = {
33
demoitem: `import React from 'react'
44
import { Cell, ${name} } from '@nutui/nutui-react'
5-
import { Dongdong } from '@nutui/icons-react'
5+
// import { Dongdong } from '@nutui/icons-react'
66
77
const Demo1 = () => {
88
return (
99
<Cell>
10-
<${name}></${name}>
10+
<${name} />
1111
</Cell>
1212
)
1313
}
@@ -16,12 +16,12 @@ export default Demo1
1616
`,
1717
tarodemoitem: `import React from 'react'
1818
import { Cell, ${name} } from '@nutui/nutui-react-taro'
19-
import { Dongdong } from '@nutui/icons-react-taro'
19+
// import { Dongdong } from '@nutui/icons-react-taro'
2020
2121
const Demo1 = () => {
2222
return (
2323
<Cell>
24-
<${name}></${name}>
24+
<${name} />
2525
</Cell>
2626
)
2727
}
@@ -35,20 +35,20 @@ import Demo1 from './demos/h5/demo1'
3535
const ${name}Demo = () => {
3636
const [translated] = useTranslate({
3737
'zh-CN': {
38-
title: '基础用法',
38+
title: '基础用法',
3939
},
4040
'en-US': {
41-
title: 'Basic Usage',
41+
title: 'Basic Usage',
4242
},
4343
'zh-TW': {
44-
title: '基礎用法',
44+
title: '基礎用法',
4545
},
4646
})
4747
return (
48-
<div className="demo">
49-
<h2>{translated.title}</h2>
50-
<Demo1 />
51-
</div>
48+
<div className="demo">
49+
<h2>{translated.title}</h2>
50+
<Demo1 />
51+
</div>
5252
)
5353
}
5454
@@ -64,13 +64,13 @@ import Demo1 from './demos/taro/demo1'
6464
const ${name}Demo = () => {
6565
const [translated] = useTranslate({
6666
'zh-CN': {
67-
title: '基础用法',
67+
title: '基础用法',
6868
},
6969
'en-US': {
70-
title: 'Basic Usage',
70+
title: 'Basic Usage',
7171
},
7272
'zh-TW': {
73-
title: '基礎用法',
73+
title: '基礎用法',
7474
},
7575
})
7676
return (
@@ -79,66 +79,80 @@ const ${name}Demo = () => {
7979
<ScrollView className={\`demo \${Taro.getEnv() === 'WEB' ? 'web' : ''}\`}>
8080
<View className="h2">{translated.title}</View>
8181
<Demo1 />
82-
</ScrollView>
82+
</ScrollView>
8383
</>
8484
)
8585
}
8686
8787
export default ${name}Demo
8888
`,
89-
index: `import {${name}} from './${name.toLowerCase()}'
89+
index: `import { ${name} } from './${name.toLowerCase()}'
90+
9091
export type { ${name}Props } from './types'
9192
export default ${name}
9293
`,
9394

94-
taroindex: `import {${name}} from './${name.toLowerCase()}.taro'
95+
taroindex: `import { ${name} } from './${name.toLowerCase()}.taro'
96+
9597
export type { ${name}Props } from './types'
96-
export default ${name}
98+
export default ${name}
9799
`,
98100
types: `import { BasicComponent } from '@/utils/typings'
99-
export interface ${name}Props extends BasicComponent {
100101
101-
}
102+
export interface ${name}Props extends BasicComponent {}
102103
`,
103104
react: `import React, { FunctionComponent } from 'react'
105+
import classNames from 'classnames'
104106
import { ComponentDefaults } from '@/utils/typings'
105107
import { ${name}Props } from './types'
106-
import classNames from 'classnames'
107-
import { useConfig } from '@/packages/configprovider'
108-
import { useRtl } from '@/packages/configprovider'
108+
// import { useConfig } from '@/packages/configprovider'
109+
// import { useRtl } from '@/packages/configprovider'
109110
110111
const defaultProps = {
111-
...ComponentDefaults,
112+
...ComponentDefaults,
112113
} as ${name}Props
113-
export const ${name}: FunctionComponent<Partial<${name}Props> & React.HTMLAttributes<HTMLDivElement>> = (props) => {
114-
const { locale } = useConfig()
115-
const rtl = useRtl()
114+
export const ${name}: FunctionComponent<
115+
Partial<PickerViewProps> & React.HTMLAttributes<HTMLDivElement>
116+
> = (props) => {
117+
// const { locale } = useConfig()
118+
// const rtl = useRtl()
116119
const { className, style } = { ...defaultProps, ...props }
117120
const classPrefix = 'nut-${name.toLowerCase()}'
118121
const cls = classNames(classPrefix, className)
119-
return <div className={cls} style={style}>${name}</div>
122+
return (
123+
<div className={cls} style={style}>
124+
PickerView
125+
</div>
126+
)
120127
}
121128
122129
${name}.displayName = 'Nut${name}'
123130
`,
124131
taroreact: `import React, { FunctionComponent } from 'react'
132+
import classNames from 'classnames'
133+
import { View } from '@tarojs/components'
125134
import { ComponentDefaults } from '@/utils/typings'
126135
import { ${name}Props } from './types'
127-
import { View } from '@tarojs/components'
128-
import classNames from 'classnames'
129-
import { useConfig } from '@/packages/configprovider/configprovider.taro'
130-
import { useRtl } from '@/packages/configprovider/index.taro'
136+
137+
// import { useConfig } from '@/packages/configprovider/configprovider.taro'
138+
// import { useRtl } from '@/packages/configprovider/index.taro'
131139
132140
const defaultProps = {
133-
...ComponentDefaults,
141+
...ComponentDefaults,
134142
} as ${name}Props
135-
export const ${name}: FunctionComponent<Partial<${name}Props> & React.HTMLAttributes<HTMLDivElement>> = (props) => {
136-
const { locale } = useConfig()
137-
const rtl = useRtl()
143+
export const ${name}: FunctionComponent<
144+
Partial<PickerViewProps> & React.HTMLAttributes<HTMLDivElement>
145+
> = (props) => {
146+
// const { locale } = useConfig()
147+
// const rtl = useRtl()
138148
const { className, style } = { ...defaultProps, ...props }
139149
const classPrefix = 'nut-${name.toLowerCase()}'
140150
const cls = classNames(classPrefix, className)
141-
return <View className={cls} style={style}>${name}</View>
151+
return (
152+
<View className={cls} style={style}>
153+
PickerView
154+
</View>
155+
)
142156
}
143157
144158
${name}.displayName = 'Nut${name}'
@@ -186,9 +200,7 @@ import '@testing-library/jest-dom'
186200
import { ${name} } from '../${name.toLowerCase()}'
187201
188202
test('should match snapshot', () => {
189-
const { container } = render(
190-
<${name}></${name}>
191-
)
203+
const { container } = render(<${name} />)
192204
expect(container).toMatchSnapshot()
193205
})
194206
`,

0 commit comments

Comments
 (0)