@@ -13,13 +13,13 @@ import { isEqual } from '@microsoft/sp-lodash-subset';
1313
1414export class LocationPicker extends React . Component < ILocationPickerProps , ILocationPickerState > {
1515 private _token : string | string [ ] = null ;
16- private focusRef : any = null ;
16+ private focusRef : any = null ; // eslint-disable-line @typescript-eslint/no-implicit-any
1717 /**
1818 * Constructor method
1919 */
2020 constructor ( props : ILocationPickerProps ) {
2121 super ( props ) ;
22- this . getToken ( ) ;
22+ this . getToken ( ) . then ( ( ) => { /* no-op; */ } ) . catch ( ( ) => { /* no-op; */ } ) ;
2323 this . focusRef = React . createRef ( ) ;
2424 if ( props . defaultValue ) {
2525 this . state = {
@@ -42,7 +42,7 @@ export class LocationPicker extends React.Component<ILocationPickerProps, ILocat
4242
4343 }
4444
45- public UNSAFE_componentWillReceiveProps ( nextProps : ILocationPickerProps ) {
45+ public UNSAFE_componentWillReceiveProps ( nextProps : ILocationPickerProps ) : void {
4646 if ( ! isEqual ( nextProps . defaultValue , this . props . defaultValue ) ) {
4747 if ( nextProps . defaultValue ) {
4848 this . setState ( { selectedItem : nextProps . defaultValue , currentMode : Mode . view } ) ;
@@ -64,7 +64,7 @@ export class LocationPicker extends React.Component<ILocationPickerProps, ILocat
6464 ) ;
6565 }
6666
67- private onRenderOption = ( item : ILocationBoxOption ) => {
67+ private onRenderOption = ( item : ILocationBoxOption ) : JSX . Element => {
6868 const {
6969 text,
7070 locationItem
@@ -107,7 +107,7 @@ export class LocationPicker extends React.Component<ILocationPickerProps, ILocat
107107 openOnKeyboardFocus = { true }
108108 scrollSelectedToTop = { true }
109109 isButtonAriaHidden = { true }
110- onInput = { ( e ) => this . getLocatios ( e . target [ "value" ] ) }
110+ onInput = { ( e ) => this . getLocatios ( e . target [ "value" ] ) } // eslint-disable-line dot-notation
111111 onChange = { this . onChange }
112112 errorMessage = { errorMessage }
113113 /> ;
@@ -212,30 +212,30 @@ export class LocationPicker extends React.Component<ILocationPickerProps, ILocat
212212 return `${ address . Street ? address . Street + ", " : '' } ${ address . City ? address . City + ", " : "" } ${ address . State ? address . State + ", " : '' } ${ address . CountryOrRegion || "" } ` ;
213213 }
214214
215- private onIconButtonClick = ( ) => {
215+ private onIconButtonClick = ( ) : void => {
216216 this . setState ( { currentMode : Mode . empty , selectedItem : null } ) ;
217217 if ( this . props . onChange ) {
218218 this . props . onChange ( null ) ;
219219 }
220220 }
221221
222- private onClick = ( ) => {
222+ private onClick = ( ) : void => {
223223 this . setState ( { currentMode : Mode . editView } ,
224224 ( ) => {
225225 if ( this . focusRef . current !== null )
226226 this . focusRef . current . focus ( ) ;
227227 } ) ;
228228 }
229229
230- private onBlur = ( ev ) => {
230+ private onBlur = ( ev ) : void => {
231231 try {
232- if ( ev !== null && ev . relatedTarget [ "title" ] !== "Location" && ev . relatedTarget [ "title" ] !== "Clear" ) {
232+ if ( ev !== null && ev . relatedTarget [ "title" ] !== "Location" && ev . relatedTarget [ "title" ] !== "Clear" ) { // eslint-disable-line dot-notation
233233 this . setState ( { currentMode : Mode . view } ) ;
234234 }
235- } catch { }
235+ } catch { /* no-op; */ }
236236 }
237237
238- private onChange = ( ev , option : ILocationBoxOption ) => {
238+ private onChange = ( ev , option : ILocationBoxOption ) : void => {
239239 this . setState ( { selectedItem : option . locationItem , currentMode : Mode . editView } ,
240240 ( ) => {
241241 if ( this . focusRef . current !== null )
@@ -247,14 +247,14 @@ export class LocationPicker extends React.Component<ILocationPickerProps, ILocat
247247 }
248248 }
249249
250- private customRenderInitials ( props ) {
250+ private customRenderInitials ( props ) : JSX . Element {
251251 if ( props . imageAlt === "Custom" )
252252 return < FontIcon aria-label = "Poi" iconName = "Poi" style = { { fontSize : "14pt" } } /> ;
253253 else
254254 return < FontIcon aria-label = "EMI" iconName = "EMI" style = { { fontSize : "14pt" } } /> ;
255255 }
256256
257- private async getToken ( ) {
257+ private async getToken ( ) : Promise < void > {
258258 const requestHeaders : Headers = new Headers ( ) ;
259259 requestHeaders . append ( "Content-type" , "application/json" ) ;
260260 requestHeaders . append ( "Cache-Control" , "no-cache" ) ;
@@ -263,14 +263,14 @@ export class LocationPicker extends React.Component<ILocationPickerProps, ILocat
263263 headers : requestHeaders
264264 } ;
265265
266- let response : SPHttpClientResponse = await this . props . context . spHttpClient . post ( `${ this . props . context . pageContext . web . absoluteUrl } /_api/SP.OAuth.Token/Acquire` , SPHttpClient . configurations . v1 , spOpts ) ;
267- let PrimaryQueryResult : any = await response . json ( ) ;
266+ const response : SPHttpClientResponse = await this . props . context . spHttpClient . post ( `${ this . props . context . pageContext . web . absoluteUrl } /_api/SP.OAuth.Token/Acquire` , SPHttpClient . configurations . v1 , spOpts ) ;
267+ const PrimaryQueryResult : any = await response . json ( ) ;
268268 this . _token = PrimaryQueryResult . access_token ;
269269 }
270270
271- private async getLocatios ( searchText ) {
271+ private async getLocatios ( searchText ) : Promise < void > {
272272 try {
273- let optionsForCustomRender : ILocationBoxOption [ ] = [ ] ;
273+ const optionsForCustomRender : ILocationBoxOption [ ] = [ ] ;
274274 const requestHeaders : Headers = new Headers ( ) ;
275275 requestHeaders . append ( "Content-type" , "application/json" ) ;
276276 requestHeaders . append ( "Cache-Control" , "no-cache" ) ;
@@ -279,12 +279,12 @@ export class LocationPicker extends React.Component<ILocationPickerProps, ILocat
279279 body : `{"QueryConstraint":{"Query":"${ searchText } "},"LocationProvider":32,"BingMarket":"en-IN"}` ,
280280 headers : requestHeaders
281281 } ;
282- let response1 : HttpClientResponse = await this . props . context . httpClient . post ( "https://outlook.office365.com/SchedulingB2/api/v1.0/me/findmeetinglocations" , HttpClient . configurations . v1 , spOpts ) ;
283- let json = await response1 . json ( ) ;
282+ const response1 : HttpClientResponse = await this . props . context . httpClient . post ( "https://outlook.office365.com/SchedulingB2/api/v1.0/me/findmeetinglocations" , HttpClient . configurations . v1 , spOpts ) ;
283+ const json = await response1 . json ( ) ;
284284
285285
286286 json . MeetingLocations . forEach ( ( v , i ) => {
287- let loc : ILocationPickerItem = v [ "MeetingLocation" ] ;
287+ const loc : ILocationPickerItem = v [ "MeetingLocation" ] ;
288288 optionsForCustomRender . push ( { text : v . MeetingLocation [ "DisplayName" ] , key : i , locationItem : loc } ) ;
289289 } ) ;
290290
0 commit comments