Skip to content

Commit

Permalink
fix(linting): fix local npm lint scripts (#1207)
Browse files Browse the repository at this point in the history
- also run lint-fix and add the fixed files
  • Loading branch information
jpetto authored Jun 20, 2024
1 parent 0e39129 commit 066cf41
Show file tree
Hide file tree
Showing 80 changed files with 419 additions and 408 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@
"build": "DISABLE_ESLINT_PLUGIN=true node scripts/build.js",
"test": "node scripts/test.js --transformIgnorePatterns \"node_modules/(?!@apollo/client/link/core/ApolloLink.js)/\"",
"test:nowatch": "node scripts/test.js --watchAll=false --transformIgnorePatterns \"node_modules/(?!@apollo/client/link/core/ApolloLink.js)/\"",
"lint-check": "tsc --noEmit && eslint src/**/*.ts{,x}",
"lint-fix": "tsc --noEmit && eslint src/**/*.ts{,x} --fix",
"lint-check": "eslint src/**/*.ts{,x}",
"lint-fix": "eslint src/**/*.ts{,x} --fix",
"api:generate-types": "graphql-codegen --config src/config/admin-api-codegen.json -r dotenv/config"
},
"jest": {
Expand Down
2 changes: 1 addition & 1 deletion src/_shared/components/Button/Button.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('The Button component', () => {
render(
<Button buttonType="neutral" size="large">
Snooze
</Button>
</Button>,
);

const button = screen.getByRole('button');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('The CardActionButtonRow component', () => {
onReschedule={onReschedule}
onMoveToBottom={onMoveToBottom}
onReject={onReject}
/>
/>,
);

// assert edit button is present and calls its callback
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('The CorpusItemCardImage component', () => {
currentScheduledDate={currentScheduledDate}
scheduledSurfaceGuid="NEW_TAB_EN_US"
toggleScheduleHistoryModal={toggleScheduleHistoryModal}
/>
/>,
);

expect(screen.getByText('Health & Fitness')).toBeInTheDocument();
Expand All @@ -46,7 +46,7 @@ describe('The CorpusItemCardImage component', () => {
currentScheduledDate={currentScheduledDate}
scheduledSurfaceGuid="NEW_TAB_EN_US"
toggleScheduleHistoryModal={toggleScheduleHistoryModal}
/>
/>,
);

expect(screen.getByText(/time sensitive/i)).toBeInTheDocument();
Expand All @@ -65,7 +65,7 @@ describe('The CorpusItemCardImage component', () => {
currentScheduledDate={currentScheduledDate}
scheduledSurfaceGuid="NEW_TAB_EN_US"
toggleScheduleHistoryModal={toggleScheduleHistoryModal}
/>
/>,
);

expect(screen.getByText(/collection/i)).toBeInTheDocument();
Expand All @@ -81,7 +81,7 @@ describe('The CorpusItemCardImage component', () => {
currentScheduledDate={currentScheduledDate}
scheduledSurfaceGuid="NEW_TAB_EN_US"
toggleScheduleHistoryModal={toggleScheduleHistoryModal}
/>
/>,
);

expect(screen.getByText(/syndicated/i)).toBeInTheDocument();
Expand Down Expand Up @@ -113,7 +113,7 @@ describe('The CorpusItemCardImage component', () => {
currentScheduledDate={currentScheduledDate}
scheduledSurfaceGuid="NEW_TAB_EN_US"
toggleScheduleHistoryModal={toggleScheduleHistoryModal}
/>
/>,
);

expect(screen.getByText(/last scheduled 2 days ago/i)).toBeInTheDocument();
Expand Down Expand Up @@ -146,7 +146,7 @@ describe('The CorpusItemCardImage component', () => {
currentScheduledDate="2024-05-25"
scheduledSurfaceGuid="NEW_TAB_EN_US"
toggleScheduleHistoryModal={toggleScheduleHistoryModal}
/>
/>,
);

expect(screen.getByTestId('last-scheduled-overlay')).toHaveStyle({
Expand Down Expand Up @@ -180,7 +180,7 @@ describe('The CorpusItemCardImage component', () => {
currentScheduledDate="2024-05-25"
scheduledSurfaceGuid="NEW_TAB_EN_US"
toggleScheduleHistoryModal={toggleScheduleHistoryModal}
/>
/>,
);

expect(screen.getByTestId('last-scheduled-overlay')).toHaveStyle({
Expand Down Expand Up @@ -214,7 +214,7 @@ describe('The CorpusItemCardImage component', () => {
currentScheduledDate="2024-05-25"
scheduledSurfaceGuid="NEW_TAB_EN_US"
toggleScheduleHistoryModal={toggleScheduleHistoryModal}
/>
/>,
);

expect(screen.getByTestId('last-scheduled-overlay')).toHaveStyle({
Expand Down Expand Up @@ -248,7 +248,7 @@ describe('The CorpusItemCardImage component', () => {
currentScheduledDate="2024-05-25"
scheduledSurfaceGuid="NEW_TAB_EN_US"
toggleScheduleHistoryModal={toggleScheduleHistoryModal}
/>
/>,
);

expect(screen.getByTestId('last-scheduled-overlay')).toHaveStyle({
Expand Down Expand Up @@ -282,7 +282,7 @@ describe('The CorpusItemCardImage component', () => {
currentScheduledDate="2024-05-25"
scheduledSurfaceGuid="NEW_TAB_EN_US"
toggleScheduleHistoryModal={toggleScheduleHistoryModal}
/>
/>,
);

expect(screen.getByTestId('last-scheduled-overlay')).toHaveStyle({
Expand All @@ -303,7 +303,7 @@ describe('The CorpusItemCardImage component', () => {
currentScheduledDate={currentScheduledDate}
scheduledSurfaceGuid="NEW_TAB_EN_US"
toggleScheduleHistoryModal={toggleScheduleHistoryModal}
/>
/>,
);

expect(screen.getByText(/NEW DOMAIN/i)).toBeVisible();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('The HandleApiResponse component', () => {
loading={true}
loadingText="Loading data, please wait..."
error={undefined}
/>
/>,
);

expect(screen.getByText(/^loading data/i)).toBeInTheDocument();
Expand All @@ -27,7 +27,7 @@ describe('The HandleApiResponse component', () => {
networkError: new Error('Server not found.'),
})
}
/>
/>,
);

// error messages
Expand All @@ -37,7 +37,7 @@ describe('The HandleApiResponse component', () => {

it('renders nothing if the API call is successful', () => {
const { container } = render(
<HandleApiResponse loading={false} error={undefined} />
<HandleApiResponse loading={false} error={undefined} />,
);

expect(container).toBeEmptyDOMElement();
Expand Down
4 changes: 2 additions & 2 deletions src/_shared/components/Header/Header.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('The Header component', () => {
productName="Collections"
/>
</ThemeProvider>
</MemoryRouter>
</MemoryRouter>,
);

// There are two logos: one for desktop, one for mobile
Expand Down Expand Up @@ -66,7 +66,7 @@ describe('The Header component', () => {
productName="Collections"
/>
</ThemeProvider>
</MemoryRouter>
</MemoryRouter>,
);

// Menu links are actual links and not buttons in MUI 5, hooray!
Expand Down
8 changes: 4 additions & 4 deletions src/_shared/components/LoadMore/LoadMore.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('The LoadMore component', () => {
buttonDisabled={buttonDisabled}
loadMore={loadMore}
showSpinner={showSpinner}
/>
/>,
);

expect(screen.getByText(/load more results/i)).toBeInTheDocument();
Expand All @@ -34,7 +34,7 @@ describe('The LoadMore component', () => {
buttonDisabled={buttonDisabled}
loadMore={loadMore}
showSpinner={showSpinner}
/>
/>,
);

const button = screen.getByRole('button') as HTMLButtonElement;
Expand All @@ -52,7 +52,7 @@ describe('The LoadMore component', () => {
buttonDisabled={buttonDisabled}
loadMore={loadMore}
showSpinner={showSpinner}
/>
/>,
);
expect(screen.getByRole('progressbar')).toBeInTheDocument();
});
Expand All @@ -63,7 +63,7 @@ describe('The LoadMore component', () => {
buttonDisabled={buttonDisabled}
loadMore={loadMore}
showSpinner={showSpinner}
/>
/>,
);

const button = screen.getByRole('button') as HTMLButtonElement;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('The MarkdownPreview component', () => {
render(
<MarkdownPreview minHeight={10} source={markdownSource}>
<textarea value={markdownSource} onChange={jest.fn()} />
</MarkdownPreview>
</MarkdownPreview>,
);

// Let's check if we can see the tabs
Expand All @@ -39,7 +39,7 @@ describe('The MarkdownPreview component', () => {
render(
<MarkdownPreview minHeight={10} source={markdownSource}>
<textarea value={markdownSource} onChange={jest.fn()} />
</MarkdownPreview>
</MarkdownPreview>,
);

userEvent.click(screen.getByText(/preview/i));
Expand Down
2 changes: 1 addition & 1 deletion src/_shared/components/Modal/Modal.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe('The Modal component', () => {
render(
<Modal open={true} handleClose={jest.fn()}>
Loading...
</Modal>
</Modal>,
);
const modal = screen.getByText(/^Loading...$/i);

Expand Down
2 changes: 1 addition & 1 deletion src/_shared/components/ScrollToTop/ScrollToTop.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('The ScrollToTop component', () => {
render(
<Router history={history}>
<ScrollToTop />
</Router>
</Router>,
);

// move to another page
Expand Down
2 changes: 1 addition & 1 deletion src/_shared/components/Tab/Tab.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('The Tab component', () => {
to="/en-US/live"
hasLink={true}
/>
</MemoryRouter>
</MemoryRouter>,
);

const tab = screen.getByRole('tab');
Expand Down
6 changes: 3 additions & 3 deletions src/_shared/components/TabLink/TabLink.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('The TabLink component', () => {
<TabLink isCurrentTab={false} to="/any/path/">
Tab title
</TabLink>
</MemoryRouter>
</MemoryRouter>,
);

const tabLink = screen.getByRole('link');
Expand All @@ -25,7 +25,7 @@ describe('The TabLink component', () => {
<TabLink count={22} isCurrentTab to="/any/path/">
Tab title
</TabLink>
</MemoryRouter>
</MemoryRouter>,
);

const tabLink = screen.getByRole('link');
Expand All @@ -38,7 +38,7 @@ describe('The TabLink component', () => {
<TabLink count={1235} isCurrentTab to="/any/path/">
Tab title
</TabLink>
</MemoryRouter>
</MemoryRouter>,
);

const tabLink = screen.getByRole('link');
Expand Down
4 changes: 2 additions & 2 deletions src/_shared/components/TabNavigation/TabNavigation.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('The TabNavigation component', () => {
to="/de-DE/scheduled/"
/>
</TabNavigation>
</MemoryRouter>
</MemoryRouter>,
);
const tabNavigation = screen.getByRole('tablist');
const tabs = within(tabNavigation).getAllByRole('tab');
Expand Down Expand Up @@ -49,7 +49,7 @@ describe('The TabNavigation component', () => {
/>
<Tab label="Scheduled" count={333} value={activeTab} to={activeTab} />
</TabNavigation>
</MemoryRouter>
</MemoryRouter>,
);

const tabNavigation = screen.getByRole('tablist');
Expand Down
2 changes: 1 addition & 1 deletion src/_shared/components/TabPanel/TabPanel.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe('The TabPanel component', () => {
render(
<TabPanel heading="Test tab" value="test-tab" index="test-tab">
<p>Tab contents</p>
</TabPanel>
</TabPanel>,
);

const tabPanel = screen.getByRole('tabpanel');
Expand Down
2 changes: 1 addition & 1 deletion src/_shared/components/TabSet/TabSet.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('The TabSet component', () => {
handleChange={jest.fn()}
tabs={tabs}
/>
</MemoryRouter>
</MemoryRouter>,
);

const tab = screen.getByRole('tab');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('The FormikSelectField component', () => {
<option value="2">Option 2</option>
<option value="3">Option 3</option>
<option value="4">Option 4</option>
</FormikSelectField>
</FormikSelectField>,
);

const field = screen.getByRole('combobox') as HTMLInputElement;
Expand All @@ -54,7 +54,7 @@ describe('The FormikSelectField component', () => {
<option value="2">Option 2</option>
<option value="3">Option 3</option>
<option value="4">Option 4</option>
</FormikSelectField>
</FormikSelectField>,
);

const field = screen.getByRole('combobox') as HTMLSelectElement;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('The FormikTextField component', () => {
label="Test Title"
fieldProps={fieldProps}
fieldMeta={fieldMeta}
/>
/>,
);

const field = screen.getByRole('textbox') as HTMLInputElement;
Expand All @@ -44,7 +44,7 @@ describe('The FormikTextField component', () => {
label="Test Title"
fieldProps={fieldProps}
fieldMeta={fieldMeta}
/>
/>,
);

const field = screen.getByRole('textbox') as HTMLInputElement;
Expand Down
Loading

0 comments on commit 066cf41

Please sign in to comment.