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

@babel/eslint-parser: update scope analysis for ClassPrivateProperty #10913

Merged

Conversation

kaicataldo
Copy link
Member

@kaicataldo kaicataldo commented Dec 23, 2019

Q                       A
Fixed Issues? Refs #10752
Patch: Bug Fix? 👍
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

This PR updates the scope analysis for ClassPrivateMethods once #10914 is merged and we're parsing these nodes correctly.

Note that ClassPrivateMethods still aren't 100% compatible with no-undef/no-unused-vars, but I didn't want to throw too much into this PR. I'll handle that as part of auditing the the plugin and making sure rules work with @babel/eslint-parser.

This is the last known issue on the parser side of things!

These changes rely on #10914 being merged first.

@kaicataldo kaicataldo added area: eslint PR: Bug Fix 🐛 A type of pull request used for our changelog categories labels Dec 23, 2019
@kaicataldo kaicataldo changed the title Babel eslint fix class private methods @babel/eslint-parser: fix parsing of ClassPrivateMethods Dec 23, 2019
@nicolo-ribaudo
Copy link
Member

This is not something I usually ask to do, but could you split this PR in two parts (one for @babel/core and one for @babel/eslint-parser)? Even if the eslint changes depend on the core changes, they are unrelated both logically and from a code point of view.

@@ -166,6 +166,10 @@ class Referencer extends OriginalReferencer {
this._visitClassProperty(node);
}

ClassPrivateMethod(node) {
super.MethodDefinition(node);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May worth a todo item here that once TypeScript or Flow supports private method, ClassPrivateMethod should visit typeAnnotations before super.MethodDefinition, of which the similar has been done in _visitClassProperty.

@kaicataldo kaicataldo force-pushed the babel-eslint-fix-class-private-methods branch 2 times, most recently from 8205f2d to 58d9c89 Compare December 23, 2019 18:31
@kaicataldo
Copy link
Member Author

Done!

@kaicataldo kaicataldo changed the title @babel/eslint-parser: fix parsing of ClassPrivateMethods @babel/eslint-parser: update scope analysis for ClassPrivateProperty Dec 23, 2019
@kaicataldo kaicataldo force-pushed the babel-eslint-fix-class-private-methods branch from 58d9c89 to 474f3c2 Compare December 23, 2019 18:39
@nicolo-ribaudo
Copy link
Member

Closed accidentally

@kaicataldo
Copy link
Member Author

It allowed tests to run again after the other PR was merged, so no worries! 😆

@nicolo-ribaudo
Copy link
Member

@kaicataldo I'm not sure about why the e2e tests are failing. While investigating I found a bug in our publishing process which might be related (0075830), so rebasing might make them pass.

@kaicataldo kaicataldo force-pushed the babel-eslint-fix-class-private-methods branch from 474f3c2 to 2940571 Compare January 2, 2020 22:45
@kaicataldo
Copy link
Member Author

@nicolo-ribaudo Looks like rebasing fixed it!

@kaicataldo kaicataldo merged commit 9f832c2 into babel:master Jan 2, 2020
@kaicataldo kaicataldo deleted the babel-eslint-fix-class-private-methods branch January 2, 2020 23:36
@kaicataldo kaicataldo mentioned this pull request Jan 14, 2020
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Apr 3, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: eslint outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Bug Fix 🐛 A type of pull request used for our changelog categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants