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

Commit daa93f3

Browse files
committed
fix: not-null check for hooks
1 parent e44da70 commit daa93f3

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

lib/rules/no-env-in-mounted.js

+12-10
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,18 @@ module.exports = {
4747
...utils.executeOnVue(context, obj => {
4848
for (const funcName of HOOKS) {
4949
const func = utils.getFunctionWithName(obj, funcName)
50-
for (const { name, node: child } of forbiddenNodes) {
51-
if (utils.isInFunction(func, child)) {
52-
context.report({
53-
node: child,
54-
messageId: 'noEnv',
55-
data: {
56-
name,
57-
funcName
58-
}
59-
})
50+
if (func) {
51+
for (const { name, node: child } of forbiddenNodes) {
52+
if (utils.isInFunction(func, child)) {
53+
context.report({
54+
node: child,
55+
messageId: 'noEnv',
56+
data: {
57+
name,
58+
funcName
59+
}
60+
})
61+
}
6062
}
6163
}
6264
}

0 commit comments

Comments
 (0)