Skip to content

Commit

Permalink
Merge pull request mozilla#16415 from Snuffleupagus/no-useless-promis…
Browse files Browse the repository at this point in the history
…e-resolve-reject

Enable the `unicorn/no-useless-promise-resolve-reject` ESLint plugin rule
  • Loading branch information
timvandermeij authored May 14, 2023
2 parents 521bea4 + 8fbd675 commit 693092c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 4 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@
"unicorn/no-instanceof-array": "error",
"unicorn/no-invalid-remove-event-listener": "error",
"unicorn/no-new-buffer": "error",
"unicorn/no-typeof-undefined": ["error", {
"checkGlobalVariables": false,
}],
"unicorn/no-useless-promise-resolve-reject": "error",
"unicorn/no-useless-spread": "error",
"unicorn/prefer-array-find": "error",
"unicorn/prefer-array-flat": "error",
Expand All @@ -63,7 +67,6 @@
"unicorn/prefer-regexp-test": "error",
"unicorn/prefer-string-replace-all": "error",
"unicorn/prefer-string-starts-ends-with": "error",
"unicorn/no-typeof-undefined": ["error", { "checkGlobalVariables": false, }],

// Possible errors
"for-direction": "error",
Expand Down
8 changes: 4 additions & 4 deletions test/unit/api_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ describe("api", function () {
function () {
// Shouldn't get here.
expect(false).toEqual(true);
return Promise.reject(new Error("loadingTask should be rejected"));
throw new Error("loadingTask should be rejected");
},
function (data) {
expect(data instanceof PasswordException).toEqual(true);
Expand All @@ -366,7 +366,7 @@ describe("api", function () {
function () {
// Shouldn't get here.
expect(false).toEqual(true);
return Promise.reject(new Error("loadingTask should be rejected"));
throw new Error("loadingTask should be rejected");
},
function (data) {
expect(data instanceof PasswordException).toEqual(true);
Expand Down Expand Up @@ -427,7 +427,7 @@ describe("api", function () {
function () {
// Shouldn't get here.
expect(false).toEqual(true);
return Promise.reject(new Error("loadingTask should be rejected"));
throw new Error("loadingTask should be rejected");
},
function (reason) {
expect(reason instanceof PasswordException).toEqual(true);
Expand All @@ -447,7 +447,7 @@ describe("api", function () {
function () {
// Shouldn't get here.
expect(false).toEqual(true);
return Promise.reject(new Error("loadingTask should be rejected"));
throw new Error("loadingTask should be rejected");
},
function (reason) {
expect(reason instanceof PasswordException).toEqual(true);
Expand Down

0 comments on commit 693092c

Please sign in to comment.