Skip to content

[no-shadow] error on this used as parameter function #207

Closed
@ficristo

Description

@ficristo

Repro

{
  "rules": {
    "no-shadow": "error"
  }
}
class NodeDomain {
    private _load() {
        const connection = this.connection;
        return connection.loadDomains(this._domainPath, true)
            .done(function (this: NodeDomain) {
                this._domainLoaded = true;
                this._connectionPromise = null;

                const eventNames = Object.keys(connection.domainEvents[this._domainName]);
                eventNames.forEach(function (this: NodeDomain, domainEvent) {
                    const connectionEvent = this._domainName + ":" + domainEvent + EVENT_NAMESPACE;

                    (connection as unknown as EventDispatcher.DispatcherEvents).on(connectionEvent, function (this: NodeDomain) {
                        const params = Array.prototype.slice.call(arguments, 1);
                        EventDispatcher.triggerWithArray(this, domainEvent, params);
                    }.bind(this));
                }, this);
            }.bind(this))
            .fail(function (this: NodeDomain, err) {
                console.error("[NodeDomain] Error loading domain \"" + this._domainName + "\": " + err);
            }.bind(this));
    }
}

Expected Result
No error

Actual Result
Error on the second and thid this: NodeDomain

Additional Info

Versions

package version
@typescript-eslint/eslint-plugin 1.1.0
@typescript-eslint/parser 1.1.0
TypeScript 3.2.4
ESLint 5.13.0
node 10.15.0
npm 6.4.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingexternalThis issue is with another package, not typescript-eslint itselfpackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions