fix: add no-useless-promise-resolve-reject rule (#5111)
This commit is contained in:
@@ -210,6 +210,7 @@ const config = {
|
|||||||
'unicorn/prefer-dom-node-dataset': 'error',
|
'unicorn/prefer-dom-node-dataset': 'error',
|
||||||
'unicorn/prefer-dom-node-append': 'error',
|
'unicorn/prefer-dom-node-append': 'error',
|
||||||
'unicorn/prefer-array-some': 'error',
|
'unicorn/prefer-array-some': 'error',
|
||||||
|
'unicorn/no-useless-promise-resolve-reject': 'error',
|
||||||
'sonarjs/no-all-duplicated-branches': 'error',
|
'sonarjs/no-all-duplicated-branches': 'error',
|
||||||
'sonarjs/no-element-overwrite': 'error',
|
'sonarjs/no-element-overwrite': 'error',
|
||||||
'sonarjs/no-empty-collection': 'error',
|
'sonarjs/no-empty-collection': 'error',
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
"lint:eslint:fix": "yarn lint:eslint --fix",
|
"lint:eslint:fix": "yarn lint:eslint --fix",
|
||||||
"lint:prettier": "prettier --ignore-unknown --cache --check .",
|
"lint:prettier": "prettier --ignore-unknown --cache --check .",
|
||||||
"lint:prettier:fix": "prettier --ignore-unknown --cache --write .",
|
"lint:prettier:fix": "prettier --ignore-unknown --cache --write .",
|
||||||
"lint:ox": "oxlint --deny-warnings --import-plugin -D correctness -D nursery -D prefer-array-some -A no-undef -A consistent-type-exports -A default -A named -A ban-ts-comment",
|
"lint:ox": "oxlint --deny-warnings --import-plugin -D correctness -D nursery -D prefer-array-some -D no-useless-promise-resolve-reject -A no-undef -A consistent-type-exports -A default -A named -A ban-ts-comment",
|
||||||
"lint": "yarn lint:eslint && yarn lint:prettier",
|
"lint": "yarn lint:eslint && yarn lint:prettier",
|
||||||
"lint:fix": "yarn lint:eslint:fix && yarn lint:prettier:fix",
|
"lint:fix": "yarn lint:eslint:fix && yarn lint:prettier:fix",
|
||||||
"test": "vitest --run",
|
"test": "vitest --run",
|
||||||
|
|||||||
@@ -65,9 +65,7 @@ test.afterEach.always(async t => {
|
|||||||
|
|
||||||
test('should get blob size limit', async t => {
|
test('should get blob size limit', async t => {
|
||||||
const { resolver } = t.context;
|
const { resolver } = t.context;
|
||||||
fakeUserService.getStorageQuotaById.returns(
|
fakeUserService.getStorageQuotaById.resolves(100 * 1024 * 1024 * 1024);
|
||||||
Promise.resolve(100 * 1024 * 1024 * 1024)
|
|
||||||
);
|
|
||||||
const res = await resolver.checkBlobSize(new FakePrisma().fakeUser, '', 100);
|
const res = await resolver.checkBlobSize(new FakePrisma().fakeUser, '', 100);
|
||||||
t.not(res, false);
|
t.not(res, false);
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ export async function bootstrapPluginSystem(
|
|||||||
logger.debug(`registering plugin ${pluginName}`);
|
logger.debug(`registering plugin ${pluginName}`);
|
||||||
logger.debug(`package.json: ${packageJson}`);
|
logger.debug(`package.json: ${packageJson}`);
|
||||||
if (!release && !runtimeConfig.enablePlugin) {
|
if (!release && !runtimeConfig.enablePlugin) {
|
||||||
return Promise.resolve();
|
return;
|
||||||
}
|
}
|
||||||
const baseURL = url;
|
const baseURL = url;
|
||||||
const entryURL = `${baseURL}/${core}`;
|
const entryURL = `${baseURL}/${core}`;
|
||||||
@@ -95,7 +95,7 @@ export async function bootstrapPluginSystem(
|
|||||||
const loadedAssetName = `${pluginName}_${asset}`;
|
const loadedAssetName = `${pluginName}_${asset}`;
|
||||||
// todo(himself65): add assets into shadow dom
|
// todo(himself65): add assets into shadow dom
|
||||||
if (loadedAssets.has(loadedAssetName)) {
|
if (loadedAssets.has(loadedAssetName)) {
|
||||||
return Promise.resolve();
|
return;
|
||||||
}
|
}
|
||||||
if (asset.endsWith('.css')) {
|
if (asset.endsWith('.css')) {
|
||||||
loadedAssets.add(loadedAssetName);
|
loadedAssets.add(loadedAssetName);
|
||||||
@@ -111,7 +111,7 @@ export async function bootstrapPluginSystem(
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
return Promise.resolve();
|
return;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -255,6 +255,6 @@ export const fetchWithTraceReport = async (
|
|||||||
requestId,
|
requestId,
|
||||||
...(event ? { event } : {}),
|
...(event ? { event } : {}),
|
||||||
});
|
});
|
||||||
return await Promise.reject(err);
|
throw err;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user