-
Notifications
You must be signed in to change notification settings - Fork 14
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
Lack of accessibility modifiers in mixins/traits #1267
Comments
Slack#typescript: @samreid
to be private and the type checker still passed. @pixelzoom @pixelzoom @pixelzoom @pixelzoom |
This is really not a good fit for our decision in #1258 to require accessibility modifiers. I've had to this nonsense for now, e.g. in AccessibleValueHandler, adding a
And as I mentioned above:
|
How about turning off that rule for the whole file. We are already doing this for Index: js/accessibility/voicing/Voicing.ts
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/js/accessibility/voicing/Voicing.ts b/js/accessibility/voicing/Voicing.ts
--- a/js/accessibility/voicing/Voicing.ts (revision ace23fc4566773387bb33efa9960b4248b702f5f)
+++ b/js/accessibility/voicing/Voicing.ts (date 1654872769089)
@@ -26,6 +26,7 @@
// Disable for the whole file
/* eslint-disable no-protected-jsdoc */
+/* eslint-disable @typescript-eslint/explicit-member-accessibility */
import inheritance from '../../../../phet-core/js/inheritance.js';
import ResponsePacket, { ResolvedResponse, ResponsePacketOptions, VoicingResponse } from '../../../../utterance-queue/js/ResponsePacket.js';
Does this help with bullet one?
This is unfortunate. I couldn't think of another thing to do, so I think we should clean this up, and make underscore name prefix private. We know that some mixins will stick around for the foreseeable future, so let's make this convention right. Do you have another idea? |
I agree that not requiring
But before we do any of that... I'd be interested in knowing why use of |
Thesis: I think we can have support for private and protected in our mixins. We are currently running into this error because I create a mixin like so:
This is an anonymous class, and typescript doesn't let them have private/protected members, explained and discovered with TypeScript issue pointers over in phetsims/scenery#1340 (comment). BUT, it seems like it is easy enough to name the class (stupid me). I'm not seeing any errors, so perhaps it was a flaw in my understanding. And for that I'm sorry for this headache! I'll commit changes to 6 mixins imminently. |
…sdoc into main bad-typescript text, remove disabling of it. phetsims/chipper#1267
…sdoc into main bad-typescript text, remove disabling of it. phetsims/chipper#1267
…sdoc into main bad-typescript text, remove disabling of it. #1267
…sdoc into main bad-typescript text, remove disabling of it. phetsims/chipper#1267
I feel dumb that we needed the above commit in the first place, but, getting over myself, it is really really nice to have this fixed! I added visibility annotations to the sun and scenery a11y feature mixins, and cleaned up the lint rules since we don't need to opt out of forbidding |
Excellent, glad we can add accessibility modifiers to mixins. It makes me feel even better about our decisions in #1258. Here's the full list of mixins/traits. I've checked off the ones that @zepumph and I have handled. @jonathanolson is there any reason why we can't add proper accessibility modifiers to these? mobius
scenery
sun
wilder
|
It may be safest to develop with |
From 6/16/22 dev meeting: We checked in on this issue and it will continue getting worked on. |
Looks like @samreid's bug report in typescript was tagged as fixed. Not sure what release it will get into, but yay! |
At today's meeting, @jonathanolson confirmed he will champion this issue. Unclear how long it will take. @zepumph says it will be a straightforward refactor. @pixelzoom said he tried to work on this, but couldn't add accessibility modifiers since it was unclear what should be private/public/protected. @jessegreenberg: Pre-existing underscores may indicate it should be private. @jonathanolson hopes this is a quick issues. |
I hit all of the above mixins - a lot of the layout things need to be scenery-internal. Closing |
…sdoc into main bad-typescript text, remove disabling of it. phetsims/chipper#1267
In mixins/traits, I see comments like this one in NumberSpinner.ts:
But when I use
private
andprotected
, I’m not seeing any tsc or lint errors. Was this perhaps a problem in an earlier version of tsc that has been fixed? Can we now use proper modifiers in mixins/traits?The text was updated successfully, but these errors were encountered: