cvisco / eslint-plugin-requirejs

Enforce code conventions for RequireJS modules with ESLint
MIT License
29 stars 16 forks source link

New rule: Ensure module exports/returns something #100

Open platinumazure opened 7 years ago

platinumazure commented 7 years ago

More often than I care to admit, I've written code like the following:

define(["some/dep"], function (Dep) {
    var MyThing = {
        // 500+ lines of code
    };

    // oops, forgot to return MyThing
});

We could create a rule which uses code path analysis to ensure that all code paths either return something (AMD) or assign to module or exports (CommonJS).

cvisco commented 7 years ago

Yeah, this makes sense. I guess we have rules that forbid certain styles of return, but nothing that ensures we actually return something.

cvisco commented 7 years ago

Also, congrats on filing issue #100 :)