Merge pull request #16415 from Snuffleupagus/no-useless-promise-resolve-reject

Enable the `unicorn/no-useless-promise-resolve-reject` ESLint plugin rule
This commit is contained in:
Tim van der Meij 2023-05-14 12:41:11 +02:00 committed by GitHub
commit 693092c980
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 5 deletions

View File

@ -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",
@ -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",

View File

@ -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);
@ -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);
@ -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);
@ -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);