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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: produce valid code when when fixing properties accessed with square brackets #1131

Merged
merged 6 commits into from May 29, 2022

Conversation

G-Rath
Copy link
Collaborator

@G-Rath G-Rath commented May 29, 2022

Very minor (I really don't think anyone is accessing properties this way) but it's technically a bug - I realised afterwards that the alternative is to do:

fixer.replaceTextRange(
  [matcher.node.object.range[1], matcher.node.range[1]],
  `.${...}`,
),

which ensures the whole accessor is removed correctly making it safe to not use quotes - I'm not fussed which fix we actually do, but felt this helper was slightly better by way of being more readable 馃し

We could be using it in no-deprecated-functions too except that technically isn't using a node of type AccessorNode so have left it as-is for now since it technically should be refactored anyway to use the new jest function parser.

@G-Rath G-Rath added the bug label May 29, 2022
@G-Rath G-Rath merged commit 6cd600d into main May 29, 2022
@G-Rath G-Rath deleted the improve-test-todo branch May 29, 2022 19:34
github-actions bot pushed a commit that referenced this pull request May 29, 2022
## [26.4.3](v26.4.2...v26.4.3) (2022-05-29)

### Bug Fixes

* don't consider method calls on literals or `new` to be jest functions ([#1132](#1132)) ([379ceb3](379ceb3))
* produce valid code when when fixing properties accessed with square brackets ([#1131](#1131)) ([6cd600d](6cd600d))
@github-actions
Copy link

馃帀 This PR is included in version 26.4.3 馃帀

The release is available on:

Your semantic-release bot 馃摝馃殌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant