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

Add ignoreProperties option to value-keyword-case rule #2937

Merged

Conversation

Bilie
Copy link
Member

@Bilie Bilie commented Oct 2, 2017

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

#2424

Is there anything in the PR that needs further explanation?

No, it's self explanatory.

Copy link
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.

@Bilie Thank you very much for your first contribution. It's looking good.

The ignore* secondary options can usually accept regular expressions as well. I've made a couple of requests for this. Please don't hesitate to ask any questions you might have.

@@ -164,6 +166,10 @@ const rule = function(expectation, options) {
return;
}

if (ignoreProperties.length > 0 && ignoreProperties.includes(prop)) {
Copy link
Member

Choose a reason for hiding this comment

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

Please use the matchesStringOrRegExp util instead of .includes, like we do on this line. This will:

  1. Allow the option to accept regular expressions.
  2. Address the failing node@4 tests, as node@4 doesn't support .includes.

@@ -1938,3 +1938,79 @@ testRule(rule, {
}
]
});

testRule(rule, {
Copy link
Member

Choose a reason for hiding this comment

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

Please include a couple of regular expression tests, like we do for the ignoreKeywords option.


For example, with `"lower"`.

```js
Copy link
Member

Choose a reason for hiding this comment

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

Please include some regular expression examples we do here for the ignoreKeywords option.

Also, can you please move the docs for this option above the ignoreKeywords option, as options should be listed alphabetically.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hi, thank you very much for your feedback! I was not sure if the new option should be called ignoreProperties or ignoreCustomProperties. Currently it is named ignoreProperties. Should it still go above ignoreKeywords in the readme or should I rename it to ignoreCustomProperties? Thank you!

Copy link
Member

Choose a reason for hiding this comment

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

It should be called ignoreProperties. Custom properties are something different entirely in CSS. There might come a time when a user requests an ignoreCustomProperties option but that would be for the following example:

"value-keyword-case": ["lower", { ignoreCustomProperties: ["brand-color"] }]
:root {
  --brand-color: myMadeUPKeYwOrDColor;
}

However, for what you're trying to achieve in this PR, ignoreProperties is the correct name.

Copy link
Member

Choose a reason for hiding this comment

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

Also, can you please move the docs for this option above the ignoreKeywords option, as options should be listed alphabetically.

Whoops, I just realised my mistake here... K is before P in the alphabet... silly me. I can see why you were asking about custom properties now.

Copy link
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.

@Bilie Thanks for incorporating my requests. It's looking good and almost there.

I've one or two more minor requests.

```css
a {
display: bloCk;
},
Copy link
Member

Choose a reason for hiding this comment

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

Extra comma

```

```css
div {
Copy link
Member

Choose a reason for hiding this comment

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

  1. Remove indent, please.
  2. Use the a selector, as per these guidelines.

}
```

```css
Copy link
Member

Choose a reason for hiding this comment

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

  1. Remove indent, please.
  2. Use the a selector, as per these guidelines.

code: "a { display: block; }"
},
{
code: "div { background: Red; }"
Copy link
Member

Choose a reason for hiding this comment

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

Use a rather than div for consistency please, otherwise a future maintainer might think the different selector is significant to the test when it is not.

code: "div { background: Red; }"
},
{
code: "div { Background: deepPink; }"
Copy link
Member

Choose a reason for hiding this comment

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

Don't forget these last two divs please :)

Copy link
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 all the changes. This LGTM :)

(Note: Once this PR is in, I believe it should be refactored to use the optionsMatches util as so

@jeddy3 jeddy3 mentioned this pull request Oct 5, 2017
6 tasks
@jeddy3 jeddy3 merged commit 3457b84 into stylelint:master Oct 5, 2017
@jeddy3
Copy link
Member

jeddy3 commented Oct 5, 2017

  • Added: ignoreProperties option to value-keyword-case (#2937).

@jeddy3
Copy link
Member

jeddy3 commented Oct 5, 2017

@Bilie Thanks again for your first-time contribution. Your new option was just released in stylelint@8.2.0

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