-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#8 Linting Auto-Fixes #58
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import React from 'react'; | ||
import { withRouter } from "react-router" | ||
import { useQuery } from '@apollo/react-hooks'; | ||
import { Switch, Route } from "react-router-dom"; | ||
import { errorHandler } from '../services/graphql/errorHandler' | ||
import { FUSIONAUTH_CONFIG } from '../services/graphql/queries' | ||
import { Switch, Route } from "react-router-dom"; | ||
import { About } from './About'; | ||
import Account from './Account'; | ||
import { CodeOfConduct } from './CodeOfConduct'; | ||
|
@@ -20,20 +20,20 @@ import { Thread } from './Thread'; | |
|
||
export const Routes = withRouter((props) => { | ||
// Retrieve authorization config from the server so we can build auth URIs | ||
var { loading, error, data } = useQuery(FUSIONAUTH_CONFIG, | ||
const { loading, error, data } = useQuery(FUSIONAUTH_CONFIG, | ||
{ | ||
onError(error) { | ||
errorHandler(error, props.history) | ||
} | ||
}) | ||
if (loading) { | ||
return <p>Loading</p> | ||
} else if (error) { | ||
} if (error) { | ||
return <p>An unexpected error occurred, please come back later</p> | ||
} | ||
if (loading) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FYI, this pattern will most likely change. |
||
return <p>Loading</p> | ||
} else if (error) { | ||
} if (error) { | ||
return <p>An unexpected error occurred, please come back later</p> | ||
} | ||
const configuration = { | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -45,8 +45,8 @@ export const Thread = withRouter((props) => { | |||||
<h3 className="text-center"> | ||||||
<button | ||||||
type="button" | ||||||
className={"btn btn-link btn-lg"} | ||||||
onClick={() => {props.history.push('/community/' + data.thread.group.id)}}> | ||||||
className="btn btn-link btn-lg" | ||||||
onClick={() => {props.history.push(`/community/${ data.thread.group.id}`)}}> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same suggestion here in terms of readability of the string:
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We will we using an internal |
||||||
← back to '{data.thread.group.name}' | ||||||
</button> | ||||||
</h3> | ||||||
|
@@ -59,11 +59,11 @@ export const Thread = withRouter((props) => { | |||||
</div> | ||||||
</div> | ||||||
) | ||||||
} else { | ||||||
} | ||||||
return ( | ||||||
<div className="border-bottom border-gray m-3"> | ||||||
<p>Thread not found</p> | ||||||
</div> | ||||||
) | ||||||
} | ||||||
|
||||||
}) |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -3,7 +3,7 @@ import { withRouter } from "react-router" | |||||
import { Post } from './Post'; | ||||||
|
||||||
export const ThreadPreview = withRouter((props) => { | ||||||
let posts = <div className="ml-0"> | ||||||
const posts = <div className="ml-0"> | ||||||
{/* Limit post content for preview */} | ||||||
{props.posts.slice(0, 2).map((post) => | ||||||
<Post | ||||||
|
@@ -17,8 +17,8 @@ export const ThreadPreview = withRouter((props) => { | |||||
<h4>{props.title}</h4> | ||||||
<button | ||||||
type="button" | ||||||
className={"btn btn-outline-primary"} | ||||||
onClick={() => {props.history.push('/thread/' + props.threadId)}}> | ||||||
className="btn btn-outline-primary" | ||||||
onClick={() => {props.history.push(`/thread/${ props.threadId}`)}}> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And here:
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We will we using an internal component for this in the future |
||||||
join conversation | ||||||
</button> | ||||||
{posts} | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export const configuration = require ('./configuration.json'); | ||
export default require ('./configuration.json'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's sync up about module syntax and exports/imports and figure out how we want to do this one. There may be more to this than simply switching it to be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would like to talk module export/import syntax as well. I don't understand the tradeoffs of the different options and what is best practice. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
export const errorHandler = (error, history) => { | ||
export default (error, history) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's talk about this one too - way may need to update this (or consuming code). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would also like to discuss this. I think we should think about a different paradigm concerning error handling, I see a lot of duplication. A wrapper function / custom hook may be a good solution. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed. Error handling needs some love. |
||
if (error.graphQLErrors) { | ||
error.graphQLErrors.forEach(graphQLError => { | ||
console.log('graphQLError', graphQLError) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this one, I would update the spaces in the string to something like this:
Makes it a tad more readable that way.