Skip to content

Commit

Permalink
fix some linting problems
Browse files Browse the repository at this point in the history
  • Loading branch information
arshaw committed Nov 9, 2020
1 parent bcf8da3 commit b6f971b
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 26 deletions.
44 changes: 25 additions & 19 deletions packages/common/src/CalendarApi.tsx
Expand Up @@ -135,8 +135,8 @@ export class CalendarApi {
let state = this.getCurrentData()
let spec

viewType = viewType || 'day' // day is default zoom
spec = state.viewSpecs[viewType] || this.getUnitViewSpec(viewType)
let cleanedViewType = viewType || 'day' // day is default zoom
spec = state.viewSpecs[cleanedViewType] || this.getUnitViewSpec(cleanedViewType)

this.unselect()

Expand All @@ -163,17 +163,21 @@ export class CalendarApi {
let spec

for (let viewType in viewSpecs) {
viewTypes.push(viewType)
if (viewSpecs.hasOwnProperty(viewType)) {
viewTypes.push(viewType)
}
}

for (i = 0; i < viewTypes.length; i++) {
for (i = 0; i < viewTypes.length; i += 1) {
spec = viewSpecs[viewTypes[i]]
if (spec) {
if (spec.singleUnit === unit) {
return spec
}
}
}

return null
}

// Current Date
Expand Down Expand Up @@ -403,22 +407,23 @@ export class CalendarApi {
getEventById(id: string): EventApi | null {
let state = this.getCurrentData()
let { defs, instances } = state.eventStore

id = String(id)
let cleanedId = String(id)

for (let defId in defs) {
let def = defs[defId]
if (defs.hasOwnProperty(defId)) {
let def = defs[defId]

if (def.publicId === id) {
if (def.recurringDef) {
return new EventApi(state, def, null)
}
if (def.publicId === cleanedId) {
if (def.recurringDef) {
return new EventApi(state, def, null)
}

for (let instanceId in instances) {
let instance = instances[instanceId]
for (let instanceId in instances) {
let instance = instances[instanceId]

if (instance.defId === def.defId) {
return new EventApi(state, def, instance)
if (instance.defId === def.defId) {
return new EventApi(state, def, instance)
}
}
}
}
Expand Down Expand Up @@ -446,7 +451,9 @@ export class CalendarApi {
let sourceApis: EventSourceApi[] = []

for (let internalId in sourceHash) {
sourceApis.push(new EventSourceApi(state, sourceHash[internalId]))
if (sourceHash.hasOwnProperty(internalId)) {
sourceApis.push(new EventSourceApi(state, sourceHash[internalId]))
}
}

return sourceApis
Expand All @@ -455,11 +462,10 @@ export class CalendarApi {
getEventSourceById(id: string): EventSourceApi | null {
let state = this.getCurrentData()
let sourceHash = state.eventSources

id = String(id)
let cleanedId = String(id)

for (let sourceId in sourceHash) {
if (sourceHash[sourceId].publicId === id) {
if (sourceHash[sourceId].publicId === cleanedId) {
return new EventSourceApi(state, sourceHash[sourceId])
}
}
Expand Down
14 changes: 7 additions & 7 deletions packages/common/src/CalendarContent.tsx
Expand Up @@ -12,7 +12,13 @@ import { ViewPropsTransformerClass } from './plugin-system-struct'
import { createElement, createRef, VUIEvent, Fragment, VNode } from './vdom'
import { buildDelegationHandler } from './util/dom-event'
import { ViewContainer } from './ViewContainer'
import { Interaction, InteractionSettingsInput, InteractionClass, parseInteractionSettings, interactionSettingsStore } from './interactions/interaction'
import {
Interaction,
InteractionSettingsInput,
InteractionClass,
parseInteractionSettings,
interactionSettingsStore
} from './interactions/interaction'
import { DateComponent } from './component/DateComponent'
import { EventClicking } from './interactions/EventClicking'
import { EventHovering } from './interactions/EventHovering'
Expand All @@ -21,17 +27,12 @@ import { CalendarInteraction } from './calendar-utils'
import { DelayedRunner } from './util/runner'
import { PureComponent } from './vdom-util'


export interface CalendarContentProps extends CalendarData {
forPrint: boolean
isHeightAuto: boolean
}


export class CalendarContent extends PureComponent<CalendarContentProps> {

context: never

private buildViewContext = memoize(buildViewContext)
private buildViewPropTransformers = memoize(buildViewPropTransformers)
private buildToolbarProps = memoize(buildToolbarProps)
Expand All @@ -41,7 +42,6 @@ export class CalendarContent extends PureComponent<CalendarContentProps> {
private interactionsStore: { [componentUid: string]: Interaction[] } = {}
private calendarInteractions: CalendarInteraction[]


/*
renders INSIDE of an outer div
*/
Expand Down

0 comments on commit b6f971b

Please sign in to comment.