Brackets in stylus

174 Views Asked by At

Is it possible to make automate formatting of stylus and save brackets using stylelint and prettier? So main problem I have is that while I formating some file, all brackets are deleting from .styl files. I want to make curly brackets required to make it more similar to css.

My stylelint file

module.exports = {
  extends: ['stylelint-stylus/standard', 'stylelint-config-prettier'],
  plugins: [
    // add this plugin here:
    'stylelint-stylus',
  ],
  // makes the stylus files parseable.
  overrides: [
    {
      files: [
        'utils/Alphapet/**/*.{css,styl,stylus}',
        'patterns/Alphapet/**/*.{css,styl,stylus}',
      ],
      customSyntax: 'postcss-styl',
    },
  ],
  rules: {
    // add rules settings here, such as:
    'stylus/declaration-colon': 'always',
    'stylus/selector-list-comma': 'never',
    'stylus/semicolon': 'always',
    'stylus/single-line-comment': 'always',
    'stylus/single-line-comment-double-slash-space-after': 'always',
    'stylus/media-feature-colon': 'always',
    'no-missing-end-of-source-newline': true,
  },
}

versions

  "dependencies": {
    "stylus": "^0.54.8",
  },
  "devDependencies": {
    "prettier": "^2.2.1",
    "stylelint": "^14.9.1",
    "stylelint-config-prettier": "^9.0.3",
    "stylelint-stylus": "^0.16.1",
  }
1

There are 1 best solutions below

0
Андрій Павленко On

the solution is to add

rules: {
  'stylus/pythonic': 'never',
},

into your stylelint.config.js file. In this case it will always add brackets in your .styl files