Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(no-this-assign-in-render): explicit left hand side traversal #185

Merged
merged 1 commit into from
Oct 24, 2023

Conversation

43081j
Copy link
Owner

@43081j 43081j commented Oct 24, 2023

The esquery we were using was too wide in that it would match a .left at any level.

This meant the following code would match:

render() {
  x = this.foo || 123;
}

As a LogicalExpression has a left just like an AssignmentExpression.

Since esquery doesn't support relative direct child selection (i.e. using :has(> foo)), we are now selecting the left side node and reporting on the parent instead.

The esquery we were using was too wide in that it would match a `.left`
at _any_ level.

This meant the following code would match:

```ts
render() {
  x = this.foo || 123;
}
```

As a `LogicalExpression` has a left just like an `AssignmentExpression`.

Since esquery doesn't support relative direct child selection (i.e.
using `:has(> foo)`), we are now selecting the left side node and
reporting on the parent instead.
@43081j 43081j merged commit 8f307c5 into master Oct 24, 2023
4 checks passed
@43081j 43081j deleted the fix-this-assign branch October 24, 2023 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant