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

Update ESLint shared config to v3 #9274

Merged
merged 6 commits into from
Aug 19, 2020

Conversation

whymarrh
Copy link
Contributor

@whymarrh whymarrh commented Aug 19, 2020

Closes #8982

This PR updates the ESLint config to the latest version, v3.

There are two commits with fixes, one that's automated and one that was manual. Only the first and last commit require review.

I disabled the following:

  • default-param-last was too annoying to fix
  • require-atomic-updates was also too annoying to fix
  • import/no-unassigned-import all the instances of this in the codebase are legitimate—I don't think we should enable it if every time it flags something we need to disable it

I'm open to enabling those in separate PRs in the future, should someone feel inclined.

@whymarrh whymarrh force-pushed the eslint-shared-config-v3 branch from 40f3a5f to 9e54a7c Compare August 19, 2020 14:45
@whymarrh whymarrh marked this pull request as ready for review August 19, 2020 14:53
@whymarrh whymarrh requested review from kumavis and a team as code owners August 19, 2020 14:53
@whymarrh whymarrh requested a review from Gudahtt August 19, 2020 14:53
@@ -1,4 +1,9 @@
import ObservableStore from 'obs-store'

/* eslint-disable import/first,import/order */
Copy link
Member

Choose a reason for hiding this comment

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

Are these rules disabled here because they conflicted with each other?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They're disabled here because they both apply to the following code

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  • import/first wants the require and imports to move
  • import/order wants the require call alone to move

They're both disabled here and re-enabled as soon as ESLint will allow.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The e2e tests break if I move the require call so I don't want to move it

],
)

return t('connectTo', [
Copy link
Member

Choose a reason for hiding this comment

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

What motivated this change 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whoops, habit—I'd meant to only remove the extra newline but got carried away

Comment on lines +29 to +31
const _fetch = timeout
? fetchWithTimeout({ timeout })
: window.fetch
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These changes are extraneous, not suggested by ESLint


export default {
version,

migrate: function (originalVersionedData) {
migrate (originalVersionedData) {
Copy link
Member

Choose a reason for hiding this comment

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

What syntax is this O_O

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Method definitions:

Starting with ECMAScript 2015, a shorter syntax for method definitions on objects initializers is introduced. It is a shorthand for a function assigned to the method's name.

@@ -41,8 +41,7 @@ function defineAllTasks () {
manifestTasks.dev,
reload,
),
),
Copy link
Member

Choose a reason for hiding this comment

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

This change is unexpected. I prefer the older format, and I'm not sure what could have caused this 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The first arg to the function is mis-aligned, causing the auto-fix to do this. I'll fix this with db7f5f2.

Copy link
Member

Choose a reason for hiding this comment

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

The same problem is present in many other places, but I'm not gonna block on it. Hopefully prettier will fix it.

status: 'unapproved',
txParams: {},
}, partialMeta)
txParams: {}, ...partialMeta,
Copy link
Member

Choose a reason for hiding this comment

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

It's weird to see multi-line object literals with things doubled up on the same line like this 🤔 I would have expected this to be disallowed.

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'm not sure why this is allowed. I've fixed it with 4ae9694.

Copy link
Member

Choose a reason for hiding this comment

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

The same problem is present in many other places, but I'm not gonna block on it. Hopefully prettier will fix it.

Co-authored-by: Mark Stacey <[email protected]>
Copy link
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

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

LGTM!

@whymarrh whymarrh merged commit b6ccd22 into MetaMask:develop Aug 19, 2020
@whymarrh whymarrh deleted the eslint-shared-config-v3 branch August 19, 2020 16:27
Gudahtt added a commit that referenced this pull request Aug 19, 2020
* origin/develop: (137 commits)
  Use @metamask/[email protected] (#9275)
  Standardize scss import practices (#9183)
  Update ESLint shared config to v3 (#9274)
  Add lock icon to default networks (#9269)
  Adds toPrecisionWithoutTrailingZeros utility (#9270)
  Hide gas estimate on non-main network (#9189)
  Move the mascot component to its own directory (#9272)
  Use @metamask/[email protected] (#9266)
  Fix padding, alignment of actionable-message; add left aligned story
  Code cleanup and simplification for actionable-message component
  Adds actionable message component and stories
  Fix lint issues (#9265)
  Fix prefer-destructuring issues (#9263)
  colocate confirm-decrypt-message page styles (#9252)
  Tidy up Migrator tests (#9264)
  Adds pulse loader component (#9259)
  Fix import/order issues (#9239)
  Fix radix issues (#9247)
  New info tooltip component (#9180)
  Improve scss naming
  ...
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.

Update MetaMask ESLint config to v2
2 participants