Get rid of lint warnings

This commit is contained in:
Tanner Collin 2019-10-22 07:31:59 +00:00
parent 9e55f6e4ec
commit 4cf97304e4
6 changed files with 9 additions and 10 deletions

View File

@ -1,5 +1,4 @@
import React from 'react'; import React from 'react';
import { Link } from 'react-router-dom';
import { Helmet } from 'react-helmet'; import { Helmet } from 'react-helmet';
import localForage from 'localforage'; import localForage from 'localforage';
import { sourceLink, infoLine, ToggleDot } from './utils.js'; import { sourceLink, infoLine, ToggleDot } from './utils.js';
@ -8,7 +7,7 @@ class Article extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
const id = this.props.match.params.id; const id = this.props.match ? this.props.match.params.id : 'CLOL';
const cache = this.props.cache; const cache = this.props.cache;
if (id in cache) console.log('cache hit'); if (id in cache) console.log('cache hit');
@ -20,7 +19,7 @@ class Article extends React.Component {
} }
componentDidMount() { componentDidMount() {
const id = this.props.match.params.id; const id = this.props.match ? this.props.match.params.id : 'CLOL';
localForage.getItem(id) localForage.getItem(id)
.then( .then(
@ -43,7 +42,7 @@ class Article extends React.Component {
} }
render() { render() {
const id = this.props.match.params.id; const id = this.props.match ? this.props.match.params.id : 'CLOL';
const story = this.state.story; const story = this.state.story;
const error = this.state.error; const error = this.state.error;

View File

@ -4,7 +4,7 @@ import { HashLink } from 'react-router-hash-link';
import { Helmet } from 'react-helmet'; import { Helmet } from 'react-helmet';
import moment from 'moment'; import moment from 'moment';
import localForage from 'localforage'; import localForage from 'localforage';
import { sourceLink, infoLine, ToggleDot } from './utils.js'; import { infoLine, ToggleDot } from './utils.js';
class Article extends React.Component { class Article extends React.Component {
constructor(props) { constructor(props) {
@ -51,7 +51,7 @@ class Article extends React.Component {
displayComment(story, c, level) { displayComment(story, c, level) {
return ( return (
<div className={level ? 'comment lined' : 'comment'}> <div className={level ? 'comment lined' : 'comment'} key={c.author+c.date}>
<div className='info'> <div className='info'>
<p> <p>
{c.author === story.author ? '[OP]' : ''} {c.author || '[Deleted]'} {c.author === story.author ? '[OP]' : ''} {c.author || '[Deleted]'}

View File

@ -71,7 +71,7 @@ class Feed extends React.Component {
<div className='title'> <div className='title'>
<Link className='link' to={'/' + x.id}> <Link className='link' to={'/' + x.id}>
<img className='source-logo' src={'logos/'+x.source+'.png'} /> {x.title} <img className='source-logo' src={'logos/'+x.source+'.png'} alt='source logo' /> {x.title}
</Link> </Link>
<span className='source'> <span className='source'>

View File

@ -59,7 +59,7 @@ class Results extends React.Component {
<div className='title'> <div className='title'>
<Link className='link' to={'/' + x.id}> <Link className='link' to={'/' + x.id}>
<img className='source-logo' src={'logos/'+x.source+'.png'} /> {x.title} <img className='source-logo' src={'logos/'+x.source+'.png'} alt='source logo' /> {x.title}
</Link> </Link>
<span className='source'> <span className='source'>

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { BrowserRouter as Router, Route, Link, withRouter } from 'react-router-dom'; import { withRouter } from 'react-router-dom';
class ScrollToTop extends React.Component { class ScrollToTop extends React.Component {
componentDidUpdate(prevProps) { componentDidUpdate(prevProps) {

View File

@ -31,7 +31,7 @@ export class ToggleDot extends React.Component {
<div className='toggleDot'> <div className='toggleDot'>
<div className='button'> <div className='button'>
<Link to={'/' + id + (article ? '' : '/c')}> <Link to={'/' + id + (article ? '' : '/c')}>
<img src={Switch} /> <img src={Switch} alt='toggle between article and comments' />
</Link> </Link>
</div> </div>
</div> </div>