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

Add eslint #97

Closed
wants to merge 3 commits into from
Closed

Add eslint #97

wants to merge 3 commits into from

Conversation

Flaque
Copy link
Contributor

@Flaque Flaque commented Jul 14, 2017

Config from @williaster's brilliant dataui.

@Flaque Flaque requested review from hshoff and williaster July 14, 2017 03:37
@Flaque
Copy link
Contributor Author

Flaque commented Jul 14, 2017

I can split this into two or just take the eslint if the --fix is too much for one review. We also could use something like eslint-nibble to do this one at a time. Although this feels more like ripping off a bandaid.

Copy link
Collaborator

@williaster williaster left a comment

Choose a reason for hiding this comment

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

This looks solid overall to me, thanks for doing the big hairy pass! 🏆

I flagged a few that looked suspicious to me that I think might throw errors due to var vs const/let. There are also some types of errors that didn't pop up that I'm surprised about (eg not using loop indices as react keys) but we can debug that later.

It'd be good do build all the packages after these changes and test the local demo page to unsure no egregious errors.

**/build/*
**/node_modules/*
**/coverage/*
**/_gh-pages/*
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think this line is necessary since there is no gh-pages branch for this repo.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point!

@@ -1,7 +1,7 @@
export default function center(scale) {
var offset = scale.bandwidth() / 2;
let offset = scale.bandwidth() / 2;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this actually still needs to be var because of the closure, did you test the gallery locally to see if there were no errors?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did not. :'( I might have had too much trust in the --fix.

That was a dumb mistake. From now on I will always test the gallery locally!

As for the var. Don't lets work in "child" scopes, but not in above scopes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -104,7 +104,7 @@ export default class Gallery extends React.Component {
<div className="details">
<div className="title">Lines</div>
<div className="description">
<pre>{`<Shape.Line />`}</pre>
<pre>{'<Shape.Line />'}</pre>
Copy link
Collaborator

Choose a reason for hiding this comment

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

not sure if the backticks were intentional for styling?

@@ -15,7 +15,7 @@ export function createCircles({
stroke,
strokeWidth,
strokeDasharray,
className
className,
}) {
return corners.map(([cornerX, cornerY]) =>
Copy link
Collaborator

Choose a reason for hiding this comment

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

surprised this one didn't complain about no ( + )

@@ -28,7 +28,7 @@ export default function withParentSize(BaseComponent) {

resize(event) {
if (this.container) {
var boundingRect = this.container.getBoundingClientRect();
const boundingRect = this.container.getBoundingClientRect();
Copy link
Collaborator

Choose a reason for hiding this comment

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

this might be another instance where you need a var so it can be used in the closure

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think you can still use const here since the closure is contained within the same closure that var is defined in.

In general, I think let and const work the same way most variable assignments work in other languages, but var is the nasty one :'(

There's a good SE question about it here.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think you're right about the scope, played with it for a while on babel + locally. I remembered having an issue with something similar in a different repo but I think the root cause was something else. thanks for the SE link 👍

@hshoff
Copy link
Member

hshoff commented Jul 14, 2017

Awesome thanks @Flaque, I'm going to be away from the computer this weekend, but I will take a closer look and give it a proper review on Monday. No need to split it up.

@Flaque
Copy link
Contributor Author

Flaque commented Jul 15, 2017

I went back and made sure everything still ran in the gallery. No problems as far as I can tell.

@williaster
Copy link
Collaborator

Awesome, thanks for functionally testing the UI! 👏

@Flaque
Copy link
Contributor Author

Flaque commented Jul 18, 2017

I'll go through and resolve the conflicts tonight.

@hshoff
Copy link
Member

hshoff commented Jul 18, 2017

So this got me thinking more than I expected.

The gist is, linting is great for large codebases with a large number of engineers contributing all the time. At this time, vx finds itself mostly driven 4 contributors at the moment so I think we can get by without adding a big new step like this for now. Linting has a time and place and i'm not sure if vx is ready for it at this stage of development.

I've been using prettier to format on save for the past few weeks and it's been lovely. But that's mostly because i've lived and breathed the airbnb eslint config for the past 4 years and most of the lint fixes we're seeing are my personal preferences vs the airbnb config.

For now I think we're fine without it. I don't want to slow down/trip up new contributors just yet. Before the v1 release we can run prettier on the whole codebase and add in the lint config + build step then and we can tend the garden from v1 on.

Would love to hear your thoughts on this. I've been thinking about it a lot since the weekend.

@Flaque
Copy link
Contributor Author

Flaque commented Jul 18, 2017

I love this plan. Prettier is wonderful <3

If we're all good, I'll close this PR.

@hshoff
Copy link
Member

hshoff commented Jul 18, 2017

Yeah let's close this for now and we'll bring the discussion back to life closer to v1

@Flaque Flaque closed this Jul 18, 2017
@Flaque
Copy link
Contributor Author

Flaque commented Jul 18, 2017

Sounds good!

@williaster
Copy link
Collaborator

this sounds like a good plan to me 👍

@williaster williaster mentioned this pull request Aug 16, 2017
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.

None yet

3 participants