You can probably use BabelJS (with your plugin for Babel) to do this btw.

On Thu, Feb 25, 2016 at 3:17 AM Nicholas Zakas <[email protected]>
wrote:

> Sorry, we don't have a way for you to alter scope variables
> programmatically.
>
> On Wed, Feb 24, 2016, 5:12 PM Jérôme Odier <[email protected]> wrote:
>
>> 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]> 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].
>>>
>>>
>>>> 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.
>>
> --
> 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.
>

-- 
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.

Reply via email to