cloudflare / cloudflare/eslint-plugin-cflint

no-this-assignment: Should allow AssignmentExpression where `left` is MemberExpression

Open
#5 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
16
Forks
2
PR merge metrics
No merged PRs in 30d

Description

I just tried doing the following and was yelled at:

``` js
Module.addInitializer(function(options) {
options = options || {};
options.module = this;
this.controller = new Controller(options);
});
```

Since this rule is only trying to safeguard against:

``` js
var self = this;
self = this;
```

I think MemberExpressions should be valid.

Contributor guide

Open the contributing guide

Research direction

Start at the no-this-assignment rule and inspect its existing behavior for AssignmentExpression nodes. Verify that assignments whose left side is a MemberExpression are accepted while direct self-assignment such as self = this remains rejected; add or update coverage for both cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
eslint, javascript
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.