Hyper: Rewrite code to make xo happy without any rules

Created on 21 Sep 2016  路  14Comments  路  Source: vercel/hyper

The long-term goal is to comply with all of xo's standards, so that we can remove these rules. I already made the code comply to many rules, but these are left.

  • [ ] react/prop-types
  • [ ] react/jsx-no-bind
  • [ ] new-cap
  • [ ] complexity
  • [x] no-warning-comments (https://github.com/zeit/hyper/commit/630f0f4504532ed20c0a706ded08d7d225be5ec4)
  • [x] react/jsx-filename-extension
  • [x] react/no-danger (https://github.com/zeit/hyperterm/pull/756)
  • [x] react/no-string-refs (https://github.com/zeit/hyperterm/pull/766)
  • [x] react/jsx-key (https://github.com/zeit/hyperterm/pull/767)
  • [x] quote-props
  • [x] import/no-extraneous-dependencies
  • [x] no-nested-ternary
help wanted High Enhancement

Most helpful comment

We don't use xo in Hyper anymore... 馃槉

All 14 comments

I can work on this!

The changes for this issue are massive in some cases. I'm planning to send one PR for each rule fulfilled.

@davegomez Cool, thanks! 馃槝

react/prop-types: Since we don't have any prop types from before, wouldn't it be better to add flow? It can be added incrementally as well, and we don't have to use it for anything else than props.

react/no-danger: https://github.com/zeit/hyperterm/pull/723#discussion_r80324406 (the only place we use dangerouslySetInnerHTML it's the only way we can do it, and as the link mentions I think the name covers it more than enough by itself)

Context of why those rules should be enabled: https://github.com/zeit/hyperterm/pull/723#discussion_r79976176

react/no-danger: #723 (comment) (the only place we use dangerouslySetInnerHTML it's the only way we can do it, and as the link mentions I think the name covers it more than enough by itself)

Then I would recommend just disabling it inline where it's used with a ESLint directive:

// eslint-disable-line react/no-danger

So are we gonna add the Proptypes or don't?

And I agree with @sindresorhus that we should use the inline comment to disable the react/no-danger rule.

@leo @sindresorhus How do we want to handle quote-props?

It seems like the only place we are using them is for CSS pseudo-classes (e.g., :hover), and it seems rather silly to have to quote all the properties off of that 馃槄

Should we disable with inline comments? I don't suppose we could switch the xo rule to as-needed?

I don't suppose we could switch the xo rule to as-needed?

@maxdeviant Done: https://github.com/sindresorhus/eslint-config-xo/commit/abe5ed61425b143f2ee70e0734f0c26ff7f77a55 I've been meaning to change it. It sounded good initially, but became annoying after awhile. Will be part of the next XO release being released soon (in a few days to a week).

@sindresorhus Okay, sounds good :)

I'll double check, but once we update XO then we should able able to re-enable the rule and cross quote-props off the list :tada:

@leo As per @sindresorhus' comment, no-nested-ternary no longer applies, so we can remove from this list once we update our version of XO.

@maxdeviant Got it! But it looks like he hasn't released it yet...

@leo My bad, forgot to mention that part :sweat_smile:

We don't use xo in Hyper anymore... 馃槉

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ConstantinChirila picture ConstantinChirila  路  3Comments

juicygoose picture juicygoose  路  3Comments

rauchg picture rauchg  路  3Comments

laur1s picture laur1s  路  3Comments

dbkaplun picture dbkaplun  路  3Comments