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
25 lines
565 B
JavaScript
25 lines
565 B
JavaScript
module.exports = function(context) {
|
|
const htmlOpenTag = /^<[a-zA-Z]/
|
|
const message = 'Unescaped HTML literal. Use html`` tag template literal for secure escaping.'
|
|
|
|
return {
|
|
Literal(node) {
|
|
if (!htmlOpenTag.test(node.value)) return
|
|
|
|
context.report({
|
|
node,
|
|
message
|
|
})
|
|
},
|
|
TemplateLiteral(node) {
|
|
if (!htmlOpenTag.test(node.quasis[0].value.raw)) return
|
|
|
|
if (!node.parent.tag || node.parent.tag.name !== 'html') {
|
|
context.report({
|
|
node,
|
|
message
|
|
})
|
|
}
|
|
}
|
|
}
|
|
}
|