Closed Bug 1766533 Opened 2 years ago Closed 2 years ago

Enable ESLint rule no-constant-binary-expression

Categories

(Developer Infrastructure :: Lint and Formatting, task, P3)

Tracking

(firefox102 fixed)

RESOLVED FIXED
102 Branch
Tracking Status
firefox102 --- fixed

People

(Reporter: standard8, Assigned: standard8)

References

Details

Attachments

(4 files)

There's a new ESLint rule no-constant-binary-expression in 8.14.0, I think we should enable it as this finds some subtle mistakes across mozilla-central.

browser/components/newtab/test/unit/content-src/components/HelpText.test.jsx
  25:36  error  Unexpected comparison to newly constructed object. These two values can never be equal.  no-constant-binary-expression (eslint)

browser/extensions/webcompat/experiment-apis/trackingProtection.js
  25:26  error  Unexpected constant truthiness on the left-hand side of a `||` expression.  no-constant-binary-expression (eslint)

devtools/client/shared/components/HSplitBox.js
  129:21  error  Unexpected constant truthiness on the left-hand side of a `&&` expression.  no-constant-binary-expression (eslint)

toolkit/components/extensions/test/xpcshell/test_ext_userScripts_exports.js
  360:13  error  Unexpected constant truthiness on the left-hand side of a `&&` expression.  no-constant-binary-expression (eslint)

toolkit/components/places/Bookmarks.jsm
  1438:9   error  Unexpected constant truthiness on the left-hand side of a `||` expression.                        no-constant-binary-expression (eslint)
  1438:35  error  Unexpected constant binary expression. Compares constantly with the left-hand side of the `===`.  no-constant-binary-expression (eslint)

toolkit/content/aboutTelemetry.js
  1806:37  error  Unexpected comparison to newly constructed object. These two values can never be equal.  no-constant-binary-expression (eslint)
  1922:39  error  Unexpected comparison to newly constructed object. These two values can never be equal.  no-constant-binary-expression (eslint)
  1944:39  error  Unexpected comparison to newly constructed object. These two values can never be equal.  no-constant-binary-expression (eslint)

toolkit/content/tests/chrome/test_props.xhtml
  76:7  error  Unexpected constant binary expression. Compares constantly with the right-hand side of the `===`.  no-constant-binary-expression (eslint)

Depends on bug 1766268 as that's going to do the upgrade to v8.14.0.

Depends on: 1766268
Pushed by mbanner@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/99164bba7480
Fix extension code for ESLint rule no-constant-binary-expression. r=webcompat-reviewers,twisniewski,robwu
https://hg.mozilla.org/integration/autoland/rev/925b8d1ad45f
Fix devtools HSplitBox for ESLint rule no-constant-binary-expression. r=nchevobbe
https://hg.mozilla.org/integration/autoland/rev/b122952b2f5b
Enable ESLint rule no-constant-binary-expression. r=Gijs
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 102 Branch
Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/52549a2505d6
fix Thunderbird code for for ESLint rule no-constant-binary-expression. r=Standard8
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: