You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constMESSAGE='Do not use events for lifecycle hooks. Please use the actual hooks instead: https://github.com/chadhietala/ember-best-practices/blob/master/guides/rules/no-lifecycle-events.md';
11
+
// TODO: Pull these from somewhere?
12
+
constLIFECYCLE_HOOKS=[
13
+
'didDestroyElement',
14
+
'didInsertElement',
15
+
'didReceiveAttrs',
16
+
'didReceiveAttrs',
17
+
'didRender',
18
+
'didRender',
19
+
'didUpdate',
20
+
'didUpdateAttrs',
21
+
'init',
22
+
'willClearRender',
23
+
'willDestroyElement',
24
+
'willRender',
25
+
'willRender',
26
+
'willUpdate'
27
+
];
11
28
12
29
functionisOn(node){
13
30
returnnode.name==='on';
@@ -17,6 +34,10 @@ function isEmber(node) {
17
34
returnnode.name==='Ember';
18
35
}
19
36
37
+
functionisLifecycleHook(argument){
38
+
returnLIFECYCLE_HOOKS.includes(argument.value);
39
+
}
40
+
20
41
module.exports={
21
42
docs: {
22
43
description: 'Disallow use of lifecycle events using `.on()`',
0 commit comments