Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

#8 Linting Auto-Fixes #58

wants to merge 2 commits into from

Conversation

gallickc
Copy link
Contributor

@gallickc gallickc commented Feb 4, 2020

Added --fix to package.json and ran to auto-fix errors

Added --fix to package.json and ran to auto-fix errors
@gallickc gallickc requested a review from noahjb February 4, 2020 02:13
Moved function definitions before function calls and changed some named exports to default
@gallickc
Copy link
Contributor Author

gallickc commented Feb 4, 2020

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.

Copy link
Contributor

@noahjb noahjb left a 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}`
Copy link
Contributor

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:

Suggested change
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) {
Copy link
Contributor

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.

Copy link
Contributor

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}`)}}>
Copy link
Contributor

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:

Suggested change
onClick={() => {props.history.push(`/community/${ data.thread.group.id}`)}}>
onClick={() => {props.history.push(`/community/${data.thread.group.id}`)}}>

Copy link
Contributor

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}`)}}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here:

Suggested change
onClick={() => {props.history.push(`/thread/${ props.threadId}`)}}>
onClick={() => {props.history.push(`/thread/${props.threadId}`)}}>

Copy link
Contributor

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');
Copy link
Contributor

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.

Copy link
Collaborator

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) => {
Copy link
Contributor

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).

Copy link
Contributor

@zacksabbath zacksabbath Feb 15, 2020

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.

Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants