Skip to content

Commit

Permalink
update eslint-config-slapshot to 0.4.0 (#174)
Browse files Browse the repository at this point in the history
Addresses some styling nits.

J=SLAP-2135
TEST=none
  • Loading branch information
oshi97 committed Jun 21, 2022
1 parent 3620200 commit 275213b
Show file tree
Hide file tree
Showing 13 changed files with 505 additions and 420 deletions.
880 changes: 484 additions & 396 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@
"@types/jest": "^28.1.1",
"@typescript-eslint/eslint-plugin": "^5.16.0",
"@typescript-eslint/parser": "^5.16.0",
"@yext/eslint-config-slapshot": "^0.2.0",
"@yext/eslint-config-slapshot": "^0.4.0",
"@yext/eslint-plugin-export-star": "^1.0.2",
"babel-jest": "^26.6.1",
"babel-loader": "^8.2.2",
"eslint": "^8.11.0",
"eslint-config-react-app": "^7.0.0",
"eslint-config-react-app": "^7.0.1",
"eslint-plugin-tsdoc": "^0.2.14",
"generate-license-file": "^1.3.0",
"jest": "^28.1.0",
Expand Down
2 changes: 1 addition & 1 deletion src/infra/SearchServiceImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export class SearchServiceImpl implements SearchService {
source: request.querySource || QuerySource.Standard,
visitorId: this.config.visitor?.id,
visitorIdMethod: this.config.visitor?.idMethod,
restrictVerticals: request.restrictVerticals && request.restrictVerticals.join(','),
restrictVerticals: request.restrictVerticals?.join(','),
...this.config?.additionalQueryParams
};

Expand Down
1 change: 0 additions & 1 deletion src/transformers/searchservice/createFailedVertical.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { FailedVertical } from '../../models/searchservice/response/FailedVertical';


export function createFailedVertical(data: any): FailedVertical {
return {
verticalKey: data.verticalConfigId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ export function createUniversalSearchResponse(data: any): UniversalSearchRespons
locationBias: data.response.locationBias && createLocationBias(data.response.locationBias),
uuid: data.meta.uuid,
queryRulesActionsData: data.response.queryRulesActionsData,
failedVerticals: data.response.failedVerticals && data.response.failedVerticals.map(createFailedVertical)
failedVerticals: data.response.failedVerticals?.map(createFailedVertical)
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ export function createVerticalSearchResponse(data: any): VerticalSearchResponse
locationBias: data.response.locationBias && createLocationBias(data.response.locationBias),
allResultsForVertical: data.response.allResultsForVertical
&& createVerticalSearchResponse({ response: data.response.allResultsForVertical }),
alternativeVerticals: data.response.alternativeVerticals && data.response.alternativeVerticals.modules
&& data.response.alternativeVerticals.modules.map(createVerticalResults),
alternativeVerticals: data.response.alternativeVerticals?.modules?.map(createVerticalResults),
uuid: data.meta?.uuid,
queryRulesActionsData: data.response.queryRulesActionsData
};
Expand Down
2 changes: 1 addition & 1 deletion src/utils/urlutils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export function addParamsToURL(
const parsedUrl = new URL(url);
const urlParams = new URLSearchParams(parsedUrl.search.substring(1));

const sanitizedParams: SanitizedQueryParams = sanitizeQueryParams (params);
const sanitizedParams: SanitizedQueryParams = sanitizeQueryParams(params);

for (const key in sanitizedParams) {
urlParams.append(key, sanitizedParams[key].toString());
Expand Down
1 change: 0 additions & 1 deletion tests/infra/HttpServiceImpl.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ describe('HttpServiceImpl', () => {
expect(fetch).toHaveBeenLastCalledWith('http://yext.com/?nodeQuery=param', expect.anything());
});


it('makes request with custom client SDK, but only when not falsy', async () => {
const queryParams = {
aQuery: 'param'
Expand Down
12 changes: 6 additions & 6 deletions tests/infra/SearchServiceImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ describe('SearchService', () => {
};
const expectedQueryParams = {
api_key: 'testApiKey',
context: JSON.stringify({ key:'value' }),
context: JSON.stringify({ key: 'value' }),
experienceKey: 'testExperienceKey',
limit: JSON.stringify({ people: 17 }),
input: 'testQuery',
Expand Down Expand Up @@ -286,12 +286,12 @@ describe('SearchService', () => {
context: JSON.stringify({ key: 'value' }),
experienceKey: 'testExperienceKey',
facetFilters: JSON.stringify({
c_awards:[{
c_awards: { $eq:'Impact Award' }
c_awards: [{
c_awards: { $eq: 'Impact Award' }
}]
}),
filters: JSON.stringify({
city:{ ['!$eq']: 'Arlington' }
city: { ['!$eq']: 'Arlington' }
}),
input: 'testQuery',
limit: 10,
Expand All @@ -307,8 +307,8 @@ describe('SearchService', () => {
sessionTrackingEnabled: true,
skipSpellCheck: true,
sortBys: JSON.stringify([{
direction:'ASC',
field:'name',
direction: 'ASC',
field: 'name',
type: 'FIELD'
}]),
source: 'STANDARD',
Expand Down
10 changes: 6 additions & 4 deletions tests/serializers/serializeFacets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ it('serializeFacets serializes facets properly', () => {
{ fieldId: 'c_jobCategory', options: [
{ matcher: Matcher.Equals, value: 'Sales' },
{ matcher: Matcher.Equals, value: 'Client Success' },
{ matcher: Matcher.Equals, value: 'Finance' }] },
{ matcher: Matcher.Equals, value: 'Finance' }
] },
{ fieldId: 'c_jobLocationShortDescription', options: [
{ matcher: Matcher.Equals, value: 'New York' },
{ matcher: Matcher.Equals, value: 'Chicago' }] },
{ matcher: Matcher.Equals, value: 'Chicago' }
] },
]);

const expectedSerializedFilters = {
Expand Down Expand Up @@ -43,7 +45,8 @@ it('serializeFacets serializes a mix of disabled and enabled filters properly',
const actualSerializedFilters = serializeFacets([
{ fieldId: 'c_jobCategory', options: [
{ matcher: Matcher.Equals, value: 'Sales' },
{ matcher: Matcher.Equals, value: 'Client Success' }] },
{ matcher: Matcher.Equals, value: 'Client Success' }
] },
{ fieldId: 'c_jobLocationShortDescription', options: [] },
]);

Expand All @@ -57,7 +60,6 @@ it('serializeFacets serializes a mix of disabled and enabled filters properly',
expect(actualSerializedFilters).toEqual(JSON.stringify(expectedSerializedFilters));
});


it('serializeFacets serializes number range facets properly', () => {
const actualSerializedFilters = serializeFacets([
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { createAutocompleteResult } from '../../../src/transformers/autocompleteservice/createAutocompleteResult';


describe('AutocompleteResult', () => {
it('result with no filter is parsed correctly', () => {
const resultWithNoFilter = {
Expand Down
4 changes: 2 additions & 2 deletions tests/transformers/createAppliedQueryFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ it('createAppliedQueryFilter correctly transforms appliedQueryFilters with "INTE
}
}
},
type:'INTENT'
type: 'INTENT'
}
]
};
Expand Down Expand Up @@ -91,7 +91,7 @@ it('createAppliedQueryFilter correctly transforms appliedQueryFilters with "PLAC
{
displayKey: 'Location',
displayValue: 'Virginia',
filter:{
filter: {
'builtin.location': {
'$eq': 'P-region.7919684583758790'
}
Expand Down
3 changes: 1 addition & 2 deletions tests/transformers/searchservice/ResultsFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ it('properly transforms Knowledge Graph results', () => {
highlightedFields: {},
distance: 36032,
distanceFromFilter: 3821
}
];
}];
const expectedResults = [{
description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit',
distance: 36032,
Expand Down

0 comments on commit 275213b

Please sign in to comment.