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 regex support to ignoreSelectors option of selector-no-vendor-prefix #6327

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/rotten-onions-occur.md
@@ -0,0 +1,5 @@
---
"stylelint": minor
---

Added: regex support for `ignoreSelectors` option of `selector-no-vendor-prefix`
2 changes: 1 addition & 1 deletion lib/rules/selector-no-vendor-prefix/README.md
Expand Up @@ -43,7 +43,7 @@ input::placeholder {}

## Optional secondary options

### `ignoreSelectors: ["/regex/", "non-regex"]`
### `ignoreSelectors: ["/regex/", /regex/, "non-regex"]`

Ignore vendor prefixes for selectors.

Expand Down
5 changes: 4 additions & 1 deletion lib/rules/selector-no-vendor-prefix/__tests__/index.js
Expand Up @@ -113,7 +113,7 @@ testRule({

testRule({
ruleName,
config: [true, { ignoreSelectors: ['::-webkit-input-placeholder', '/-moz-.*/'] }],
config: [true, { ignoreSelectors: ['::-webkit-input-placeholder', '/-moz-.*/', /-screen$/] }],
fix: true,

accept: [
Expand All @@ -123,6 +123,9 @@ testRule({
{
code: 'input::-moz-placeholder { color: pink; }',
},
{
code: ':-webkit-full-screen a {}',
},
],

reject: [
Expand Down
4 changes: 2 additions & 2 deletions lib/rules/selector-no-vendor-prefix/index.js
Expand Up @@ -7,7 +7,7 @@ const parseSelector = require('../../utils/parseSelector');
const report = require('../../utils/report');
const ruleMessages = require('../../utils/ruleMessages');
const validateOptions = require('../../utils/validateOptions');
const { isString } = require('../../utils/validateTypes');
const { isString, isRegExp } = require('../../utils/validateTypes');

const ruleName = 'selector-no-vendor-prefix';

Expand All @@ -30,7 +30,7 @@ const rule = (primary, secondaryOptions, context) => {
{
actual: secondaryOptions,
possible: {
ignoreSelectors: [isString],
ignoreSelectors: [isString, isRegExp],
},
optional: true,
},
Expand Down