Skip to content

Latest commit

 

History

History
37 lines (28 loc) · 847 Bytes

no-assign-exports.md

File metadata and controls

37 lines (28 loc) · 847 Bytes

Disallow assignment to exports when using Simplified CommonJS Wrapper (no-assign-exports)

Rule Details

This rule aims to prevent assignment to the exports variable. This is generally an error, as assignment should be done to module.exports instead. This rule is only in effect when using the Simplified CommonJS Wrapper.

The following patterns are considered warnings:

define(function (require, exports) {
    exports = function () {
        /* ... */
    };
});

define(function (require, exports) {
    exports = {
        doSomething: function () {
            /* ... */
        }
    };
});

The following patterns are not warnings:

define(function (require, exports) {
    exports.doSomething: function () {
        /* ... */
    };
});

When Not To Use It

You should probably not disable this rule.