initial commit of actions
This commit is contained in:
commit
949ece5785
44660 changed files with 12034344 additions and 0 deletions
28
github/codeql-action-v2/node_modules/eslint-plugin-github/lib/rules/async-preventdefault.js
generated
vendored
Normal file
28
github/codeql-action-v2/node_modules/eslint-plugin-github/lib/rules/async-preventdefault.js
generated
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
module.exports = {
|
||||
meta: {
|
||||
type: 'problem',
|
||||
docs: {
|
||||
description: 'disallow `event.preventDefault` calls inside of async functions',
|
||||
url: require('../url')(module),
|
||||
},
|
||||
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, message: 'event.preventDefault() inside an async function is error prone'})
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue