-
Notifications
You must be signed in to change notification settings - Fork 13
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
explicit-member-accessibility
typescript-eslint rule
#1258
Comments
I should mention that the |
And again in SeriesCanvasNode.ts: class SeriesCanvasNode extends CanvasNode {
seriesProperty: Property<DataPoint[]>;
modelViewTransformProperty: Property<ModelViewTransform2>;
color: string;
...
constructor( seriesProperty: Property<DataPoint[]>, modelViewTransformProperty: Property<ModelViewTransform2>,
color: string, providedOptions?: NodeOptions ) {
super( providedOptions );
this.seriesProperty = seriesProperty; // @private
this.modelViewTransformProperty = modelViewTransformProperty; // @private
this.color = color; // @private
} |
We discussed this at today's dev meeting. @zepumph recommend we separate this into 3 problems:
|
Have you been mindful of public/private? Recommendation for going forward, for voting for requiring public annotation: #1258 |
Several team members recommended that we should be consistent, even requiring |
@samreid will also check why UPDATE: According to https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts, it appears the only support for autofix is removing an unwanted "public" modifier. |
I added a (horribly inefficient) script that adds accessibility modifiers. |
I used the script in axon to make all missing modifiers private, then I used the type checker to visit each site and make them public where appropriate. |
I'd be interested in a script like this for general use. For some collection of .ts files, the script would change all fields to |
Here is the result of
|
public
modifier optional.public
modifier optional (explicit-member-accessibility
)
vegas, sun, scenery-phet, and simula-rasa are all cleaned up, and are checking |
This rule makes most of the Access Modifiers section irrelevant in PhET's TypeScript Conventions doc. Should we remove the entire section? Keep part of it? |
I would remove it! It is out of date anyways |
After that, feel free to close, I cleaned up all package.jsons that were using rule. |
@samreid do you have any feelings about blowing away the entire Access Modifiers section? I think that you may have been the author of the final 2 paragraphs. |
Looks good to be deleted, thanks! |
In today's meeting, we agreed this issue can be closed when:
|
Access Modifiers section deleted in the above commit. Closing. |
Here's an example of why I'd like to revisit the decision to make
public
optional (at developer discretion).In bending-light GridCanvasNode.ts:
The fields here were probably auto-created using WebStorm, with default public visibility. And then they were never given the proper visibility, which should be
private
(as noted in the comments).And this is not an isolated case. While working on #1224 to remove redundant
@private
annotations, I'm finding this problem throughout the fields and methods of bending-light. And I've seen it elsewhere.My feeling is that requiring developers to explicilty add an annotation is more likely to result in a correct annotation. And (so far) some developers have abused default visibility.
The text was updated successfully, but these errors were encountered: