Skip to content

Commit

Permalink
Process multiple spaces in media-feature-parentheses-space-inside (#4513
Browse files Browse the repository at this point in the history
)

* Process multiple spaces in media (#4509)

* Consider tabs as spaces
  • Loading branch information
fanich37 authored and hudochenkov committed Jan 9, 2020
1 parent 1dc203e commit d9dbce2
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
Expand Up @@ -135,6 +135,34 @@ testRule(rule, {
],

reject: [
{
code: '@media ( min-width: 700px) {}',
fixed: '@media (min-width: 700px) {}',
message: messages.rejectedOpening,
line: 1,
column: 9,
},
{
code: '@media (min-width: 700px ) {}',
fixed: '@media (min-width: 700px) {}',
message: messages.rejectedClosing,
line: 1,
column: 26,
},
{
code: '@media (\t min-width: 700px) {}',
fixed: '@media (min-width: 700px) {}',
message: messages.rejectedOpening,
line: 1,
column: 9,
},
{
code: '@media (min-width: 700px\t) {}',
fixed: '@media (min-width: 700px) {}',
message: messages.rejectedClosing,
line: 1,
column: 25,
},
{
code: '@media (max-width: 300px ) {}',
fixed: '@media (max-width: 300px) {}',
Expand Down
4 changes: 2 additions & 2 deletions lib/rules/media-feature-parentheses-space-inside/index.js
Expand Up @@ -39,7 +39,7 @@ function rule(expectation, options, context) {
const len = valueParser.stringify(node).length;

if (expectation === 'never') {
if (node.before === ' ') {
if (/[ \t]/.test(node.before)) {
if (context.fix) node.before = '';

violations.push({
Expand All @@ -48,7 +48,7 @@ function rule(expectation, options, context) {
});
}

if (node.after === ' ') {
if (/[ \t]/.test(node.after)) {
if (context.fix) node.after = '';

violations.push({
Expand Down

0 comments on commit d9dbce2

Please sign in to comment.