Update checked-in dependencies
This commit is contained in:
parent
7269bf610b
commit
e5a7c904c1
215 changed files with 41592 additions and 3253 deletions
18
node_modules/eslint-plugin-github/lib/rules/async-currenttarget.js
generated
vendored
18
node_modules/eslint-plugin-github/lib/rules/async-currenttarget.js
generated
vendored
|
|
@ -10,16 +10,24 @@ module.exports = {
|
|||
|
||||
create(context) {
|
||||
const scopeDidWait = new WeakSet()
|
||||
const sourceCode = context.sourceCode ?? context.getSourceCode()
|
||||
|
||||
return {
|
||||
AwaitExpression() {
|
||||
scopeDidWait.add(context.getScope(), true)
|
||||
AwaitExpression(node) {
|
||||
scopeDidWait.add(sourceCode.getScope ? sourceCode.getScope(node) : context.getScope())
|
||||
},
|
||||
MemberExpression(node) {
|
||||
if (node.property && node.property.name === 'currentTarget') {
|
||||
const scope = context.getScope()
|
||||
if (scope.block.async && scopeDidWait.has(scope)) {
|
||||
context.report({node, message: 'event.currentTarget inside an async function is error prone'})
|
||||
let scope = sourceCode.getScope ? sourceCode.getScope(node) : context.getScope()
|
||||
while (scope) {
|
||||
if (scopeDidWait.has(scope)) {
|
||||
context.report({
|
||||
node,
|
||||
message: 'event.currentTarget inside an async function is error prone',
|
||||
})
|
||||
break
|
||||
}
|
||||
scope = scope.upper
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue