Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Commit

Permalink
fix: not-null check for hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
clarkdo committed Dec 19, 2018
1 parent 0f2d34f commit ee73e8b
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions lib/rules/no-env-in-mounted.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,18 @@ module.exports = {
...utils.executeOnVue(context, obj => {
for (const funcName of HOOKS) {
const func = utils.getFunctionWithName(obj, funcName)
for (const { name, node: child } of forbiddenNodes) {
if (utils.isInFunction(func, child)) {
context.report({
node: child,
messageId: 'noEnv',
data: {
name,
funcName
}
})
if (func) {
for (const { name, node: child } of forbiddenNodes) {
if (utils.isInFunction(func, child)) {
context.report({
node: child,
messageId: 'noEnv',
data: {
name,
funcName
}
})
}
}
}
}
Expand Down

0 comments on commit ee73e8b

Please sign in to comment.