mirror of
https://github.com/joelwmale/webhook-action.git
synced 2024-12-01 20:05:21 +01:00
31 lines
742 B
JavaScript
31 lines
742 B
JavaScript
module.exports = {
|
|
meta: {
|
|
docs: {},
|
|
schema: []
|
|
},
|
|
|
|
create(context) {
|
|
return {
|
|
Program() {
|
|
const scope = context.getScope()
|
|
|
|
for (const variable of scope.variables) {
|
|
if (variable.writeable) {
|
|
return
|
|
}
|
|
|
|
for (const def of variable.defs) {
|
|
if (
|
|
def.type === 'FunctionName' ||
|
|
def.type === 'ClassName' ||
|
|
(def.type === 'Variable' && def.parent.kind === 'const') ||
|
|
(def.type === 'Variable' && def.parent.kind === 'let')
|
|
) {
|
|
context.report(def.node, 'Implicit global variable, assign as global property instead.')
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|