prettier/stylelint-prettier

conflict with Stylelint: Expected empty line before at-rule (at-rule-empty-line-before)

adenisovgit opened this issue · 1 comments

I have a conflict with "at-rule-empty-line-before" rule.
it was said here that this problem is solved and Prettier should respect this rule, but it didn't or I'm missing somethig.

** "prettier": "^2.0.5",
"stylelint": "^13.3.3",
"stylelint-prettier": "^1.1.2",
**
.stylelintrc.js

module.exports = {
  "extends": [
    'stylelint-prettier/recommended',
  ],  plugins: ['stylelint-scss', 'stylelint-order', 'stylelint-prettier'],
  rules: {
    // 'string-quotes': 'single',
    'at-rule-empty-line-before': [
      'always',
      {
        except: ['after-same-name'],
        ignore: ['after-comment'],
      },
    ],
    'prettier/prettier': true,
  },
};

This is after Prettier formatting.
image

If I follow the rule and add empty line I got an error from Prettier

How to solve this problem?

You shouldn't enable stylelint rules that conflict with prettier. This is because prettier's ethos is that prettier should handle code formatting, while linters should handle code quality.

You should disable that rule. You can use https://github.com/prettier/stylelint-config-prettier to disable all rules that would conflict with prettier. That package also provides a helper tool that lets you identify any rules that you currently have enabled that would conflict with prettier's styling.