mirror of
https://github.com/joelwmale/webhook-action.git
synced 2024-12-02 04:15:23 +01:00
1ada95e04a
- Convert project to Javascript/Typescript - Allow custom headers to be passed in (optional) - Allow body to be optional
24 lines
589 B
JavaScript
24 lines
589 B
JavaScript
const observerMap = {
|
|
scroll: 'IntersectionObserver',
|
|
resize: 'ResizeObserver'
|
|
}
|
|
module.exports = {
|
|
meta: {
|
|
docs: {},
|
|
fixable: 'code'
|
|
},
|
|
|
|
create(context) {
|
|
return {
|
|
['CallExpression[callee.property.name="addEventListener"]']: function(node) {
|
|
const [name] = node.arguments
|
|
if (name.type !== 'Literal') return
|
|
if (!(name.value in observerMap)) return
|
|
context.report({
|
|
node,
|
|
message: `Avoid using "${name.value}" event listener. Consider using ${observerMap[name.value]} instead`
|
|
})
|
|
}
|
|
}
|
|
}
|
|
}
|