Migrate from ESLint to Oxlint and Oxfmt

This commit is contained in:
Alejandro Celaya
2026-07-26 09:12:18 +02:00
parent 2cf85a18b3
commit 54d4d9ebad
81 changed files with 2004 additions and 3790 deletions

View File

@@ -7,8 +7,8 @@ describe('<AppUpdateBanner />', () => {
const onClose = vi.fn();
const forceUpdate = vi.fn();
const setUp = async () => {
const result = await act(
() => renderWithEvents(<AppUpdateBanner isOpen onClose={onClose} forceUpdate={forceUpdate} />),
const result = await act(() =>
renderWithEvents(<AppUpdateBanner isOpen onClose={onClose} forceUpdate={forceUpdate} />),
);
await waitFor(() => screen.getByRole('alert'));

View File

@@ -7,18 +7,18 @@ import { checkAccessibility } from '../__helpers__/accessibility';
import { renderWithStore } from '../__helpers__/setUpTest';
describe('<Home />', () => {
const setUp = (servers: ServersMap = {}) => renderWithStore(
<MemoryRouter>
<Home />
</MemoryRouter>,
{
initialState: { servers },
},
);
const setUp = (servers: ServersMap = {}) =>
renderWithStore(
<MemoryRouter>
<Home />
</MemoryRouter>,
{
initialState: { servers },
},
);
it('passes a11y checks', () => checkAccessibility(
setUp({ '1a': fromPartial<ServerWithId>({ name: 'foo', id: '1' }) }),
));
it('passes a11y checks', () =>
checkAccessibility(setUp({ '1a': fromPartial<ServerWithId>({ name: 'foo', id: '1' }) })));
it('renders title', () => {
setUp();

View File

@@ -33,7 +33,8 @@ describe('<MainHeader />', () => {
])('sets link to settings as active only when current path is settings', (currentPath, isActive) => {
setUp(currentPath);
expect(screen.getByRole('menuitem', { name: /Settings$/ })).toHaveAttribute(
'data-active', isActive ? 'true' : 'false',
'data-active',
isActive ? 'true' : 'false',
);
});
});

View File

@@ -4,7 +4,12 @@ import { NotFound } from '../../src/common/NotFound';
import { checkAccessibility } from '../__helpers__/accessibility';
describe('<NotFound />', () => {
const setUp = (props = {}) => render(<MemoryRouter><NotFound {...props} /></MemoryRouter>);
const setUp = (props = {}) =>
render(
<MemoryRouter>
<NotFound {...props} />
</MemoryRouter>,
);
it('passes a11y checks', () => checkAccessibility(setUp()));
@@ -15,9 +20,11 @@ describe('<NotFound />', () => {
it('shows expected error message', () => {
setUp();
expect(screen.getByText(
'Use your browser\'s back button to navigate to the page you have previously come from, or just press this button.',
)).toBeInTheDocument();
expect(
screen.getByText(
"Use your browser's back button to navigate to the page you have previously come from, or just press this button.",
),
).toBeInTheDocument();
});
it.each([

View File

@@ -4,15 +4,16 @@ import { ScrollToTop } from '../../src/common/ScrollToTop';
import { checkAccessibility } from '../__helpers__/accessibility';
describe('<ScrollToTop />', () => {
const setUp = (children = 'Foo') => render(<MemoryRouter><ScrollToTop>{children}</ScrollToTop></MemoryRouter>);
const setUp = (children = 'Foo') =>
render(
<MemoryRouter>
<ScrollToTop>{children}</ScrollToTop>
</MemoryRouter>,
);
it('passes a11y checks', () => checkAccessibility(setUp()));
it.each([
['Foobar'],
['Barfoo'],
['Something'],
])('just renders children', (children) => {
it.each([['Foobar'], ['Barfoo'], ['Something']])('just renders children', (children) => {
setUp(children);
expect(screen.getByText(children)).toBeInTheDocument();
});

View File

@@ -8,9 +8,8 @@ import { checkAccessibility } from '../__helpers__/accessibility';
describe('<ShlinkVersions />', () => {
const setUp = (props: ShlinkVersionsProps) => render(<ShlinkVersions {...props} />);
it('passes a11y checks', () => checkAccessibility(
setUp({ selectedServer: fromPartial({ version: '1.0.0', printableVersion: '1.0.0' }) }),
));
it('passes a11y checks', () =>
checkAccessibility(setUp({ selectedServer: fromPartial({ version: '1.0.0', printableVersion: '1.0.0' }) })));
it.each([
['1.2.3', fromPartial<ReachableServer>({ version: '1.0.0', printableVersion: 'foo' }), 'v1.2.3', 'foo'],

View File

@@ -5,9 +5,10 @@ import { checkAccessibility } from '../__helpers__/accessibility';
import { renderWithStore } from '../__helpers__/setUpTest';
describe('<ShlinkVersionsContainer />', () => {
const setUp = (selectedServer: SelectedServer = null) => renderWithStore(<ShlinkVersionsContainer />, {
initialState: { selectedServer },
});
const setUp = (selectedServer: SelectedServer = null) =>
renderWithStore(<ShlinkVersionsContainer />, {
initialState: { selectedServer },
});
it.each([
[null],

View File

@@ -13,14 +13,15 @@ vi.mock('@shlinkio/shlink-web-component', () => ({
}));
describe('<ShlinkWebComponentContainer />', () => {
const setUp = (selectedServer: SelectedServer) => renderWithStore(
<MemoryRouter>
<ShlinkWebComponentContainer TagColorsStorage={fromPartial({})} />
</MemoryRouter>,
{
initialState: { selectedServer, servers: {}, settings: {} },
},
);
const setUp = (selectedServer: SelectedServer) =>
renderWithStore(
<MemoryRouter>
<ShlinkWebComponentContainer TagColorsStorage={fromPartial({})} />
</MemoryRouter>,
{
initialState: { selectedServer, servers: {}, settings: {} },
},
);
it('passes a11y checks', () => checkAccessibility(setUp(fromPartial({ version: '3.0.0' }))));