Skip to content

Latest commit

 

History

History
102 lines (80 loc) · 2 KB

hash-object-property-comma.md

File metadata and controls

102 lines (80 loc) · 2 KB

stylus/hash-object-property-comma

require or disallow commas in hash object properties.

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

📖 Rule Details

This rule require or disallow commas in hash object properties.

🔧 Options

{
  "stylus/hash-object-property-comma": ["always" | "never",
    {
      "trailing": "always" | "never"
    }
  ]
}
  • Primary Option

    • "always" ... Requires comma.
    • "never" ... Disallows comma.
  • Secondary Option (optional)

    • "trailing" ... Defines the style apply to the trailing comma.

"always"

/* stylelint rules config: {"stylus/hash-object-property-comma": "always"} */
// ✓ GOOD
foo = {
  bar: baz,
  baz: raz,
}
foo = { bar: baz, baz: raz, }

// ✗ BAD
foo = {
  bar: baz
  baz: raz
}
foo = { bar: baz, baz: raz }

"never"

/* stylelint rules config: {"stylus/hash-object-property-comma": "never"} */
// ✓ GOOD
foo = {
  bar: baz
  baz: raz
}
foo = { bar: baz, baz: raz }

// ✗ BAD
foo = {
  bar: baz,
  baz: raz
}
foo = { bar: baz, baz: raz, }

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

/* stylelint rules config: {"stylus/hash-object-property-comma": ["always", { "trailing": "never" }]} */
// ✓ GOOD
foo = {
  bar: baz,
  baz: raz
}
foo = { bar: baz, baz: raz }

// ✗ BAD
foo = {
  bar: baz
  baz: raz
}
foo = {
  bar: baz,
  baz: raz,
}
foo = { bar: baz, baz: raz, }

📚 Further reading

🔍 Implementation