Skip to content

no empty line after at-rule include #122

Open
@iztsv

Description

Hello!

I have the following config and dependencies:

"stylelint": "^13.6.1"
"stylelint-order": "^4.1.0",
"stylelint-scss": "^3.18.0"
module.exports = {
  plugins: ['stylelint-scss', 'stylelint-order'],
  rules: {
    'order/order': [
      [
        'custom-properties',
        'at-variables',
        'dollar-variables',
        {
          type: 'at-rule',
          name: 'include',
          hasBlock: false
        },
        'declarations',
        'rules',
        {
          type: 'at-rule',
          name: 'include',
          hasBlock: true
        }
      ]
    ],
    'order/properties-order': [
      [
        {
          emptyLineBefore: 'always',
          noEmptyLineBetween: true,
          properties: ['z-index', 'display']
        },
        {
          emptyLineBefore: 'always',
          noEmptyLineBetween: true,
          properties: ['font-weight', 'text-align']
        }
      ],
      {
        unspecified: 'bottom',
        emptyLineBeforeUnspecified: 'always'
      }
    ],
    'comment-empty-line-before': [
      'always',
      {
        except: ['first-nested'],
        ignore: ['stylelint-commands']
      }
    ],
    'custom-property-empty-line-before': [
      'always',
      {
        except: ['after-custom-property', 'first-nested'],
        ignore: ['after-comment', 'inside-single-line-block']
      }
    ],
    'rule-empty-line-before': [
      'always',
      {
        except: ['first-nested', 'after-rule'],
        ignore: ['after-comment']
      }
    ],
    'at-rule-empty-line-before': [
      'always',
      {
        except: ['after-same-name', 'first-nested'],
        ignore: ['after-comment']
      }
    ]
  }
};

and index.scss:

.test {


  display: block;
  text-align: left;

  @media screen {
    //
  }
  span {
    color: red;
  }
  /* comment1 */
  @include with-block() {
    // ...
  }

  font-weight: bold;
  z-index: 1;
  /* comment3 */
  @include no-block();
}

after lint with autofix I expect:

.test {
  /* comment3 */
  @include no-block();

  z-index: 1;
  display: block;

  font-weight: bold;
  text-align: left;

  span {
    color: red;
  }

  /* comment1 */
  @include with-block() {
    // ...
  }

  @media screen {
    //
  }
}

but get (no empty line after @include no-block();):

.test {
  /* comment3 */
  @include no-block();
  z-index: 1;
  display: block;

  font-weight: bold;
  text-align: left;

  span {
    color: red;
  }

  /* comment1 */
  @include with-block() {
    // ...
  }

  @media screen {
    //
  }
}

if I add

'declaration-empty-line-before': ['always', {
    	except: ['first-nested', 'after-comment', 'after-declaration'],
    }]

the result will be (no empty line between declarations groups):

.test {
  /* comment3 */
  @include no-block();

  z-index: 1;
  display: block;
  font-weight: bold;
  text-align: left;

  span {
    color: red;
  }

  /* comment1 */
  @include with-block() {
    // ...
  }

  @media screen {
    //
  }
}

Is the problem in my configuration or it's problem in stylelint-order?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions