Dear Nicholas, Thanks a lot for responding. I successfully wrote the new rule. It detects my class factory call and extacts the class name (first parameter of the factory function). From know, I would like to know how to programmatically add a new global function (the new class) in the scope. Is there a method to do that ?
Best regard, Jérôme Le mercredi 24 février 2016 19:31:21 UTC+1, Nicholas Zakas a écrit : > > Anything that can be determined using static analysis can be made into a > rule. Here are the docs on creating your own rules: > http://eslint.org/docs/developer-guide/working-with-rules > > -N > On Wed, Feb 24, 2016 at 7:31 AM Jérôme Odier <[email protected] > <javascript:>> wrote: > >> Hi! >> >> I would like to know if it is possible and how to write a plugin for >> supporting class factories. For instance, in our application, we do: >> >> $class('MyClass', { >> >> foo: function() { >> >> }, >> >> bar: function() { >> >> } >> >> }); >> >> var myInstance = new MyClass(); >> >> Thanks a lot for your help. >> >> Best regards >> >> -- >> You received this message because you are subscribed to the Google Groups >> "ESLint" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > -- You received this message because you are subscribed to the Google Groups "ESLint" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
