better linting (#72)

Improve linting and fix linting errors

Signed-off-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>
This commit is contained in:
Philip Molares 2020-05-27 15:43:28 +02:00 committed by GitHub
parent efb6513205
commit eba59ae622
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
70 changed files with 2413 additions and 1867 deletions

View file

@ -1,51 +1,35 @@
import {Trans, useTranslation} from "react-i18next";
import {TranslatedLink} from "./translated-link";
import React, {Fragment} from "react";
import {ExternalLink} from "./external-link";
import {useSelector} from "react-redux";
import {ApplicationState} from "../../../../redux";
import { Trans, useTranslation } from 'react-i18next'
import { TranslatedLink } from './translated-link'
import React, { Fragment } from 'react'
import { ExternalLink } from './external-link'
import { useSelector } from 'react-redux'
import { ApplicationState } from '../../../../redux'
const PoweredByLinks: React.FC = () => {
useTranslation();
const defaultLinks = [
{
href: '/s/release-notes',
i18nKey: 'releases'
},
{
href: 'https://github.com/codimd/server/tree/41b13e71b6b1d499238c04b15d65e3bd76442f1d',
i18nKey: 'sourceCode'
}
]
export const PoweredByLinks: React.FC = () => {
useTranslation()
const config = useSelector((state: ApplicationState) => state.backendConfig);
const defaultLinks =
{
releases: '/s/release-notes',
sourceCode: 'https://github.com/codimd/server/tree/41b13e71b6b1d499238c04b15d65e3bd76442f1d'
}
const specialLinks = Object.entries(config.specialLinks)
.filter(([_, value]) => value !== "")
.map(([key, value]) => {
return {
href: value,
i18nKey: key
}
})
const config = useSelector((state: ApplicationState) => state.backendConfig)
return (
<p>
<Trans i18nKey="poweredBy" components={[<ExternalLink href="https://codimd.org" text="CodiMD"/>]}/>
{
(defaultLinks.concat(specialLinks)).map(({href, i18nKey}) =>
<Fragment key={i18nKey}>
&nbsp;|&nbsp;
<TranslatedLink
href={href}
i18nKey={i18nKey}
/>
</Fragment>
)
}
</p>
)
return (
<p>
<Trans i18nKey="poweredBy" components={[<ExternalLink href="https://codimd.org" text="CodiMD"/>]}/>
{
Object.entries({ ...defaultLinks, ...(config.specialLinks) }).map(([i18nKey, href]) =>
<Fragment key={i18nKey}>
&nbsp;|&nbsp;
<TranslatedLink
href={href}
i18nKey={i18nKey}
/>
</Fragment>
)
}
</p>
)
}
export { PoweredByLinks }