Skip to content

Add declaration-property-max-values#5920

Merged
jeddy3 merged 13 commits intomainfrom
declaration-property-max-values
Mar 7, 2022
Merged

Add declaration-property-max-values#5920
jeddy3 merged 13 commits intomainfrom
declaration-property-max-values

Conversation

@mattxwang
Copy link
Copy Markdown
Member

@mattxwang mattxwang commented Feb 18, 2022

Which issue, if any, is this issue related to?

Closes #5435, related to #3968.

Is there anything in the PR that needs further explanation?

As suggested by @jeddy3, I've scaffolded this off of declaration-property-value-allowed-list. I've also implemented a new util, validateObjectWithProps(), and written some tests.

This is my first time creating an entirely new rule, so I have three things I'd like to get some feedback on:

  1. Is the documentation the correct level of conciseness?
  2. In this PR, I haven't yet used the validateOptions utility function. How should I use it here, if at all?
  3. My method for finding the number of values is finding the number of word nodes after running the value through the value parser. Is this the correct approach?

Copy link
Copy Markdown
Member

@ybiquitous ybiquitous left a comment

Choose a reason for hiding this comment

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

@mattxwang Thank you for creating this pull request! I think the implementation is in the right direction. 👍🏼

Comment thread lib/rules/declaration-property-max-values/README.md Outdated
Comment thread lib/rules/declaration-property-max-values/README.md Outdated
Comment thread lib/rules/declaration-property-max-values/README.md Outdated
Comment thread lib/rules/declaration-property-max-values/README.md
Comment thread lib/rules/declaration-property-max-values/index.js
Comment thread lib/rules/declaration-property-max-values/index.js Outdated
Comment thread lib/rules/declaration-property-max-values/index.js Outdated
Comment thread lib/rules/declaration-property-max-values/index.js Outdated
Copy link
Copy Markdown
Member

@jeddy3 jeddy3 left a comment

Choose a reason for hiding this comment

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

@mattxwang Looking good so far!

I've requested a few changes in addition to @ybiquitous'.

Comment thread lib/rules/declaration-property-max-values/README.md Outdated
Comment thread lib/rules/declaration-property-max-values/__tests__/index.js
Comment thread lib/rules/declaration-property-max-values/README.md Outdated
Comment thread lib/rules/declaration-property-max-values/README.md Outdated
Comment thread lib/rules/declaration-property-max-values/README.md Outdated
Comment thread lib/rules/declaration-property-max-values/README.md Outdated
mattxwang and others added 5 commits February 21, 2022 15:59
Co-authored-by: Masafumi Koba <473530+ybiquitous@users.noreply.github.com>
Applies suggestions from code review:

- removes invalid CSS from docs and test cases
- removes redundant docs entries
- uses `a` for all selectors
- writes a new helper "isValueNode" to cover word, function, string value types
- adds new test case for css variable
@mattxwang mattxwang force-pushed the declaration-property-max-values branch from 4701a2f to 7955ad1 Compare February 22, 2022 03:54
@mattxwang
Copy link
Copy Markdown
Member Author

mattxwang commented Feb 22, 2022

Thanks for the in-depth feedback @jeddy3 and @ybiquitous, it's much appreciated - I still have a lot to learn in terms of the codebase and best practices.

In general, I think I've addressed each point of feedback. I did have a chance to implement validateObjectWithProps, though I'm not sure if it's the intended behaviour from the above discussion - is this what you two were thinking? Did you want me to add the array functionality from validateObjectWithArrayProps as well?

And, anything else I should be mindful of?

@ybiquitous
Copy link
Copy Markdown
Member

@mattxwang I think your implementation of validateObjectWithProps is just what we want. 👍🏼

Comment thread lib/utils/__tests__/validateObjectWithProps.test.js Outdated
Comment thread lib/utils/validateObjectWithProps.js Outdated
Comment thread lib/utils/validateObjectWithProps.js Outdated
Comment thread lib/utils/validateObjectWithProps.js Outdated
Comment thread lib/utils/validateObjectWithProps.js Outdated
Comment thread lib/utils/validateObjectWithProps.js Outdated
Copy link
Copy Markdown
Member

@jeddy3 jeddy3 left a comment

Choose a reason for hiding this comment

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

Thanks for making the changes! Looking good.

In addition to @ybiquitous' suggestion, just one more minor request from me

Co-authored-by: Masafumi Koba <473530+ybiquitous@users.noreply.github.com>
@mattxwang
Copy link
Copy Markdown
Member Author

Thanks for the suggestions @ybiquitous, didn't realize that we'd get better typing by importing from ./validateTypes!

@jeddy3, I may be missing something, but what was your requested change? I don't see anything attached to your "requested changes" dialog box.

Copy link
Copy Markdown
Member

@ybiquitous ybiquitous left a comment

Choose a reason for hiding this comment

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

@mattxwang Thank you for addressing the reviews. Almost good. 👍🏼

I've left more trivial suggestions and one question.

Comment thread lib/rules/declaration-property-max-values/README.md Outdated
Comment thread lib/rules/declaration-property-max-values/__tests__/index.js
Comment thread lib/rules/declaration-property-max-values/index.js Outdated
Comment thread lib/rules/declaration-property-max-values/index.js Outdated
Comment thread lib/rules/declaration-property-max-values/index.js
Moves `validateOptions` outside of `walkDecls`, better type annotation style!

Co-authored-by: Masafumi Koba <473530+ybiquitous@users.noreply.github.com>
Copy link
Copy Markdown
Member

@ybiquitous ybiquitous left a comment

Choose a reason for hiding this comment

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

@mattxwang Thank you for implementing the excellent rule. LGTM 👍🏼

Copy link
Copy Markdown
Member

@jeddy3 jeddy3 left a comment

Choose a reason for hiding this comment

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

@jeddy3, I may be missing something, but what was your requested change? I don't see anything attached to your "requested changes" dialog box.

That's weird. It seems it fell into the ether.

I've readded it.

Comment thread lib/rules/declaration-property-max-values/index.js Outdated
mattxwang and others added 2 commits February 23, 2022 14:39
Moves external require to top of require list

Co-authored-by: Richard Hallows <jeddy3@users.noreply.github.com>
@mattxwang
Copy link
Copy Markdown
Member Author

Completely missed one of the requested changes, my fault! Should have addressed all the comments - @jeddy3 let me know what you think!

Copy link
Copy Markdown
Member

@jeddy3 jeddy3 left a comment

Choose a reason for hiding this comment

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

Thanks for making the changes. I think the tests and readme work better now.

LGTM.

@jeddy3 jeddy3 merged commit e4917da into main Mar 7, 2022
@jeddy3 jeddy3 deleted the declaration-property-max-values branch March 7, 2022 10:09
@jeddy3
Copy link
Copy Markdown
Member

jeddy3 commented Mar 7, 2022

  • Added: declaration-property-max-values rule (#5920).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Add declaration-property-max-values

3 participants