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

[ASAP-201] - update eslint plugins #4047

Merged
merged 8 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
829 changes: 599 additions & 230 deletions .pnp.cjs

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion apps/asap-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"got": "11.8.6",
"jwt-encode": "1.0.1",
"luxon": "1.28.1",
"prettier": "2.8.8",
"prettier": "3.0.2",
"pump": "3.0.0",
"through2-concurrent": "2.0.0",
"uuid": "8.3.2",
Expand Down
4 changes: 2 additions & 2 deletions apps/asap-cli/src/scripts/algolia/get-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const getAlgoliaSettings = async ({
const client = algoliasearch(algoliaAppId, algoliaCiApiKey);
const index = client.initIndex(indexName);
const { replicas: _, ...indexSettings } = await index.getSettings();
const formattedIndexSettings = prettier.format(
const formattedIndexSettings = await prettier.format(
JSON.stringify(indexSettings),
{ parser: 'json' },
);
Expand All @@ -36,7 +36,7 @@ export const getAlgoliaSettings = async ({
const { customRanking, attributesForFaceting, attributesToIndex } =
await replicaIndex.getSettings();

const formattedReplicaSettings = prettier.format(
const formattedReplicaSettings = await prettier.format(
JSON.stringify({
customRanking,
attributesForFaceting,
Expand Down
6 changes: 3 additions & 3 deletions apps/auth0/src/__tests__/post-login-connect-user.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ it('should call the connections api with Auth0 UserId, invitation code and Share
apiBase,
);
expect(nock.isDone()).toBe(true);
expect(apiBase.access.deny).not.toBeCalled();
expect(apiBase.access.deny).not.toHaveBeenCalled();
});

it('should not call the connections api when there is no invitation code (because they have already connected their accounts)', async () => {
Expand All @@ -209,7 +209,7 @@ it('should not call the connections api when there is no invitation code (becaus
apiBase,
);
expect(nock.isDone()).toBe(false);
expect(apiBase.access.deny).not.toBeCalled();
expect(apiBase.access.deny).not.toHaveBeenCalled();
});

it('should deny access if the backend throws an error and fails connect the user', async () => {
Expand All @@ -221,5 +221,5 @@ it('should deny access if the backend throws an error and fails connect the user
.reply(404);
await onExecutePostLogin(eventBase, apiBase);
expect(nock.isDone()).toBe(true);
expect(apiBase.access.deny).toBeCalled();
expect(apiBase.access.deny).toHaveBeenCalled();
});
2 changes: 1 addition & 1 deletion apps/crn-auth-frontend/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
Expand Down
2 changes: 1 addition & 1 deletion apps/crn-frontend/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ it('renders latest users filtered by active users', async () => {
mockGetUsers.mockResolvedValueOnce(createListUserResponse(3));
const { container } = await renderDashboard({});

expect(mockGetUsers).toBeCalledWith(
expect(mockGetUsers).toHaveBeenCalledWith(
expect.anything(),
expect.objectContaining({
filters: new Set([activeUserMembershipStatus]),
Expand Down
16 changes: 8 additions & 8 deletions apps/crn-frontend/src/events/__tests__/api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ describe('getEvents', () => {
getEventListOptions(new Date('2021-01-01T12:00:00'), { past: true }),
);

expect(search).toBeCalledWith(
expect(search).toHaveBeenCalledWith(
['event'],
'',
{
Expand All @@ -87,7 +87,7 @@ describe('getEvents', () => {
}),
);

expect(search).toBeCalledWith(
expect(search).toHaveBeenCalledWith(
['event'],
'',
{
Expand All @@ -105,7 +105,7 @@ describe('getEvents', () => {
algoliaSearchClient,
getEventListOptions(new Date('2021-01-01T12:00:00'), { past: false }),
);
expect(search).toBeCalledWith(
expect(search).toHaveBeenCalledWith(
['event'],
'',
{
Expand All @@ -124,7 +124,7 @@ describe('getEvents', () => {
...getEventListOptions(new Date('2021-01-01T12:00:00'), { past: false }),
constraint: { userId: 'user-1' },
});
expect(search).toBeCalledWith(
expect(search).toHaveBeenCalledWith(
['event'],
'',
{
Expand All @@ -144,7 +144,7 @@ describe('getEvents', () => {
...getEventListOptions(new Date('2021-01-01T12:00:00Z'), { past: true }),
constraint: { userId: 'user-1' },
});
expect(search).toBeCalledWith(
expect(search).toHaveBeenCalledWith(
['event'],
'',
{
Expand All @@ -164,7 +164,7 @@ describe('getEvents', () => {
...getEventListOptions(new Date('2021-01-01T12:00:00'), { past: false }),
constraint: { teamId: 'team-1' },
});
expect(search).toBeCalledWith(
expect(search).toHaveBeenCalledWith(
['event'],
'',
{
Expand Down Expand Up @@ -216,7 +216,7 @@ describe('getEvents', () => {
...getEventListOptions(new Date('2021-01-01T12:00:00'), { past: false }),
constraint: { interestGroupId: 'group-5' },
});
expect(search).toBeCalledWith(
expect(search).toHaveBeenCalledWith(
['event'],
'',
{
Expand All @@ -236,7 +236,7 @@ describe('getEvents', () => {
...getEventListOptions(new Date('2021-01-01T12:00:00'), { past: false }),
constraint: { workingGroupId: 'wg-1' },
});
expect(search).toBeCalledWith(
expect(search).toHaveBeenCalledWith(
['event'],
'',
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,17 @@ const wrapper =
currentRoute: string;
user?: Partial<User>;
}): React.FC =>
({ children }) =>
(
<RecoilRoot
initializeState={({ set }) => {
user?.id && set(refreshUserState(user.id), Math.random());
}}
>
<Auth0Provider user={user}>
<MemoryRouter initialEntries={[currentRoute]}>
{children}
</MemoryRouter>
</Auth0Provider>
</RecoilRoot>
);
({ children }) => (
<RecoilRoot
initializeState={({ set }) => {
user?.id && set(refreshUserState(user.id), Math.random());
}}
>
<Auth0Provider user={user}>
<MemoryRouter initialEntries={[currentRoute]}>{children}</MemoryRouter>
</Auth0Provider>
</RecoilRoot>
);
it('returns undefined when on different user profile', async () => {
const userId = 'test123';
const route = network({})
Expand Down
49 changes: 24 additions & 25 deletions apps/crn-frontend/src/hooks/__tests__/onboarding.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,31 +28,30 @@ const emptyUser: UserResponse = {

const wrapper =
({ user }: { user?: UserResponse }): React.FC =>
({ children }) =>
(
<RecoilRoot
initializeState={({ set }) => {
user?.id && set(refreshUserState(user.id), Math.random());
}}
>
<Auth0Provider user={{ id: user?.id, onboarded: user?.onboarded }}>
<WhenReady>
<MemoryRouter
initialEntries={[
network({})
.users({})
.user({
userId: user?.id ?? '',
})
.research({}).$,
]}
>
{children}
</MemoryRouter>
</WhenReady>
</Auth0Provider>
</RecoilRoot>
);
({ children }) => (
<RecoilRoot
initializeState={({ set }) => {
user?.id && set(refreshUserState(user.id), Math.random());
}}
>
<Auth0Provider user={{ id: user?.id, onboarded: user?.onboarded }}>
<WhenReady>
<MemoryRouter
initialEntries={[
network({})
.users({})
.user({
userId: user?.id ?? '',
})
.research({}).$,
]}
>
{children}
</MemoryRouter>
</WhenReady>
</Auth0Provider>
</RecoilRoot>
);

describe('useOnboarding', () => {
beforeEach(() => mockGetUser.mockClear());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ it('will toast server side errors for unknown errors', async () => {
'There was an error and we were unable to save your changes. Please try again.',
),
).toBeInTheDocument();
expect(window.scrollTo).toBeCalled();
expect(window.scrollTo).toHaveBeenCalled();
});

it('will toast server side errors for unknown errors in edit mode', async () => {
Expand Down Expand Up @@ -541,7 +541,7 @@ it('will toast server side errors for unknown errors in edit mode', async () =>
'There was an error and we were unable to save your changes. Please try again.',
),
).toBeInTheDocument();
expect(window.scrollTo).toBeCalled();
expect(window.scrollTo).toHaveBeenCalled();
});

it('display a toast warning when creating a new version', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ it.each`
'Search by topic, presenting team, …',
);
expect(await screen.findByText(/Event 0/i)).toBeVisible();
expect(mockGetEventsFromAlgolia).toBeCalledTimes(2);
expect(mockGetEventsFromAlgolia).toHaveBeenCalledTimes(2);

expect(mockGetEventsFromAlgolia).toHaveBeenCalledWith(expect.anything(), {
before: '2021-12-28T13:00:00.000Z',
Expand Down
47 changes: 23 additions & 24 deletions apps/crn-frontend/src/network/users/__tests__/About.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,30 @@ const mockPatchUser = patchUser as jest.MockedFunction<typeof patchUser>;
const id = '42';
const makeWrapper =
(userId = id, currentUserId = userId): FC<Record<string, never>> =>
({ children }) =>
(
<RecoilRoot>
<Suspense fallback="loading">
<Auth0Provider user={{ id: currentUserId }}>
<MemoryRouter
initialEntries={[
network({}).users({}).user({ userId }).about({}).$,
]}
({ children }) => (
<RecoilRoot>
<Suspense fallback="loading">
<Auth0Provider user={{ id: currentUserId }}>
<MemoryRouter
initialEntries={[
network({}).users({}).user({ userId }).about({}).$,
]}
>
<Route
path={
network.template +
network({}).users.template +
network({}).users({}).user.template +
network({}).users({}).user({ userId }).about.template
}
>
<Route
path={
network.template +
network({}).users.template +
network({}).users({}).user.template +
network({}).users({}).user({ userId }).about.template
}
>
{children}
</Route>
</MemoryRouter>
</Auth0Provider>
</Suspense>
</RecoilRoot>
);
{children}
</Route>
</MemoryRouter>
</Auth0Provider>
</Suspense>
</RecoilRoot>
);
const wrapper = makeWrapper();

it('renders the profile about section', async () => {
Expand Down
47 changes: 23 additions & 24 deletions apps/crn-frontend/src/network/users/__tests__/Research.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,31 +23,30 @@ const mockPatchUser = patchUser as jest.MockedFunction<typeof patchUser>;
const id = '42';
const makeWrapper =
(userId = id, currentUserId = userId): FC =>
({ children }) =>
(
<RecoilRoot>
<Suspense fallback="loading">
<Auth0Provider user={{ id: currentUserId }}>
<MemoryRouter
initialEntries={[
network({}).users({}).user({ userId }).research({}).$,
]}
({ children }) => (
<RecoilRoot>
<Suspense fallback="loading">
<Auth0Provider user={{ id: currentUserId }}>
<MemoryRouter
initialEntries={[
network({}).users({}).user({ userId }).research({}).$,
]}
>
<Route
path={
network.template +
network({}).users.template +
network({}).users({}).user.template +
network({}).users({}).user({ userId }).research.template
}
>
<Route
path={
network.template +
network({}).users.template +
network({}).users({}).user.template +
network({}).users({}).user({ userId }).research.template
}
>
{children}
</Route>
</MemoryRouter>
</Auth0Provider>
</Suspense>
</RecoilRoot>
);
{children}
</Route>
</MemoryRouter>
</Auth0Provider>
</Suspense>
</RecoilRoot>
);
const wrapper = makeWrapper();

it('renders the profile research section', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ it('navigates to the upcoming events tab', async () => {
'Search by topic, presenting team, …',
);
expect(await screen.findByText(/Event 0/i)).toBeVisible();
expect(mockUserEventsFromAlgolia).toBeCalledTimes(2);
expect(mockUserEventsFromAlgolia).toHaveBeenCalledTimes(2);
expect(mockUserEventsFromAlgolia).toHaveBeenCalledWith(expect.anything(), {
after: '2021-12-28T13:00:00.000Z',
currentPage: 0,
Expand Down Expand Up @@ -483,7 +483,7 @@ it('navigates to the past events tab', async () => {
'Search by topic, presenting team, …',
);
expect(await screen.findByText(/Event 0/i)).toBeVisible();
expect(mockUserEventsFromAlgolia).toBeCalledTimes(2);
expect(mockUserEventsFromAlgolia).toHaveBeenCalledTimes(2);
expect(mockUserEventsFromAlgolia).toHaveBeenCalledWith(expect.anything(), {
after: '2021-12-28T13:00:00.000Z',
currentPage: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ it('will toast server side errors for unknown errors', async () => {
'There was an error and we were unable to save your changes. Please try again.',
),
).toBeInTheDocument();
expect(window.scrollTo).toBeCalled();
expect(window.scrollTo).toHaveBeenCalled();
});

it('display a toast warning when creating a new version', async () => {
Expand Down
Loading
Loading