Skip to content

Upgrade eslint 3 -> 4

Lukas 'ai-pi' Eipert requested to merge leipert-upgrade-eslint into master

What does this MR do?

Update eslint 3 to eslint 4.

Changed rules:

Type Rule TL;DR
prefer-promise-reject-errors Promises should be rejected with an error (e.g. Promise.reject(new Error(msg)) rather than Promise.reject(msg)
no-await-in-loop Don't use await in loop bodies, push to an array and use await Promise.all(arr)
no-return-assign No return foo = bar + 2 allowed anymore
for-direction For loops only allowed in positive direction (i++ and no i--)
getter-return Custom getters now need to return something
no-compare-neg-zero Do not compare to -0
semi-style Semi-colons are now enforced at the end of the line
no-buffer-constructor Node specific, but no new Buffer
switch-colon-spacing case 'x': console.log('Success'): Ensure that colon has no space before, but one space after case statements
template-tag-spacing Tagged template literals are not allowed to have spaces before them. As we do not make use of them, not that big of a deal
📝 no-unused-vars ignoreRestSiblings is now set, which means that const {var1, ...unusedRest} is fine now
📝 no-param-reassign Is now allowed for some objects, e.g. res.data = 'foo' is fine now
no-duplicate-imports import/no-duplicates is used instead

Caveats

The following rules have been disabled (for now?), as they require too many changes:

Are there points in the code the reviewer needs to double check?

  • The removal of the unused createComponentWithMixin: 9a9f758d

Does this MR meet the acceptance criteria?

  • [n/a] Changelog entry added, if necessary
  • [n/a] Documentation created/updated
  • [n/a] API support added
  • [n/a] Tests added for this feature/bug
  • Conform by the code review guidelines
    • [n/a] Has been reviewed by a UX Designer
    • Has been reviewed by a Frontend maintainer
    • [n/a] Has been reviewed by a Backend maintainer
    • [n/a] Has been reviewed by a Database specialist
  • Conform by the merge request performance guides
  • Conform by the style guides
  • If you have multiple commits, please combine them into a few logically organized commits by squashing them
  • Internationalization required/considered
  • End-to-end tests pass (package-and-qa manual pipeline job)

What are the relevant issue numbers?

Closes: https://gitlab.com/gitlab-org/gitlab-ce/issues/40476

Edited by Mike Greiling

Merge request reports