Skip to content
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

Added: selector-max-type rule #2665

Merged
merged 2 commits into from
Jun 26, 2017
Merged

Added: selector-max-type rule #2665

merged 2 commits into from
Jun 26, 2017

Conversation

alexander-akait
Copy link
Member

@alexander-akait alexander-akait commented Jun 21, 2017

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

#2528

Is there anything in the PR that needs further explanation?

No, it's self explanatory.

Need resolve:

  1. html { --foo: 1px; } and html { --custom-property-set: {} } should be rejected? I think yes, because we can have html { --some-here: 1px; --custom-property-set: { color: red; display: block; }; color: red;} Later we can add option ignoreContaintCustom (or best name for this purpose).
  2. After resolve selector some non standard (example scss: @for $n from 1 through 5 { .foo-#{$n} { div { content: \"#{$n}\"; } } }) output error .foo-#{$n} div, it is valid because we contain div, but message is very weird. It is normal or not?

Some tests are commented.

@jeddy3
Copy link
Member

jeddy3 commented Jun 21, 2017

html { --foo: 1px; } and html { --custom-property-set: {} } should be rejected?

Yes, absolutely. Rules should be most restrictive by default (when it comes to standard CSS), and then made more permissive with options. Let's only add a ignoreContaintCustom option if it is requested. I suspect using the existing ignoreTypes: ["html"] option will suffice for most users.

.foo-#{$n} div

Shouldn't this whole selector be ignored by the rule as it's non-standard? We should check that resolved selectors are standard. If not, return early.

@hudochenkov
Copy link
Member

Non-standard selectors should be ignored, and tests for them should be accepted.

@jeddy3
Copy link
Member

jeddy3 commented Jun 26, 2017

@hudochenkov Updated this one.

  • Added a few extra reject tests to be sure the ignore options are working as expected.
  • Fixed test descriptions
  • Updated rule description
  • Added pattern examples

@jeddy3 jeddy3 changed the title WIP: Added: selector-max-type rule Added: selector-max-type rule Jun 26, 2017
@jeddy3 jeddy3 mentioned this pull request Jun 26, 2017
5 tasks
@jeddy3
Copy link
Member

jeddy3 commented Jun 26, 2017

@hudochenkov Once you've approved my commits. I'll squash them and rebase this off master.

@hudochenkov
Copy link
Member

hudochenkov commented Jun 26, 2017

Why we don't ignore non-standard selectors?

.foo-#{$n} div

Shouldn't this whole selector be ignored by the rule as it's non-standard? We should check that resolved selectors are standard. If not, return early.

Non-standard selectors should be ignored, and tests for them should be accepted.

@hudochenkov Oops. I missed that one. Changed.

Copy link
Member

@hudochenkov hudochenkov left a comment

Choose a reason for hiding this comment

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

Good work!

@jeddy3 jeddy3 merged commit bf8e283 into master Jun 26, 2017
@jeddy3 jeddy3 deleted the selector-max-type branch June 26, 2017 17:55
@jeddy3
Copy link
Member

jeddy3 commented Jun 26, 2017

  • Added: selector-max-type rule (#2665).

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.

None yet

3 participants