Skip to content

Commit 5887422

Browse files
committed
Revert formatting changes, ignore tests/env and coverage from being formatted
1 parent e5f0194 commit 5887422

File tree

18 files changed

+77
-91
lines changed

18 files changed

+77
-91
lines changed

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
node_modules
22
dist
33
*.md
4+
tests/env
5+
coverage

scripts/build.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
/** This file only purpose is to execute any build related tasks */
1+
/**
2+
* This file only purpose is to execute any build related tasks
3+
*/
24

35
const { resolve, normalize } = require('path')
46
const { readFileSync, writeFileSync } = require('fs')
@@ -26,6 +28,7 @@ function writeDtsHeader() {
2628
}
2729

2830
/**
31+
*
2932
* @param {string} pkgName
3033
* @param {string} version
3134
* @param {string} author
@@ -46,6 +49,7 @@ function getDtsHeader(pkgName, version, author, repoUrl, tsVersion) {
4649
}
4750

4851
/**
52+
*
4953
* @param {string} path
5054
* @param {string | Blob} data
5155
*/

scripts/file-size.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ async function main() {
3232
}
3333

3434
/**
35+
*
3536
* @param {string} pkgName
3637
* @param {string[]} filesOutput
3738
*/
@@ -48,6 +49,7 @@ function getFormatedOutput(pkgName, filesOutput) {
4849
}
4950

5051
/**
52+
*
5153
* @param {number} size
5254
* @param {string} filename
5355
* @param {'br' | 'gz'} type
@@ -64,9 +66,10 @@ function formatSize(size, filename, type, raw) {
6466
}
6567

6668
/**
69+
*
6770
* @param {string} code
6871
* @param {string} filename
69-
* @param {boolean} [raw=false] Default is `false`
72+
* @param {boolean} [raw=false]
7073
*/
7174
async function getSizeInfo(code, filename, raw = false) {
7275
const isRaw = raw || code.length < 5000

src/http-requests.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,10 @@ function constructHostURL(host: string): string {
4040

4141
function cloneAndParseHeaders(headers: HeadersInit): Record<string, string> {
4242
if (Array.isArray(headers)) {
43-
return headers.reduce(
44-
(acc, headerPair) => {
45-
acc[headerPair[0]] = headerPair[1]
46-
return acc
47-
},
48-
{} as Record<string, string>
49-
)
43+
return headers.reduce((acc, headerPair) => {
44+
acc[headerPair[0]] = headerPair[1]
45+
return acc
46+
}, {} as Record<string, string>)
5047
} else if ('has' in headers) {
5148
const clonedHeaders: Record<string, string> = {}
5249
;(headers as Headers).forEach((value, key) => (clonedHeaders[key] = value))

src/indexes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class Index<T extends Record<string, any> = Record<string, any>> {
9090
*/
9191
async search<
9292
D extends Record<string, any> = T,
93-
S extends SearchParams = SearchParams,
93+
S extends SearchParams = SearchParams
9494
>(
9595
query?: string | null,
9696
options?: S,
@@ -116,7 +116,7 @@ class Index<T extends Record<string, any> = Record<string, any>> {
116116
*/
117117
async searchGet<
118118
D extends Record<string, any> = T,
119-
S extends SearchParams = SearchParams,
119+
S extends SearchParams = SearchParams
120120
>(
121121
query?: string | null,
122122
options?: S,

src/task.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,10 @@ class TaskClient {
9797
while (Date.now() - startingTime < timeOutMs) {
9898
const response = await this.getTask(taskUid)
9999
if (
100-
!(
101-
[
102-
TaskStatus.TASK_ENQUEUED,
103-
TaskStatus.TASK_PROCESSING,
104-
] as readonly string[]
105-
).includes(response.status)
100+
!([
101+
TaskStatus.TASK_ENQUEUED,
102+
TaskStatus.TASK_PROCESSING,
103+
] as readonly string[]).includes(response.status)
106104
)
107105
return response
108106
await sleep(intervalMs)

src/types/types.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ export const MatchingStrategies = {
6565
LAST: 'last',
6666
} as const
6767

68-
export type MatchingStrategies =
69-
(typeof MatchingStrategies)[keyof typeof MatchingStrategies]
68+
export type MatchingStrategies = typeof MatchingStrategies[keyof typeof MatchingStrategies]
7069

7170
export type Filter = string | Array<string | string[]>
7271

@@ -200,7 +199,7 @@ export type FacetStats = Record<string, FacetStat>
200199

201200
export type SearchResponse<
202201
T = Record<string, any>,
203-
S extends SearchParams | undefined = undefined,
202+
S extends SearchParams | undefined = undefined
204203
> = {
205204
hits: Hits<T>
206205
processingTimeMs: number
@@ -211,8 +210,8 @@ export type SearchResponse<
211210
} & (undefined extends S
212211
? Partial<FinitePagination & InfinitePagination>
213212
: true extends IsFinitePagination<NonNullable<S>>
214-
? FinitePagination
215-
: InfinitePagination)
213+
? FinitePagination
214+
: InfinitePagination)
216215

217216
type FinitePagination = {
218217
totalHits: number
@@ -234,8 +233,8 @@ type IsFinitePagination<S extends SearchParams> = Or<
234233
type Or<A extends boolean, B extends boolean> = true extends A
235234
? true
236235
: true extends B
237-
? true
238-
: false
236+
? true
237+
: false
239238

240239
type HasHitsPerPage<S extends SearchParams> = undefined extends S['hitsPerPage']
241240
? false
@@ -364,7 +363,7 @@ export const TaskStatus = {
364363
TASK_CANCELED: 'canceled',
365364
} as const
366365

367-
export type TaskStatus = (typeof TaskStatus)[keyof typeof TaskStatus]
366+
export type TaskStatus = typeof TaskStatus[keyof typeof TaskStatus]
368367

369368
export const TaskTypes = {
370369
DOCUMENTS_ADDITION_OR_UPDATE: 'documentAdditionOrUpdate',
@@ -380,7 +379,7 @@ export const TaskTypes = {
380379
TASK_DELETION: 'taskDeletion',
381380
} as const
382381

383-
export type TaskTypes = (typeof TaskTypes)[keyof typeof TaskTypes]
382+
export type TaskTypes = typeof TaskTypes[keyof typeof TaskTypes]
384383

385384
export type TasksQuery = {
386385
indexUids?: string[]
@@ -933,8 +932,7 @@ export const ErrorStatusCode = {
933932
INVALID_FACET_SEARCH_FACET_QUERY: 'invalid_facet_search_facet_query',
934933
}
935934

936-
export type ErrorStatusCode =
937-
(typeof ErrorStatusCode)[keyof typeof ErrorStatusCode]
935+
export type ErrorStatusCode = typeof ErrorStatusCode[keyof typeof ErrorStatusCode]
938936

939937
export type TokenIndexRules = {
940938
[field: string]: any

src/utils.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
/** Removes undefined entries from object */
22
function removeUndefinedFromObject(obj: Record<string, any>): object {
3-
return Object.entries(obj).reduce(
4-
(acc, curEntry) => {
5-
const [key, val] = curEntry
6-
if (val !== undefined) acc[key] = val
7-
return acc
8-
},
9-
{} as Record<string, any>
10-
)
3+
return Object.entries(obj).reduce((acc, curEntry) => {
4+
const [key, val] = curEntry
5+
if (val !== undefined) acc[key] = val
6+
return acc
7+
}, {} as Record<string, any>)
118
}
129

1310
async function sleep(ms: number): Promise<void> {
@@ -29,8 +26,7 @@ function addTrailingSlash(url: string): string {
2926
}
3027

3128
function validateUuid4(uuid: string): boolean {
32-
const regexExp =
33-
/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/gi
29+
const regexExp = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/gi
3430
return regexExp.test(uuid)
3531
}
3632

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
// @TODO What is this?
2-
// ../../../dist/bundles/meilisearch.umd.js
1+
../../../dist/bundles/meilisearch.umd.js

tests/env/esm/src/index.js

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,7 @@
11
import { MeiliSearch } from '../../../../'
22
import * as DefaultMeiliSearch from '../../../../'
33

4-
const client = new MeiliSearch({
5-
host: 'http://localhost:7700',
6-
apiKey: 'masterKey',
7-
})
8-
const defaultClient = new DefaultMeiliSearch.MeiliSearch({
9-
host: 'http://localhost:7700',
10-
apiKey: 'masterKey',
11-
})
12-
const token = client.generateTenantToken(
13-
'e489fe16-3381-431b-bee3-00430192915d',
14-
[]
15-
)
4+
const client = new MeiliSearch({ host:'http://localhost:7700', apiKey: 'masterKey'})
5+
const defaultClient = new DefaultMeiliSearch.MeiliSearch({ host:'http://localhost:7700', apiKey: 'masterKey'})
6+
const token = client.generateTenantToken('e489fe16-3381-431b-bee3-00430192915d', [])
167
console.log({ client, token, defaultClient })

0 commit comments

Comments
 (0)