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

How to specify emptyLineBefore to never #8

Open
cenfun opened this issue Jan 6, 2023 · 3 comments
Open

How to specify emptyLineBefore to never #8

cenfun opened this issue Jan 6, 2023 · 3 comments
Assignees

Comments

@cenfun
Copy link

cenfun commented Jan 6, 2023

Thanks for the project.

Currently, the emptyLineBefore default to always. How to specify emptyLineBefore to never? possible reason:

  • emptyLineBefore=always conflicts with rule 'declaration-empty-line-before' in stylelint-config-standard
  • I prefer to emptyLineBefore=never because the count of css properties will less than 5 in most cases, the group emptyLineBefore is not necessary especially using SCSS.

What do you think of following solution

// .stylelintrc.js
const { propertyOrderingWithOptions } = require('stylelint-semantic-groups');

module.exports = {
  plugins: ['stylelint-order'],
  rules: {
    'order/properties-order': propertyOrderingWithOptions({ emptyLineBefore: 'never' })
  },
};

thanks

@theKashey
Copy link
Owner

Approved in principle 👍

I would just rename function into propertyOrderingFactory because selectorOrderFactory already exists or expose pre-constructed propertyOrderingCompact (is there a better word meaning "no spaces"? I have a feeling that it does) because you don't need, and cannot have many options - emptyLine is the single one to change with the rest being "oppionated". Well, there is also unspecified which are better to be kept "where found"

@theKashey theKashey self-assigned this Jan 9, 2023
@alizadeh118
Copy link

As a quick fix I'm using this:

// .stylelintrc.js
const { propertyOrdering } = require('stylelint-semantic-groups');

propertyOrdering[0] = propertyOrdering[0].map(rule => {
    rule.emptyLineBefore = 'never';
    return rule;
});

module.exports = {
  plugins: ['stylelint-order'],
  rules: {
    'order/properties-order': propertyOrdering
  },
};

@cenfun
Copy link
Author

cenfun commented Jun 29, 2023

@alizadeh118 thanks, I have fixed it with following

propertyOrdering.forEach((list) => {
    list.forEach((item) => {
        item.emptyLineBefore = 'never';
    });
});

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