Browse Source

Fix linting errors

merge-requests/3/head
Yannik Rödel 8 months ago
parent
commit
76eda7f8cb
6 changed files with 53 additions and 41 deletions
  1. +3
    -1
      .eslintrc.js
  2. +13
    -12
      src/components/eventList.tsx
  3. +17
    -14
      src/components/upcomingEvent.tsx
  4. +2
    -1
      src/pages/404.tsx
  5. +4
    -2
      src/pages/informationen.tsx
  6. +14
    -11
      src/templates/eventTemplate.tsx

+ 3
- 1
.eslintrc.js View File

@@ -23,11 +23,13 @@ module.exports = {
'no-console': process.env.NODE_ENV === `production` ? `error` : `off`,
'no-debugger': process.env.NODE_ENV === `production` ? `error` : `off`,
'import/no-extraneous-dependencies': `off`,
'react/forbid-prop-types': `off`,
'react/jsx-one-expression-per-line': `off`,
'react/jsx-filename-extension': [`error`, { extensions: [`.jsx`, `.tsx`] }],
'react/jsx-wrap-multilines': `off`,
'react/forbid-prop-types': `off`,
'react/prop-types': `off`,
'@typescript-eslint/indent': `off`,
'@typescript-eslint/no-parameter-properties': `off`,
},
parser: `@typescript-eslint/parser`,
};

+ 13
- 12
src/components/eventList.tsx View File

@@ -96,18 +96,19 @@ export interface EventListProps {
const EventList = ({ children, events, selectedDate }: EventListProps): JSX.Element => (
<Wrap>
<List>
{events.map(event =>
createElement(
event.date === selectedDate ? SelectedListItem : ListItem,
{},
<ListLink to={`/${event.date}`}>
<EventTitle>{event.title}</EventTitle>
<EventMeta>
{event.dateFormatted}
{event.participants > 0 && `, ${event.participants} Teilnehmer`}
</EventMeta>
</ListLink>
)
{events.map(
(event): JSX.Element =>
createElement(
event.date === selectedDate ? SelectedListItem : ListItem,
{},
<ListLink to={`/${event.date}`}>
<EventTitle>{event.title}</EventTitle>
<EventMeta>
{event.dateFormatted}
{event.participants > 0 && `, ${event.participants} Teilnehmer`}
</EventMeta>
</ListLink>
)
)}
</List>
<Content>{children}</Content>

+ 17
- 14
src/components/upcomingEvent.tsx View File

@@ -101,28 +101,27 @@ interface MapProps {
subtitle: string;
}
class Map extends React.Component {
private element: React.RefObject<HTMLDivElement>;

constructor(public props: MapProps) {
public constructor(public props: MapProps) {
super(props);
this.element = React.createRef();
}

componentDidMount() {
public componentDidMount(): void {
if (this.element.current === null) return;

const leaflet = require('leaflet');
this.element.current.style.display = 'block';
const { latlon, zoom, title, subtitle } = this.props;

const leaflet = require(`leaflet`); // eslint-disable-line
this.element.current.style.display = `block`;

const map = leaflet.map(this.element.current).setView(this.props.latlon, this.props.zoom);
const map = leaflet.map(this.element.current).setView(latlon, zoom);
leaflet
.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution:
'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
.tileLayer(`https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png`, {
attribution: `&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors`,
})
.addTo(map);
leaflet
.marker(this.props.latlon)
.marker(latlon)
.setIcon(
leaflet.icon({
iconUrl: markerIcon,
@@ -130,10 +129,12 @@ class Map extends React.Component {
})
)
.addTo(map)
.bindPopup(`<strong>${this.props.title}</strong><br>${this.props.subtitle}`);
.bindPopup(`<strong>${title}</strong><br>${subtitle}`);
}

render() {
private element: React.RefObject<HTMLDivElement>;

public render(): JSX.Element {
return <MapWrap ref={this.element} />;
}
}
@@ -174,7 +175,9 @@ const UpcomingEvent = ({ event }: UpcomingEventProps): JSX.Element => (
subtitle={event.location}
/>
</Wrap>
{event.teaser && <div dangerouslySetInnerHTML={{ __html: event.teaser }} />}
{event.teaser && (
<div dangerouslySetInnerHTML={{ __html: event.teaser }} /> // eslint-disable-line react/no-danger
)}
</>
);
export default UpcomingEvent;

+ 2
- 1
src/pages/404.tsx View File

@@ -22,7 +22,8 @@ const NotFoundPage = ({ data }: NotFoundPageProps): JSX.Element => (
<h1>Diese Seite kennen wir nicht :(</h1>

<p>
Wir suchen zwar fleißig, aber bisher konnten wir sie nicht finden. Sollte das nicht so sein{` `}
Wir suchen zwar fleißig, aber bisher konnten wir sie nicht finden. Sollte das nicht so sein
{` `}
<a href="mailto:kontakt@coderdojo-wue.de">schreib uns</a> oder{` `}
<a href="https://gitlab.janik.xyz/coderdojo-wue/website">erstelle sie selbst</a>!
</p>

+ 4
- 2
src/pages/informationen.tsx View File

@@ -233,10 +233,12 @@ const InformationenPage = ({ data }: InformationenPageProps): JSX.Element => (
Dir bei allen Fragen, die Du hast.
</p>
<p>
Seit dem ersten sehr erfolgreichen CoderDojo in Würzburg, das am 25.03.2017 stattfand (siehe{` `}
Seit dem ersten sehr erfolgreichen CoderDojo in Würzburg, das am 25.03.2017 stattfand (siehe
{` `}
<a href="https://www.mainpost.de/regional/wuerzburg/FH-Workshop-Programmieren-fuer-junge-Menschen;art735,9556077">
hier
</a>{` `}
</a>
{` `}
und{` `}
<a href="https://fiw.fhws.de/aktuelles/details/news/coderdojo-fhws-masterstudierende-trainieren-die-zuckerbergs-von-morgen-651.html">
hier

+ 14
- 11
src/templates/eventTemplate.tsx View File

@@ -117,16 +117,18 @@ const EventPage = ({
</p>

<EventList
events={allEvents.edges.map(eventEdge => ({
...eventEdge.node.frontmatter,
participants: (
allRecaps.edges
.map(recapEdge => recapEdge.node.frontmatter)
.find(recapData => recapData.date === eventEdge.node.frontmatter.date) || {
participants: -1,
}
).participants,
}))}
events={allEvents.edges.map(
(eventEdge): EventBase & EventRecap => ({
...eventEdge.node.frontmatter,
participants: (
allRecaps.edges
.map((recapEdge): EventRecap => recapEdge.node.frontmatter)
.find((recapData): boolean => recapData.date === eventEdge.node.frontmatter.date) || {
participants: -1,
}
).participants,
})
)}
selectedDate={event.frontmatter.date}
>
{recap && recap.frontmatter.coverPhoto ? (
@@ -144,7 +146,8 @@ const EventPage = ({
<Content>
<Title>{event.frontmatter.title}</Title>
<p>
{event.frontmatter.dateFormatted}, {event.frontmatter.start} bis {event.frontmatter.end}{` `}
{event.frontmatter.dateFormatted}, {event.frontmatter.start} bis {event.frontmatter.end}
{` `}
Uhr
<VenueLink href={event.frontmatter.venueLink || undefined}>
{event.frontmatter.location}

Loading…
Cancel
Save