Skip to content

Commit

Permalink
chore: enable eslint for geo interactions and predictions packages (#…
Browse files Browse the repository at this point in the history
…13092)

* chore(repo): enable eslint for geo interaction and prediction

* chore(geo): run yarn lint:fix

* chore(geo): manual fix of linter reported errors

* chore(interaction): run yarn lint:fix

* chore(interactions): manual fix of linter reported errors

* chore(predictions): run yarn lint:fix

* chore(predictions): manual fix of linter reported errors
  • Loading branch information
HuiSF authored Mar 19, 2024
1 parent d4e0623 commit 57feb5b
Show file tree
Hide file tree
Showing 44 changed files with 407 additions and 475 deletions.
6 changes: 3 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ module.exports = {
// 'packages/core',
'packages/datastore',
'packages/datastore-storage-adapter',
'packages/geo',
'packages/interactions',
// 'packages/geo',
// 'packages/interactions',
'packages/notifications',
'packages/predictions',
// 'packages/predictions',
// 'packages/pubsub',
'packages/react-native',
'packages/rtn-push-notification',
Expand Down
3 changes: 2 additions & 1 deletion packages/geo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"clean": "npm run clean:size && rimraf dist lib lib-esm",
"clean:size": "rimraf dual-publish-tmp tmp*",
"format": "echo \"Not implemented\"",
"lint": "tslint '{__tests__,src}/**/*.ts' && npm run ts-coverage",
"lint": "eslint '**/*.{ts,tsx}' && npm run ts-coverage",
"lint:fix": "eslint '**/*.{ts,tsx}' --fix",
"ts-coverage": "typescript-coverage-report -p ./tsconfig.build.json -t 84.00"
},
"exports": {
Expand Down
32 changes: 16 additions & 16 deletions packages/geo/src/Geo.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { Amplify, ConsoleLogger } from '@aws-amplify/core';
import { AmazonLocationServiceProvider } from './providers/location-service/AmazonLocationServiceProvider';

import { AmazonLocationServiceProvider } from './providers/location-service/AmazonLocationServiceProvider';
import { validateCoordinates } from './util';

import {
Place,
GeoConfig,
Coordinates,
SearchByTextOptions,
SearchByCoordinatesOptions,
DeleteGeofencesResults,
GeoConfig,
GeoProvider,
MapStyle,
Geofence,
GeofenceId,
GeofenceInput,
GeofenceOptions,
SaveGeofencesResults,
Geofence,
ListGeofenceOptions,
ListGeofenceResults,
DeleteGeofencesResults,
MapStyle,
Place,
SaveGeofencesResults,
SearchByCoordinatesOptions,
SearchByTextOptions,
SearchForSuggestionsResults,
searchByPlaceIdOptions,
} from './types';

Expand Down Expand Up @@ -73,13 +73,13 @@ export class GeoClass {
* @param providerName the name of the plugin
*/
public getPluggable(providerName: string) {
const pluggable = this._pluggables.find(
const targetPluggable = this._pluggables.find(
pluggable => pluggable.getProviderName() === providerName,
);
if (pluggable === undefined) {
if (targetPluggable === undefined) {
logger.debug('No plugin found with providerName', providerName);
throw new Error('No plugin found in Geo for the provider');
} else return pluggable;
} else return targetPluggable;
}

/**
Expand All @@ -90,7 +90,6 @@ export class GeoClass {
this._pluggables = this._pluggables.filter(
pluggable => pluggable.getProviderName() !== providerName,
);
return;
}

/**
Expand Down Expand Up @@ -140,7 +139,7 @@ export class GeoClass {
* Search for search term suggestions based on input text
* @param {string} text The text string that is to be search for
* @param {SearchByTextOptions} options Optional parameters to the search
* @returns {Promise<SearchForSuggestionsResults>} - Resolves to an array of search suggestion strings
* @returns a `Promise` of {@link SearchForSuggestionsResults} that resolves to an array of search suggestion strings
*/
public async searchForSuggestions(
text: string,
Expand Down Expand Up @@ -194,6 +193,7 @@ export class GeoClass {
const [lng, lat] = coordinates;
try {
validateCoordinates(lng, lat);

return await prov.searchByCoordinates(coordinates, options);
} catch (error) {
logger.debug(error);
Expand Down Expand Up @@ -256,7 +256,7 @@ export class GeoClass {
/**
* List geofences
* @param options ListGeofenceOptions
* @returns {Promise<ListGeofencesResults>} - Promise that resolves to an object with:
* @returns a promise that resolves to an object that conforms to {@link ListGeofenceResults}:
* entries: list of geofences - 100 geofences are listed per page
* nextToken: token for next page of geofences
*/
Expand Down
Loading

0 comments on commit 57feb5b

Please sign in to comment.