Files
NapCatQQ/.pnpm-store/v3/files/7d/03e4c10e24ee30e58ec69a0b9b91b62764c5d112d442f236455e40826dbeccc326b91e743e59aa227ae0c559d0ff662f16653c8b25b63275713ebd22e27d10
TanTan e311ca3275
Build NapCat Artifacts / Windows Loader Test (push) Canceled after 0s
Build NapCat Artifacts / Type Check & Test (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Framework (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Shell (push) Canceled after 0s
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

51 lines
1.3 KiB
Plaintext

'use strict'
const getDocsUrl = require('./lib/get-docs-url')
const isPromise = require('./lib/is-promise')
module.exports = {
meta: {
type: 'problem',
docs: {
description: 'Disallow return statements in `finally()`.',
url: getDocsUrl('no-return-in-finally'),
},
schema: [],
messages: {
avoidReturnInFinally: 'No return in finally',
},
},
create(context) {
return {
CallExpression(node) {
if (isPromise(node)) {
if (
node.callee &&
node.callee.property &&
node.callee.property.name === 'finally'
) {
// istanbul ignore else -- passing `isPromise` means should have a body
if (
node.arguments &&
node.arguments[0] &&
node.arguments[0].body &&
node.arguments[0].body.body
) {
if (
node.arguments[0].body.body.some((statement) => {
return statement.type === 'ReturnStatement'
})
) {
context.report({
node: node.callee.property,
messageId: 'avoidReturnInFinally',
})
}
}
}
}
},
}
},
}