mirror of
https://github.com/joelwmale/webhook-action.git
synced 2024-11-26 09:25:24 +01:00
25 lines
584 B
JavaScript
25 lines
584 B
JavaScript
|
module.exports = {
|
||
|
meta: {
|
||
|
docs: {},
|
||
|
schema: []
|
||
|
},
|
||
|
|
||
|
create(context) {
|
||
|
const scopeDidWait = new WeakSet()
|
||
|
|
||
|
return {
|
||
|
AwaitExpression() {
|
||
|
scopeDidWait.add(context.getScope(), true)
|
||
|
},
|
||
|
CallExpression(node) {
|
||
|
if (node.callee.property && node.callee.property.name === 'preventDefault') {
|
||
|
const scope = context.getScope()
|
||
|
if (scope.block.async && scopeDidWait.has(scope)) {
|
||
|
context.report(node, 'event.preventDefault() inside an async function is error prone')
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|