Skip to content

Commit

Permalink
[refactor]: enable noImplicitReturns
Browse files Browse the repository at this point in the history
New issue: #517

I refactored some stuff in DatePicker with no deep understanding of logic,
but preserving effects (and deleting
unreachable ones)
  • Loading branch information
0x009922 committed Mar 13, 2023
1 parent dceb8d7 commit 2191c40
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
2 changes: 2 additions & 0 deletions packages/ui/rollup.dts.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ const shimCssPlugin = (): Plugin => {
name: 'soramitsu-ui:shim-css',
resolveId(id) {
if (/\.(css|scss|sass)$/.test(id)) return id + CSS_SUFFIX
return
},
load(id) {
if (id.endsWith(CSS_SUFFIX)) return `declare const css: string\n export default css`
return
},
}
}
Expand Down
8 changes: 3 additions & 5 deletions packages/ui/src/components/DatePicker/SDatePicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,8 @@ const updateShowedMonths = () => {
case 'range':
date = rangeState[dateForTime.value as keyof RangeState] as Date | null
break
default:
}
if (!date) return `00:00`
if (!date) return
updateShowedState(date.getMonth(), date.getFullYear())
}
Expand Down Expand Up @@ -196,7 +195,7 @@ const changeView = (viewName: string) => {
currentView.value = viewName
}
const headTitle = computed(() => {
const headTitle = computed<string>(() => {
if (menuState.value && menuState.value !== 'Custom') {
return menuState.value
}
Expand All @@ -209,13 +208,12 @@ const headTitle = computed(() => {
const modelValue = props.modelValue as Date[]
return modelValue.map((item) => formatDate(item)).join(' - ')
}
case 'pick': {
const modelValue = props.modelValue as Date[]
return modelValue.map((item) => formatDate(item)).join(', ')
}
default:
break
return ''
}
} catch {
return ''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ function dateMask(date: string) {
if (date.match(/^\d{2}\/\d{2}$/) !== null) {
return date + '/'
}
return undefined
}
function dateTimeMask(date: string) {
Expand All @@ -112,6 +114,8 @@ function dateTimeMask(date: string) {
if (date.match(/^\d{2}\/\d{2}\/\d{4}, \d{2}:\d{2}$/) !== null) {
return date
}
return undefined
}
const customInputLength = computed(() => {
Expand Down
4 changes: 3 additions & 1 deletion packages/ui/src/components/Table/use-table-heights.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export function useTableHeights({

watch(
[headerHeight, tableHeight],
() => {
(): void => {
if (propHeight.value) {
const bodyHeight = tableHeight.value - headerHeight.value

Expand All @@ -54,6 +54,8 @@ export function useTableHeights({
const maxHeight = parseHeight(propMaxHeight.value)

if (typeof maxHeight === 'number') {
// FIXME https://github.com/soramitsu/soramitsu-js-ui-library/issues/517
// @ts-ignore
return {
'max-height': maxHeight - headerHeight.value + 'px',
}
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"exactOptionalPropertyTypes": true,
"noFallthroughCasesInSwitch": true,
"noImplicitOverride": true,
// "noImplicitReturns": true,
"noImplicitReturns": true,
"noPropertyAccessFromIndexSignature": false,
// "noUncheckedIndexedAccess": true,
"noUnusedLocals": false,
Expand Down

0 comments on commit 2191c40

Please sign in to comment.