Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Search] Fix the Linter Errors #13060

Merged
merged 4 commits into from
Jan 8, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions sdk/search/search-documents/review/search-documents.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ export class GeographyPoint {
constructor(latitude: number, longitude: number);
latitude: number;
longitude: number;
toJSON(): object;
toJSON(): Record<string, unknown>;
sarangan12 marked this conversation as resolved.
Show resolved Hide resolved
}

// @public
Expand Down Expand Up @@ -541,10 +541,10 @@ export interface IndexingSchedule {
}

// @public
export type IndexIterator = PagedAsyncIterableIterator<SearchIndex, SearchIndex[], {}>;
export type IndexIterator = PagedAsyncIterableIterator<SearchIndex, SearchIndex[], Record<string, unknown>>;
sarangan12 marked this conversation as resolved.
Show resolved Hide resolved

// @public
export type IndexNameIterator = PagedAsyncIterableIterator<string, string[], {}>;
export type IndexNameIterator = PagedAsyncIterableIterator<string, string[], Record<string, unknown>>;
sarangan12 marked this conversation as resolved.
Show resolved Hide resolved

// @public
export interface InputFieldMappingEntry {
Expand Down Expand Up @@ -1028,19 +1028,17 @@ export interface ScoringProfile {
// @public
export type ScoringStatistics = 'local' | 'global';

// @public
export class SearchClient<T> {
constructor(endpoint: string, indexName: string, credential: KeyCredential, options?: SearchClientOptions);
readonly apiVersion: string;
// @public (undocumented)
export interface SearchClient<T> {
autocomplete<Fields extends keyof T>(searchText: string, suggesterName: string, options?: AutocompleteOptions<Fields>): Promise<AutocompleteResult>;
deleteDocuments(documents: T[], options?: DeleteDocumentsOptions): Promise<IndexDocumentsResult>;
deleteDocuments(keyName: keyof T, keyValues: string[], options?: DeleteDocumentsOptions): Promise<IndexDocumentsResult>;
readonly endpoint: string;
// (undocumented)
deleteDocuments(keyNameOrDocuments: keyof T | T[], keyValuesOrOptions?: string[] | DeleteDocumentsOptions, options?: DeleteDocumentsOptions): Promise<IndexDocumentsResult>;
getDocument<Fields extends keyof T>(key: string, options?: GetDocumentOptions<Fields>): Promise<T>;
getDocumentsCount(options?: CountDocumentsOptions): Promise<number>;
getSearchIndexingBufferedSenderInstance(options?: SearchIndexingBufferedSenderOptions): SearchIndexingBufferedSender<T>;
indexDocuments(batch: IndexDocumentsBatch<T>, options?: IndexDocumentsOptions): Promise<IndexDocumentsResult>;
readonly indexName: string;
mergeDocuments(documents: T[], options?: MergeDocumentsOptions): Promise<IndexDocumentsResult>;
mergeOrUploadDocuments(documents: T[], options?: MergeOrUploadDocumentsOptions): Promise<IndexDocumentsResult>;
search<Fields extends keyof T>(searchText?: string, options?: SearchOptions<Fields>): Promise<SearchDocumentsResult<Pick<T, Fields>>>;
Expand Down
4 changes: 2 additions & 2 deletions sdk/search/search-documents/src/base64.browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@

/**
* Encodes a string in base64 format.
* @param value The string to encode.
* @param value - The string to encode.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

huh, I see TSDoc wants this, but I haven't seen it before now. Is this a recent change they made or did they just grandfather in the old JSDoc format?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure about the motivation behind this syntax but this is supposedly the origin: microsoft/tsdoc#8

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Digging through that thread, I get the idea from here: microsoft/tsdoc#8 (comment)

That the only real reason is that TypeDoc had implemented @param in a way that has an unnecessary hyphen and they kept that behavior.

*/
export function encode(value: string): string {
return btoa(value);
}

/**
* Decodes a base64 string into a regular string.
* @param value The base64 string to decode.
* @param value - The base64 string to decode.
*/
export function decode(value: string): string {
return atob(value);
Expand Down
4 changes: 2 additions & 2 deletions sdk/search/search-documents/src/base64.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@

/**
* Encodes a string in base64 format.
* @param value The string to encode.
* @param value - The string to encode.
*/
export function encode(value: string): string {
return Buffer.from(value).toString("base64");
}

/**
* Decodes a base64 string into a regular string.
* @param value The base64 string to decode.
* @param value - The base64 string to decode.
*/
export function decode(value: string): string {
return Buffer.from(value, "base64").toString();
Expand Down
6 changes: 3 additions & 3 deletions sdk/search/search-documents/src/geographyPoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ export default class GeographyPoint {
/**
* Constructs a new instance of GeographyPoint given
* the specified coordinates.
* @param latitude latitude value in decimal
* @param longitude longitude value in decimal
* @param latitude - latitude value in decimal
* @param longitude - longitude value in decimal
*/
constructor(latitude: number, longitude: number) {
this.latitude = latitude;
Expand All @@ -30,7 +30,7 @@ export default class GeographyPoint {
/**
* Used to serialize to a GeoJSON Point.
*/
public toJSON(): object {
public toJSON(): Record<string, unknown> {
return {
type: "Point",
coordinates: [this.longitude, this.latitude],
Expand Down
3 changes: 2 additions & 1 deletion sdk/search/search-documents/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

export { SearchClient, SearchClientOptions } from "./searchClient";
export { SearchClientOptions } from "./searchClientImpl";
export { SearchClient } from "./searchClient";
export {
DEFAULT_BATCH_SIZE,
DEFAULT_FLUSH_WINDOW,
Expand Down
12 changes: 6 additions & 6 deletions sdk/search/search-documents/src/indexDocumentsBatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class IndexDocumentsBatch<T> {

/**
* Upload an array of documents to the index.
* @param documents The documents to upload.
* @param documents - The documents to upload.
*/
public upload(documents: T[]): void {
const batch = documents.map<IndexDocumentsAction<T>>((doc) => {
Expand All @@ -35,7 +35,7 @@ export class IndexDocumentsBatch<T> {
/**
* Update a set of documents in the index.
* For more details about how merging works, see https://docs.microsoft.com/en-us/rest/api/searchservice/AddUpdate-or-Delete-Documents
* @param documents The updated documents.
* @param documents - The updated documents.
*/
public merge(documents: T[]): void {
const batch = documents.map<IndexDocumentsAction<T>>((doc) => {
Expand All @@ -51,7 +51,7 @@ export class IndexDocumentsBatch<T> {
/**
* Update a set of documents in the index or uploads them if they don't exist.
* For more details about how merging works, see https://docs.microsoft.com/en-us/rest/api/searchservice/AddUpdate-or-Delete-Documents
* @param documents The new/updated documents.
* @param documents - The new/updated documents.
*/
public mergeOrUpload(documents: T[]): void {
const batch = documents.map<IndexDocumentsAction<T>>((doc) => {
Expand All @@ -66,14 +66,14 @@ export class IndexDocumentsBatch<T> {

/**
* Delete a set of documents.
* @param keyName The name of their primary key in the index.
* @param keyValues The primary key values of documents to delete.
* @param keyName - The name of their primary key in the index.
* @param keyValues - The primary key values of documents to delete.
*/
public delete(keyName: keyof T, keyValues: string[]): void;

/**
* Delete a set of documents.
* @param documents Documents to be deleted.
* @param documents - Documents to be deleted.
*/
public delete(documents: T[]): void;

Expand Down
2 changes: 1 addition & 1 deletion sdk/search/search-documents/src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
import { createClientLogger } from "@azure/logger";

/**
* The @azure/logger configuration for this package.
* The \@azure/logger configuration for this package.
sarangan12 marked this conversation as resolved.
Show resolved Hide resolved
*/
export const logger = createClientLogger("search");
4 changes: 2 additions & 2 deletions sdk/search/search-documents/src/odata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ function escapeQuotesIfString(input: unknown, previous: string): string | unknow
* const filter = odata`Rooms/any(room: room/BaseRate lt ${baseRateMax}) and Rating ge ${ratingMin}`;
* ```
* For more information on supported syntax see: https://docs.microsoft.com/en-us/azure/search/search-query-odata-filter
* @param strings
* @param values
* @param strings - Array of strings for the expression
* @param values - Array of values for the expression
*/
export function odata(strings: TemplateStringsArray, ...values: unknown[]): string {
const results = [];
Expand Down
Loading