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

Allow ignoreProperties to accept RegExp #45

Closed
terrymun opened this issue Dec 17, 2021 · 2 comments
Closed

Allow ignoreProperties to accept RegExp #45

terrymun opened this issue Dec 17, 2021 · 2 comments

Comments

@terrymun
Copy link

terrymun commented Dec 17, 2021

This is somewhat related to #19, but since v2 has been released, this likely concerns the new ignoreProperties configuration option.

The main use-case if for those using styled-components/emotion, where the use of stylelint-processor-styled-components will insert placeholders in the code, i.e. -styled-mixin0: $dummyValue. The $dummyValue value can be easily ignored by using a regex for ignoreValue config option. However, this isn't the same for the invalid property -styled-mixin0, because the processor appends an incremental number to the end of the property.

This means it is unnecessarily verbose to do this:

"csstree/validator": {
    "ignoreProperties": [
        "-styled-mixin0",
        "-styled-mixin1",
        "-styled-mixin2",
        "-styled-mixin3",
        "-styled-mixin4",
        "-styled-mixin5",
        "-styled-mixin6",
        "-styled-mixin7",
        "-styled-mixin8",
        "-styled-mixin9"
    ],
    "ignoreValue": "\\$dummyValue"
}

And this is not a safe way to fix the issue, since the number is arbitrary. What if we allow ignoreProperties to accept Array<string | RegExp>? By extension, we might want to extend the ignoreValue as well, so that it not only accepts string | RegExp but also Array<string | RegExp>.

I am happy to create a PR for this if necessary: but would love to hear your opinion on this.

@lahmatiy
Copy link
Member

Fixed in 2.1.0

@linusjf
Copy link

linusjf commented Feb 27, 2024

FYI ..
ignoreProperties does not accept a single string. It needs an array of length 1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants