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
Add ignoreSelectors: []
to selector-max-compound-selectors
#7544
Add ignoreSelectors: []
to selector-max-compound-selectors
#7544
Conversation
🦋 Changeset detectedLatest commit: 411ed1e The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
ignoreSelectors
option to selector-max-compound-selectors
ruleignoreSelectors: []
to selector-max-compound-selectors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the pull request. Can you add the option to the rule's README?
Co-authored-by: Masafumi Koba <473530+ybiquitous@users.noreply.github.com>
{ | ||
code: '.foo { & ::v-deep > .bar {} }', | ||
description: 'nested ignored selector', | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question
major
How should '.foo .baz .bar.quz {}'
behave for 2
ignore [".bar", ".quz"]
?
i.e. does it remove one by one from the compound selector or does it skip it if it's not exactly a match?
Either way is fine with me but it needs to be documented either with a > [!NOTE]
or an example in the README.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@FloEdelmann ping
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #7544 (review)
@ybiquitous should we move on and leave the note for later? |
@Mouvedia Good point. I think adding a not is a good idea to reduce people's confusion. In the example you suggested, {
"selector-max-compound-selectors": [2, {"ignoreSelectors": [".bar", ".quz"]}]
} .foo .baz .bar.quz {} it should be considered as: .foo .baz {} /* ".bar" and ".quz" are ignored */ because it seems easier to implement by using the current selector parser ( |
Whatever the statu quo is, I am fine with it; but it needs to have a pass/fail example or a note. |
Although it's not a blocker, I think adding a note in this PR is preferable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Mouvedia I think adding a code example instead of a note is enough, but what do you think?
@FloEdelmann I would like to include this PR in the next version. If you don't have time, I'll push additional commits instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[suggest] I found that we can remove the previousNodeWasCompoundSeparator
variable outside the each
loop by using the index
second argument. As a result, we can put the ignoring code in one if
condition.
@ybiquitous Sorry for not responding. I currently don't have much time to work on this PR, so please go ahead and edit to your liking! |
Either one is fine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pushed additional commits.
@Mouvedia Can you take a look again?
I bumped |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of the changes I have requested are non-blocking.
Feel free to integrate them at your convenience.
LGTM
Thank you for creating and reviewing the pull request! |
Thanks for bringing this over the finish line! |
@ybiquitous we may have missed something apparently. for I would expect the compound selector to not be ignored and hence end up with 3 and the test to fail instead of passing currently. Am i wrong?
to Also even more baffling |
@Mouvedia Thanks, your concern is right. We have to fix the case. The following makes sense to me, so I'll open a follow-up PR soon: .foo .bar > .ignored.qux {}
.foo .bar > .qux.ignored {}
/* considered as ↓ */
.foo .bar > .qux {} |
…s selectors Follow-up to PR #7544 See #7544 (comment) Note that this change doesn't need any changelog item since the `ignoreSelectors` option is unreleased.
Opened follow-up PR #7559 |
Closes #7536.
I don't think ignoring
:not
should also ignore contents of it.