Skip to content

Commit ffbca1e

Browse files
committed
style(search): satisfy the stylistic rules added with the new lint config
Trailing commas and double-quoted strings, autofixed. The branch was written against the old per-package eslint config and predates the root one, which adds @Stylistic and lints only the lines a PR changes.
1 parent b9fa300 commit ffbca1e

7 files changed

Lines changed: 85 additions & 85 deletions

File tree

packages/bruno-api-docs/e2e/tests/search/search.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ test.describe('Search palette', () => {
141141
// row's hover background at the container edge.
142142
const { scrollWidth, clientWidth } = await search.resultsScroll.evaluate((el) => ({
143143
scrollWidth: el.scrollWidth,
144-
clientWidth: el.clientWidth,
144+
clientWidth: el.clientWidth
145145
}));
146146
expect(scrollWidth).toBeLessThanOrEqual(clientWidth + 1);
147147

packages/bruno-api-docs/src/components/Search/SearchBar/SearchBar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ export const SearchBar: React.FC<SearchBarProps> = ({ open, onOpenChange, focusN
8484
: [];
8585
const filtered = base.filter(({ record: r }) => {
8686
// A folder carries no method, so any active method chip excludes them all.
87-
const passesMethod =
88-
methods.size === 0 || (r.type === 'request' && !!r.method && methods.has(r.method.toUpperCase()));
87+
const passesMethod
88+
= methods.size === 0 || (r.type === 'request' && !!r.method && methods.has(r.method.toUpperCase()));
8989
// The filtered folder matches itself, not only the items beneath it.
9090
const passesFolder = folder === null || r.ancestorSlugs.includes(folder) || r.slug === folder;
9191
return passesMethod && passesFolder;

packages/bruno-api-docs/src/components/Search/SearchResultItem/SearchResultItem.spec.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const folder: FolderSearchRecord = {
2727
name: 'Basic Auth',
2828
ancestorNames: ['Billing', 'Customers'],
2929
ancestorSlugs: ['billing', 'billing/customers'],
30-
requestCount: 12,
30+
requestCount: 12
3131
};
3232

3333
describe('SearchResultItem', () => {
@@ -88,7 +88,7 @@ describe('SearchResultItem - folder variant', () => {
8888

8989
it('singularises a folder holding one request', () => {
9090
const html = renderToStaticMarkup(
91-
<SearchResultItem record={{ ...folder, requestCount: 1 }} onSelect={() => {}} />,
91+
<SearchResultItem record={{ ...folder, requestCount: 1 }} onSelect={() => {}} />
9292
);
9393
expect(html).toContain('1 request');
9494
expect(html).not.toContain('1 requests');
@@ -103,7 +103,7 @@ describe('SearchResultItem - folder variant', () => {
103103
it('shows its breadcrumb, so two same-named folders can be told apart', () => {
104104
const billing = renderToStaticMarkup(<SearchResultItem record={folder} onSelect={() => {}} />);
105105
const products = renderToStaticMarkup(
106-
<SearchResultItem record={{ ...folder, ancestorNames: ['Products', 'Users'] }} onSelect={() => {}} />,
106+
<SearchResultItem record={{ ...folder, ancestorNames: ['Products', 'Users'] }} onSelect={() => {}} />
107107
);
108108
expect(billing).toContain('Billing / Customers');
109109
expect(products).toContain('Products / Users');
@@ -118,15 +118,15 @@ describe('SearchResultItem - folder variant', () => {
118118

119119
it('omits the breadcrumb for a top-level folder (there is no chain)', () => {
120120
const html = renderToStaticMarkup(
121-
<SearchResultItem record={{ ...folder, ancestorNames: [] }} onSelect={() => {}} />,
121+
<SearchResultItem record={{ ...folder, ancestorNames: [] }} onSelect={() => {}} />
122122
);
123123
expect(html).not.toContain('class="search-result-breadcrumb"');
124124
});
125125

126126
it('bolds the matched range of the folder name', () => {
127127
// "Auth" sits at indices 6-9 of "Basic Auth".
128128
const html = renderToStaticMarkup(
129-
<SearchResultItem record={folder} matches={{ name: [[6, 9]] }} onSelect={() => {}} />,
129+
<SearchResultItem record={folder} matches={{ name: [[6, 9]] }} onSelect={() => {}} />
130130
);
131131
expect(boldedText(html)).toContain('Auth');
132132
});

packages/bruno-api-docs/src/components/Search/searchIndex.spec.ts

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
searchHits,
1010
type SearchRecord,
1111
type RequestSearchRecord,
12-
type FolderSearchRecord,
12+
type FolderSearchRecord
1313
} from './searchIndex';
1414
import type { NavEntry } from '../../routing/types';
1515

@@ -35,7 +35,7 @@ const requestEntry = (over: Partial<NavEntry> & { uuid: string }): NavEntry => {
3535
const childItem = (name: string, type: 'http' | 'folder' | 'script', items?: unknown[]) => ({
3636
uuid: `${type}-${name}`,
3737
info: { name, type },
38-
...(items ? { items } : {}),
38+
...(items ? { items } : {})
3939
});
4040

4141
const folderEntry = (over: Partial<NavEntry> & { uuid: string; items?: unknown[] }): NavEntry => {
@@ -47,7 +47,7 @@ const folderEntry = (over: Partial<NavEntry> & { uuid: string; items?: unknown[]
4747
ancestors: [],
4848
depth: 0,
4949
item: { uuid, info: { name: 'Hotels', type: 'folder' }, items: items ?? [] } as never,
50-
...rest,
50+
...rest
5151
};
5252
};
5353

@@ -93,7 +93,7 @@ describe('buildSearchRecords', () => {
9393
slug: 'hotels/rooms',
9494
name: 'Rooms',
9595
ancestors: [{ name: 'Hotels', slug: 'hotels' }],
96-
depth: 1,
96+
depth: 1
9797
});
9898
const recs = folderRecords([top, nested]);
9999
expect(recs.map((r) => r.id)).toEqual(['f1', 'f2']);
@@ -108,23 +108,23 @@ describe('buildSearchRecords', () => {
108108
name: 'Auth',
109109
ancestors: [
110110
{ name: 'Billing', slug: 'billing' },
111-
{ name: 'Customers', slug: 'billing/customers' },
111+
{ name: 'Customers', slug: 'billing/customers' }
112112
],
113-
depth: 2,
113+
depth: 2
114114
});
115115
const productsAuth = folderEntry({
116116
uuid: 'f2',
117117
slug: 'products/users/auth',
118118
name: 'Auth',
119119
ancestors: [
120120
{ name: 'Products', slug: 'products' },
121-
{ name: 'Users', slug: 'products/users' },
121+
{ name: 'Users', slug: 'products/users' }
122122
],
123-
depth: 2,
123+
depth: 2
124124
});
125125
expect(folderRecords([billingAuth, productsAuth]).map((r) => r.ancestorNames)).toEqual([
126126
['Billing', 'Customers'],
127-
['Products', 'Users'],
127+
['Products', 'Users']
128128
]);
129129
});
130130

@@ -134,16 +134,16 @@ describe('buildSearchRecords', () => {
134134
items: [
135135
childItem('List', 'http'),
136136
childItem('Create', 'http'),
137-
childItem('Nested', 'folder', [childItem('Deep', 'http'), childItem('Deeper', 'folder', [childItem('Deepest', 'http')])]),
138-
],
137+
childItem('Nested', 'folder', [childItem('Deep', 'http'), childItem('Deeper', 'folder', [childItem('Deepest', 'http')])])
138+
]
139139
});
140140
expect(folderRecords([entry])[0].requestCount).toBe(4);
141141
});
142142

143143
it('does not count script files as requests', () => {
144144
const entry = folderEntry({
145145
uuid: 'f1',
146-
items: [childItem('List', 'http'), childItem('setup', 'script')],
146+
items: [childItem('List', 'http'), childItem('setup', 'script')]
147147
});
148148
expect(folderRecords([entry])[0].requestCount).toBe(1);
149149
});
@@ -153,7 +153,7 @@ describe('buildSearchRecords', () => {
153153
slug: '', type: 'overview', name: 'Overview', item: null, ancestors: [], depth: -1,
154154
};
155155
const environments: NavEntry = {
156-
slug: '~environments', type: 'environments', name: 'Environments', item: null, ancestors: [], depth: -1,
156+
slug: '~environments', type: 'environments', name: 'Environments', item: null, ancestors: [], depth: -1
157157
};
158158
expect(buildSearchRecords([overview, environments])).toHaveLength(0);
159159
});
@@ -171,27 +171,27 @@ describe('formatBreadcrumb', () => {
171171
expect(formatBreadcrumb(['Hotels'])).toEqual({ full: 'Hotels', display: 'Hotels' });
172172
expect(formatBreadcrumb(['Hotels', 'Auth', 'Auth 2'])).toEqual({
173173
full: 'Hotels / Auth / Auth 2',
174-
display: 'Hotels / Auth / Auth 2',
174+
display: 'Hotels / Auth / Auth 2'
175175
});
176176
});
177177

178178
it('collapses the middle of a deeper chain, keeping the first and last folder', () => {
179179
expect(formatBreadcrumb(['Hotels', 'Auth', 'Auth 2', 'Legacy'])).toEqual({
180180
full: 'Hotels / Auth / Auth 2 / Legacy',
181-
display: 'Hotels / … / Legacy',
181+
display: 'Hotels / … / Legacy'
182182
});
183183
});
184184

185185
it('counts folders, not separators, so a name holding " / " cannot mis-segment', () => {
186186
// Three folders, the middle one carrying a separator inside its own name.
187187
expect(formatBreadcrumb(['Billing', 'A / B', 'Payments'])).toEqual({
188188
full: 'Billing / A / B / Payments',
189-
display: 'Billing / A / B / Payments',
189+
display: 'Billing / A / B / Payments'
190190
});
191191
// Four folders elide from the ends, however many separators the names hold.
192192
expect(formatBreadcrumb(['Billing', 'A / B', 'Payments', 'v3'])).toEqual({
193193
full: 'Billing / A / B / Payments / v3',
194-
display: 'Billing / … / v3',
194+
display: 'Billing / … / v3'
195195
});
196196
});
197197
});
@@ -222,11 +222,11 @@ describe('collectMethods', () => {
222222
});
223223

224224
const rec = (over: Partial<RequestSearchRecord>): RequestSearchRecord => ({
225-
type: 'request', id: 'id', slug: 's', name: '', method: 'GET', ancestorNames: [], ancestorSlugs: [], url: '', ...over,
225+
type: 'request', id: 'id', slug: 's', name: '', method: 'GET', ancestorNames: [], ancestorSlugs: [], url: '', ...over
226226
});
227227

228228
const folderRec = (over: Partial<FolderSearchRecord>): FolderSearchRecord => ({
229-
type: 'folder', id: 'fid', slug: 'f', name: '', ancestorNames: [], ancestorSlugs: [], requestCount: 0, ...over,
229+
type: 'folder', id: 'fid', slug: 'f', name: '', ancestorNames: [], ancestorSlugs: [], requestCount: 0, ...over
230230
});
231231

232232
/** Substrings the reported ranges actually cover, for match-locality assertions. */
@@ -241,7 +241,7 @@ const BILLING: RequestSearchRecord[] = [
241241
rec({ id: 'invoices', name: 'Get All Invoices', ancestorNames: ['Billing'], url: '{{baseUrl}}/billing/invoices' }),
242242
rec({ id: 'customers', name: 'Get All Customers', ancestorNames: ['Billing'], url: '{{baseUrl}}/billing/customers' }),
243243
rec({ id: 'subs', name: 'Get All Subscriptions', ancestorNames: ['Billing'], url: '{{baseUrl}}/billing/subscriptions' }),
244-
rec({ id: 'currencies', name: 'Get Currencies', ancestorNames: ['Billing', 'Lookups'], url: '{{baseUrl}}/billing/lookups/currencies' }),
244+
rec({ id: 'currencies', name: 'Get Currencies', ancestorNames: ['Billing', 'Lookups'], url: '{{baseUrl}}/billing/lookups/currencies' })
245245
];
246246

247247
describe('searchHits - empty & degenerate queries', () => {
@@ -367,7 +367,7 @@ describe('orderFoldersFirst', () => {
367367
hit(rec({ id: 'r1' })),
368368
hit(folderRec({ id: 'f1' })),
369369
hit(rec({ id: 'r2' })),
370-
hit(folderRec({ id: 'f2' })),
370+
hit(folderRec({ id: 'f2' }))
371371
]);
372372
expect(ordered.map((h) => h.record.id)).toEqual(['f1', 'f2', 'r1', 'r2']);
373373
});

packages/bruno-api-docs/src/components/Search/searchIndex.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,14 @@ export const buildSearchRecords = (entries: NavEntry[]): SearchRecord[] => {
7171
records.push({
7272
type: 'folder',
7373
...common,
74-
requestCount: countFolderRequests(entry.item as Folder),
74+
requestCount: countFolderRequests(entry.item as Folder)
7575
});
7676
} else if (entry.type === 'request') {
7777
records.push({
7878
type: 'request',
7979
...common,
8080
method: entry.method,
81-
url: getRequestUrl(entry.item as never),
81+
url: getRequestUrl(entry.item as never)
8282
});
8383
}
8484
}

packages/bruno-api-docs/src/e2eFixtures/foldersCollection.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export const foldersFixtureCollection = {
9797
name: 'Consolidated Retention and Deletion Policy Configuration',
9898
type: 'folder',
9999
seq: 2,
100-
items: [],
100+
items: []
101101
},
102102
{
103103
name: 'Archive',
@@ -110,12 +110,12 @@ export const foldersFixtureCollection = {
110110
name: 'Legacy',
111111
type: 'folder',
112112
seq: 1,
113-
items: [{ name: 'Snapshots v2', type: 'folder', seq: 1, items: [] }],
114-
},
115-
],
116-
},
117-
],
118-
},
113+
items: [{ name: 'Snapshots v2', type: 'folder', seq: 1, items: [] }]
114+
}
115+
]
116+
}
117+
]
118+
}
119119
],
120120
},
121121
{ name: 'Health Check', type: 'http', seq: 5, method: 'GET', url: '{{host}}/ping' },

0 commit comments

Comments
 (0)