mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-10-21 13:14:10 +00:00
Migrate from ESLint to Oxlint and Oxfmt
This commit is contained in:
@@ -10,9 +10,12 @@ export type DuplicatedServersModalProps = {
|
||||
onConfirm: () => void;
|
||||
};
|
||||
|
||||
export const DuplicatedServersModal: FC<DuplicatedServersModalProps> = (
|
||||
{ open, duplicatedServers, onClose, onConfirm },
|
||||
) => {
|
||||
export const DuplicatedServersModal: FC<DuplicatedServersModalProps> = ({
|
||||
open,
|
||||
duplicatedServers,
|
||||
onClose,
|
||||
onConfirm,
|
||||
}) => {
|
||||
const hasMultipleServers = duplicatedServers.length > 1;
|
||||
|
||||
return (
|
||||
@@ -27,16 +30,24 @@ export const DuplicatedServersModal: FC<DuplicatedServersModalProps> = (
|
||||
>
|
||||
<p>{hasMultipleServers ? 'The next servers already exist:' : 'There is already a server with:'}</p>
|
||||
<ul className="list-disc my-4 pl-5">
|
||||
{duplicatedServers.map(({ url, apiKey }, index) => (!hasMultipleServers ? (
|
||||
<Fragment key={index}>
|
||||
<li>URL: <b>{url}</b></li>
|
||||
<li>API key: <b>{apiKey}</b></li>
|
||||
</Fragment>
|
||||
) : <li key={index}><b>{url}</b> - <b>{apiKey}</b></li>))}
|
||||
{duplicatedServers.map(({ url, apiKey }, index) =>
|
||||
!hasMultipleServers ? (
|
||||
<Fragment key={index}>
|
||||
<li>
|
||||
URL: <b>{url}</b>
|
||||
</li>
|
||||
<li>
|
||||
API key: <b>{apiKey}</b>
|
||||
</li>
|
||||
</Fragment>
|
||||
) : (
|
||||
<li key={index}>
|
||||
<b>{url}</b> - <b>{apiKey}</b>
|
||||
</li>
|
||||
),
|
||||
)}
|
||||
</ul>
|
||||
<span>
|
||||
{hasMultipleServers ? 'Do you want to save duplicated servers' : 'Do you want to save this server'}?
|
||||
</span>
|
||||
<span>{hasMultipleServers ? 'Do you want to save duplicated servers' : 'Do you want to save this server'}?</span>
|
||||
</CardModal>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -17,7 +17,7 @@ export type ImportServersBtnProps = PropsWithChildren<{
|
||||
className?: string;
|
||||
|
||||
// Injected
|
||||
ServersImporter: ServersImporter
|
||||
ServersImporter: ServersImporter;
|
||||
}>;
|
||||
|
||||
const ImportServersBtnBase: FC<ImportServersBtnProps> = ({
|
||||
@@ -37,7 +37,8 @@ const ImportServersBtnBase: FC<ImportServersBtnProps> = ({
|
||||
|
||||
const onFile = useCallback(
|
||||
async ({ target }: ChangeEvent<HTMLInputElement>) =>
|
||||
serversImporter.importServersFromFile(target.files?.[0])
|
||||
serversImporter
|
||||
.importServersFromFile(target.files?.[0])
|
||||
.then((importedServers) => {
|
||||
const { duplicatedServers, newServers } = dedupServers(servers, importedServers);
|
||||
|
||||
|
||||
@@ -26,8 +26,8 @@ export const ServerError: FC = () => {
|
||||
</Message>
|
||||
|
||||
<p className="text-xl">
|
||||
These are the Shlink servers currently configured. Choose one of
|
||||
them or <Link to="/server/create">add a new one</Link>.
|
||||
These are the Shlink servers currently configured. Choose one of them or{' '}
|
||||
<Link to="/server/create">add a new one</Link>.
|
||||
</p>
|
||||
<Card className="w-full max-w-100 overflow-hidden">
|
||||
<ServersListGroup borderless servers={Object.values(servers)} />
|
||||
@@ -35,9 +35,8 @@ export const ServerError: FC = () => {
|
||||
|
||||
{isServerWithId(selectedServer) && (
|
||||
<p className="text-xl">
|
||||
Alternatively, if you think you may have misconfigured this server, you
|
||||
can <DeleteServerButton server={selectedServer}>remove
|
||||
it</DeleteServerButton> or
|
||||
Alternatively, if you think you may have misconfigured this server, you can{' '}
|
||||
<DeleteServerButton server={selectedServer}>remove it</DeleteServerButton> or
|
||||
<Link to={`/server/${selectedServer.id}/edit?reconnect=true`}>edit it</Link>.
|
||||
</p>
|
||||
)}
|
||||
|
||||
@@ -45,13 +45,13 @@ export const ServerForm: FC<ServerFormProps> = ({ onSubmit, initialValues, child
|
||||
Forward credentials to this server on every request.
|
||||
</Label>
|
||||
<small className="pl-5.5 text-gray-600 dark:text-gray-400 mt-0.5">
|
||||
{'"'}Credentials{'"'} here means cookies, TLS client certificates, or authentication headers containing a username
|
||||
and password.
|
||||
{'"'}Credentials{'"'} here means cookies, TLS client certificates, or authentication headers containing a
|
||||
username and password.
|
||||
</small>
|
||||
<small className="pl-5.5 text-gray-600 dark:text-gray-400">
|
||||
<b>Important!</b> If you are not sure what this means, leave it unchecked. Enabling this option will
|
||||
make all requests fail for Shlink older than v4.5.0, as it requires the server to set a more strict
|
||||
value for <code className="whitespace-nowrap">Access-Control-Allow-Origin</code> than <code>*</code>.
|
||||
<b>Important!</b> If you are not sure what this means, leave it unchecked. Enabling this option will make
|
||||
all requests fail for Shlink older than v4.5.0, as it requires the server to set a more strict value for{' '}
|
||||
<code className="whitespace-nowrap">Access-Control-Allow-Origin</code> than <code>*</code>.
|
||||
</small>
|
||||
</div>
|
||||
</Details>
|
||||
|
||||
@@ -49,9 +49,9 @@ export type DedupServersResult = {
|
||||
*/
|
||||
export function dedupServers(servers: ServersMap, serversToAdd: ServerData[]): DedupServersResult {
|
||||
const serversList = Object.values(servers);
|
||||
const { duplicatedServers = [], newServers = [] } = groupBy(
|
||||
serversToAdd,
|
||||
(server) => serversInclude(serversList, server) ? 'duplicatedServers' : 'newServers',
|
||||
// oxlint-disable-next-line typescript/no-useless-default-assignment - Type definition is wrong
|
||||
const { duplicatedServers = [], newServers = [] } = groupBy(serversToAdd, (server) =>
|
||||
serversInclude(serversList, server) ? 'duplicatedServers' : 'newServers',
|
||||
);
|
||||
|
||||
return { duplicatedServers, newServers };
|
||||
|
||||
Reference in New Issue
Block a user