-
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?
Conversation
Added --fix to package.json and ran to auto-fix errors
Moved function definitions before function calls and changed some named exports to default
Alright so I think I correctly made another commit and pushed it onto my branch of the master, which appears to have made it show up here. I didn't change much beyond what we talked about. I changed a couple of named exports to default, but am not convinced I did it right. I get the idea of using default when there's only one export, but I'm not fully understanding how you'd import it if you're removing the name. There were also errors for global-require and no-param-reassign that threw me. The require function is exported, so unsure why that's resulting in the error. And for the no-param-reassign I couldn't gather where "registration" was being reassigned, but I think that's mostly because I've gotta re-familiarize with the arrow syntax for functions. |
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 the most part, looking good @gallickc. Like you mentioned, we should sync up about module export/import syntax - it can definitely be confusing. I made a few other suggestions throughout the PR too that you're welcome to make changes and push to this branch as you see fit.
{threadTitles} | ||
</ul> | ||
</div> | ||
} | ||
|
||
let url = "/community/" + props.groupId | ||
const url = `/community/${ props.groupId}` |
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:
const url = `/community/${ props.groupId}` | |
const url = `/community/${props.groupId}` |
Makes it a tad more readable that way.
{ | ||
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 comment
The reason will be displayed to describe this comment to others. Learn more.
Is this if (loading)
... code duplicated? If so, may be worth cleaning up while you're making changes here.
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.
FYI, this pattern will most likely change.
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 comment
The reason will be displayed to describe this comment to others. Learn more.
Same suggestion here in terms of readability of the string:
onClick={() => {props.history.push(`/community/${ data.thread.group.id}`)}}> | |
onClick={() => {props.history.push(`/community/${data.thread.group.id}`)}}> |
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.
We will we using an internal <Button />
component for this in the future
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 comment
The reason will be displayed to describe this comment to others. Learn more.
And here:
onClick={() => {props.history.push(`/thread/${ props.threadId}`)}}> | |
onClick={() => {props.history.push(`/thread/${props.threadId}`)}}> |
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.
We will we using an internal component for this in the future
@@ -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 comment
The 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 default
instead of named.
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.
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.
@@ -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 comment
The 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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. Error handling needs some love.
Added --fix to package.json and ran to auto-fix errors