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]: add support for tslint member-access config options #214
Comments
I don't agree with the If I write out a class and do not annotate any member accessibility, then I will get no lint errors. In order for us to implement that setting, we would have to rename the rule to The other settings definitely have merit in the context of the rule right now though. |
@bradzacher I agree it doesn't fit well with the current name of the rule (vs TSLint's name), but the use-case is valuable when you take the approach of not using This: class Foo {
bar: string;
baz: string;
public qux: string;
} Would be allowable currently in a codebase that didn't want to use |
there's definitely value in the option; eslint is about enforcing coding consistency, so adding an option to enforce not using But I would block hard against adding it whilst the rule is called |
Sounds good! |
I've been taking a short look at this rule while you two have been chatting here and considering how this might wind up being implemented and the interplay between the options outlined above. The It seems to me that there is a degree of mutual exclusivity in the options. e.g. It don't makes sense to allow a user to specify both no-public and check-constructor. Does that gel with your thinking @JamesHenry? |
That was my thinking - the config is a bit confusing as is (what does it mean to have no-public on and check-accessor on?). Off the top of my head I'd expect the config to look something like this (we do this for a number of our rules) type Override = boolean | { // false = don't check, true = check and use base config, object = override base config
noPublic?: boolean;
};
type Options = [
{
noPublic?: boolean;
overrides?: {
accessor?: Override;
constructor?: Override;
method?: Override;
parameterProperty?: Override;
}
}
] |
Yeah, that's making sense to me. TBH, I think that if there are overrides set then that will take precedence, so
Would result in the below being invalid and failing on line 3, character 3 but passing the constructor and the private property
Are there any guidelines to how to contribute to this project? |
@Hotell I have a question for you on the parameter-properties. Thanks |
I guess this can be closed given that #322 is merged. Can't wait for this to be released 🙌 🚀 |
TSlint member-access supports following config:
Currently this rule follows only all or nothing rule. It would be nice to implement at least
no-public
config to prevent devs to usepublic
which is a default in TS.Repro
The text was updated successfully, but these errors were encountered: