Skip to content

stylus/pythonic

enforces pythonic or brace style.

  • ⚙️ This rule is included in "stylelint-stylus/standard". (options: "always")
  • 🔧 The fix option can automatically fix some of the problems reported by this rule.

📖 Rule Details

This rule enforces pythonic or brace style.

🔧 Options

json
{
  "stylus/pythonic": ["always" | "never",
    {
      "atblock": "always" | "never"
    }
  ]
}
  • Primary Option

    • "always" ... Requires pythonic style (i.e. indentation-based).
    • "never" ... Requires brace style.
  • Secondary Option (optional)

    • "atblock" ... Define the style to apply with @block.

"always"

styl
/* stylelint rules config: {"stylus/pythonic": "always"} */
// ✓ GOOD
.foo
  color: red;
bar =
  width: 20px;
  height: 20px;

// ✗ BAD
.foo {
color: red; }
bar = @block {
width: 20px; height: 20px; }

"never"

styl
/* stylelint rules config: {"stylus/pythonic": "never"} */
// ✓ GOOD
.foo {
  color: red;
}
bar = @block {
  width: 20px;
  height: 20px;
}

// ✗ BAD
.foo
color: red;
bar =
width: 20px; height: 20px;

[ "always", { "atblock": "never" } ]

styl
/* stylelint rules config: {"stylus/pythonic": ["always", {"atblock": "never"}]} */
// ✓ GOOD
.foo
  color: red;
bar = @block {
  width: 20px;
  height: 20px;
}
// ✗ BAD
.foo {
color: red; }
bar =
width: 20px; height: 20px;

[ "never", { "atblock": "always" } ]

styl
/* stylelint rules config: {"stylus/pythonic": ["never", {"atblock": "always"}]} */
// ✓ GOOD
.foo {
  color: red;
}
bar =
  width: 20px;
  height: 20px;

// ✗ BAD
.foo
color: red;
bar = @block {
width: 20px; height: 20px; }

📚 Further reading

🔍 Implementation