Skip to content

Commit

Permalink
fix eslint errors for search packages
Browse files Browse the repository at this point in the history
  • Loading branch information
CataldiA-Insight committed Oct 16, 2020
1 parent 5646d4b commit 17d191e
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 15 deletions.
10 changes: 8 additions & 2 deletions sdk/search/search-documents/src/searchIndexClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,19 @@ import {
import * as utils from "./serviceUtils";
import { createSpan } from "./tracing";
import { odataMetadataPolicy } from "./odataMetadataPolicy";
import { SearchClient, SearchClientOptions } from "./searchClient";
import { SearchClient } from "./searchClient";

/**
* Client options used to configure Cognitive Search API requests.
*/
export type SearchIndexClientOptions = PipelineOptions;

/**
* Alias of Search Index Client Options parameter to satisfy linting constraints
*/

type getSearchClientOptions = SearchIndexClientOptions;

/**
* Class to perform operations to manage
* (create, update, list/delete)
Expand Down Expand Up @@ -611,7 +617,7 @@ export class SearchIndexClient {
* @param indexName Name of the index
* @param options SearchClient Options
*/
public getSearchClient<T>(indexName: string, options?: SearchClientOptions): SearchClient<T> {
public getSearchClient<T>(indexName: string, options?: getSearchClientOptions): SearchClient<T> {
return new SearchClient<T>(this.endpoint, indexName, this.credential, options || this.options);
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import {
IndexDocumentsAction,
SearchIndexingBufferedSenderUploadDocumentsOptions,
Expand Down
6 changes: 4 additions & 2 deletions sdk/search/search-documents/src/serviceUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ export function convertSimilarityToPublic(
return similarity;
}

if (similarity.odatatype == "#Microsoft.Azure.Search.ClassicSimilarity") {
if (similarity.odatatype === "#Microsoft.Azure.Search.ClassicSimilarity") {
return similarity as ClassicSimilarity;
} else {
return similarity as BM25Similarity;
Expand Down Expand Up @@ -370,7 +370,9 @@ export function generatedIndexToPublicIndex(generatedIndex: GeneratedSearchIndex
};
}

export function generatedSearchResultToPublicSearchResult<T>(results: GeneratedSearchResult[]) {
export function generatedSearchResultToPublicSearchResult<T>(
results: GeneratedSearchResult[]
): SearchResult<T>[] {
const returnValues: SearchResult<T>[] = results.map<SearchResult<T>>((result) => {
const { _score, _highlights, ...restProps } = result;
const doc: { [key: string]: any } = {
Expand Down
2 changes: 1 addition & 1 deletion sdk/search/search-documents/test/node/searchClient.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describe("SearchClient", function() {

it("autocomplete returns zero results for invalid query", async function() {
const autoCompleteResult: AutocompleteResult = await searchClient.autocomplete("garbxyz", "sg");
assert.isTrue(autoCompleteResult.results.length == 0);
assert.isTrue(autoCompleteResult.results.length === 0);
});

it("search returns the correct search result", async function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,6 @@ describe("SearchIndexClient", function() {
];
assert.include(synonyms, synonymMap.synonyms[0]);
assert.include(synonyms, synonymMap.synonyms[1]);
} catch (ex) {
throw ex;
} finally {
await indexClient.deleteSynonymMap(synonymMap);
}
Expand Down Expand Up @@ -207,8 +205,6 @@ describe("SearchIndexClient", function() {
index = await indexClient.getIndex(indexName);
assert.equal(index.name, indexName);
assert.equal(index.fields.length, 5);
} catch (ex) {
throw ex;
} finally {
await indexClient.deleteIndex(index);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ describe("SearchIndexerClient", function() {
assert.equal(indexer.dataSourceName, "my-data-source-1");
assert.equal(indexer.targetIndexName, TEST_INDEX_NAME);
assert.isFalse(indexer.isDisabled);
} catch (ex) {
throw ex;
} finally {
await indexerClient.deleteIndexer(indexer);
}
Expand Down Expand Up @@ -178,8 +176,6 @@ describe("SearchIndexerClient", function() {
assert.equal(dataSourceConnection.name, "my-data-source-3");
assert.equal(dataSourceConnection.type, "cosmosdb");
assert.equal(dataSourceConnection.container.name, "hotels");
} catch (ex) {
throw ex;
} finally {
await indexerClient.deleteDataSourceConnection(dataSourceConnection);
}
Expand Down Expand Up @@ -267,8 +263,6 @@ describe("SearchIndexerClient", function() {
assert.equal(skillSet.skills.length, 1);
assert.equal(skillSet.skills[0].inputs.length, 2);
assert.equal(skillSet.skills[0].outputs.length, 3);
} catch (ex) {
throw ex;
} finally {
await indexerClient.deleteSkillset(skillSet);
}
Expand Down

0 comments on commit 17d191e

Please sign in to comment.