ni / javascript-styleguide

JavaScript and TypeScript Style Guide
MIT License
9 stars 9 forks source link

Enable new rules from ESLint 8 #117

Closed jattasNI closed 1 year ago

jattasNI commented 1 year ago

Justification

Fixes #112

Implementation

Adopted decisions from discussion in the issue linked above.

Testing

Tried out the new rulesets in:

  1. Nimble: https://github.com/ni/nimble/pull/925
  2. SystemLinkShared: https://ni.visualstudio.com/DevCentral/_git/Skyline/pullrequest/408516

There were several new failures because of function-call-argument-newline and function-paren-newline. They were autofixable though a few of the autofixes resulted in very long lines. I manually split those lines and the rule remained happy (it didn't try to fix them back to the long line).

There were a handful of no-promise-executor-return failures because of this pattern: new Promise(resolve => setTimeout(0));. This is because setTimeout() returns a value so this was actually attempting to return that value from the resolve callback. Easily fixable by adding a set of braces to stop the implicit return: new Promise(resolve => { setTimeout(0); });.