Skip to content

Commit

Permalink
chore(website): run eslint as defined in config (#1540)
Browse files Browse the repository at this point in the history
Also introduce a convenience script `npm run check` that checks both format and types
  • Loading branch information
corneliusroemer authored Apr 2, 2024
1 parent d527877 commit 883c337
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 11 deletions.
5 changes: 3 additions & 2 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
"dev": "astro dev",
"start": "astro dev",
"start-server": "astro build && astro preview --port 3000",
"check": "npm run check-types && npm run check-format",
"check-types": "astro check && tsc --noEmit",
"build": "astro build",
"preview": "astro preview",
"astro": "astro",
"check-format": "eslint \"src/**/*.{ts,tsx,astro}\" && prettier --ignore-path \"../.gitignore\" --check \"./**/*.{ts,tsx,json,astro,cjs,mjs}\"",
"format": "eslint \"src/**/*.{ts,tsx,astro}\" --fix && npm run format-fast",
"check-format": "eslint \"./**/*.{ts,tsx,astro}\" && prettier --ignore-path \"../.gitignore\" --check \"./**/*.{ts,tsx,json,astro,cjs,mjs}\"",
"format": "eslint \"./**/*.{ts,tsx,astro}\" --fix && npm run format-fast",
"format-fast": "prettier --ignore-path \"../.gitignore\" --write \"./**/*.{ts,tsx,json,astro,cjs,mjs}\"",
"test": "vitest",
"e2e": "npx playwright test",
Expand Down
1 change: 1 addition & 0 deletions website/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/strict-boolean-expressions */
import { defineConfig, devices } from '@playwright/test';

/**
Expand Down
2 changes: 1 addition & 1 deletion website/tests/e2e.fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import { ResultAsync } from 'neverthrow';
import { Issuer } from 'openid-client';
import winston from 'winston';

import { SeqSetPage } from './pages/seqsets/seqset.page';
import { EditPage } from './pages/edit/edit.page';
import { NavigationFixture } from './pages/navigation.fixture';
import { ReviewPage } from './pages/review/review.page.ts';
import { RevisePage } from './pages/revise/revise.page';
import { SearchPage } from './pages/search/search.page';
import { SeqSetPage } from './pages/seqsets/seqset.page';
import { SequencePage } from './pages/sequences/sequences.page';
import { SubmitPage } from './pages/submission/submit.page';
import { GroupPage } from './pages/user/group/group.page.ts';
Expand Down
5 changes: 3 additions & 2 deletions website/tests/pages/navigation.fixture.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { expect } from '../e2e.fixture.ts';
import type { Page } from '@playwright/test';

import { expect } from '../e2e.fixture.ts';

export class NavigationFixture {
constructor(public readonly page: Page) {}

public async clickLink(name: string) {
await this.page.getByRole('link', { name: name, exact: true }).click();
await this.page.getByRole('link', { name, exact: true }).click();
}

public async openOrganismNavigation() {
Expand Down
2 changes: 1 addition & 1 deletion website/tests/pages/search/search.page.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { Locator, Page } from '@playwright/test';

import { baseUrl, dummyOrganism } from '../../e2e.fixture';
import { routes } from '../../../src/routes/routes.ts';
import type { FilterValue } from '../../../src/types/config.ts';
import { baseUrl, dummyOrganism } from '../../e2e.fixture';

export const ACCESSION = 'Accession';

Expand Down
2 changes: 1 addition & 1 deletion website/tests/pages/seqsets/[seqSetId].spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { authorize, expect, test } from '../../e2e.fixture';
import { SeqSetPage } from './seqset.page';
import { authorize, expect, test } from '../../e2e.fixture';

test.describe.configure({ mode: 'serial' });
let testSeqSetManager: SeqSetPage;
Expand Down
2 changes: 1 addition & 1 deletion website/tests/pages/seqsets/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect, test, authorize } from '../../e2e.fixture';
import { SeqSetPage } from './seqset.page';
import { expect, test, authorize } from '../../e2e.fixture';

test.describe.configure({ mode: 'serial' });
let testSeqSetManager: SeqSetPage;
Expand Down
5 changes: 3 additions & 2 deletions website/tests/playwrightSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import {
testUserPassword,
} from './e2e.fixture.ts';
import { prepareDataToBe } from './util/prepareDataToBe.ts';
import { LapisClient } from '../src/services/lapisClient.ts';
import type { AccessionVersion } from '../src/types/backend.ts';
import { getTestSequences, setTestSequences } from './util/testSequenceProvider.ts';
import { GroupManagementClient } from '../src/services/groupManagementClient.ts';
import { LapisClient } from '../src/services/lapisClient.ts';
import type { AccessionVersion } from '../src/types/backend.ts';

enum LapisStateBeforeTests {
NotCorrectSequencesInLapis = 'NotCorrectSequencesInLapis',
Expand Down Expand Up @@ -75,6 +75,7 @@ export default async function globalSetupForPlaywright() {
.join(', '),
);

// eslint-disable-next-line @typescript-eslint/no-unused-vars
for (const _ of Array(maxNumberOfRetries)) {
e2eLogger.info('waiting for sequences in LAPIS...');
await waitSeconds(secondsToWait);
Expand Down
2 changes: 1 addition & 1 deletion website/tests/util/createFileContent.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { readFileSync } from 'fs';

import { ACCESSION_FIELD } from '../../src/settings.ts';
import type { Accession } from '../../src/types/backend.ts';
import { fastaEntryToString, parseFasta } from '../../src/utils/parseFasta.ts';
import { metadataTestFile, sequencesTestFile, testSequenceCount } from '../e2e.fixture.ts';
import { ACCESSION_FIELD } from '../../src/settings.ts';

type FileContent = {
metadataContent: string;
Expand Down

0 comments on commit 883c337

Please sign in to comment.