Skip to content

build: expand decorators validation rule to cover class members #17673

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

Merged
merged 1 commit into from
Nov 18, 2019

Conversation

crisbeto
Copy link
Member

Expands the lint rule that we use to validate class decorators to also apply to class members. We need this in order to support linting things like descendants on ContentChildren.

These changes switch around the config data structure to make it more flexible, fix some cases where we were using any and add some extra properties to the config.

@crisbeto crisbeto added P2 The issue is important to a large percentage of users, with a workaround pr: merge safe labels Nov 12, 2019
@crisbeto crisbeto requested review from jelbourn and a team as code owners November 12, 2019 01:43
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Nov 12, 2019
Copy link
Member

@devversion devversion left a comment

Choose a reason for hiding this comment

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

LGTM. One minor nit

"NgModule": {
"argument": 0,
"properties": {
"*": "^(?!\\s*$).+"
Copy link
Member

Choose a reason for hiding this comment

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

It slightly feels confusing that * is part of properties but matches the actual decorator argument text (where it doesn't necessarily need to be a ts.ObjectLiteralExpression.

I understand why it is done that way, but it feels weird. Since it's just a lint rule though, it should be fine.

Copy link
Member Author

Choose a reason for hiding this comment

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

I felt weird about it as well, but I wasn't sure how else to express it.

Copy link
Member

Choose a reason for hiding this comment

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

We could have another property like argumentText, but I don't think it's too important.

Expands the lint rule that we use to validate class decorators to also apply to class members. We need this in order to support linting things like `descendants` on `ContentChildren`.

These changes switch around the config data structure to make it more flexible, fix some cases where we were using `any` and add some extra properties to the config.
@crisbeto crisbeto force-pushed the decorators-rule-expansion branch from 301491e to cff8115 Compare November 12, 2019 12:30
@crisbeto crisbeto added the action: merge The PR is ready for merge by the caretaker label Nov 12, 2019
@jelbourn jelbourn added the target: patch This PR is targeted for the next patch release label Nov 18, 2019
@jelbourn jelbourn merged commit bc58e79 into angular:master Nov 18, 2019
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Dec 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement P2 The issue is important to a large percentage of users, with a workaround target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants