Skip to content

no-identical-names rule false positives with modules inside separate scopes/functions #129

Open
@bmish

Description

@bmish

This should be an valid case (but is currently invalid):

function sharedBehavior() {
    module('moduleName', function () {});
}
module('moduleName', function () {}); // This is erroneously considered a violation.

This should be an valid case (but is currently invalid):

export default {
    desktop() {
        module('hourly chart', function () {});
    },

    mobile() {
        module('hourly chart', function () {});
    },
};

This should be an valid case (but is currently invalid):

if (foo) {
    module('module1', function () {});
} else {
    module('module1', function () {});
}

Additional test cases that should be added:

module("name1", function() {
    function sharedBehavior() {
        module("name1", function() {}); // This is fine since it's in its own scope.
    };
    module("name1", function() {}); // This is the violation.
});
function sharedBehavior() {
    module("name1", function() {});
    module("name1", function() {}); // This is the violation.
};

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions