Skip to content

False alarm of 'disallowSpacesInsideAttributeBrackets' for multiline statements #181

Open
@TokugawaTakeshi

Description

@TokugawaTakeshi

Documentation:

Disallows space after opening attribute bracket and before closing.

//- Invalid
input( type='text' name='name' value='value' )

//- Valid
input(type='text' name='name' value='value')

If the rule disallowSpacesInsideAttributeBrackets aims on multiline declarations too, it's not obvious.

Live example:

mixin AttentionBox(propertiesObject)

  include AttentionBox-ComponentPropertiesSpecification

  -
    const {
      semanticType,
      CSS_Namespace,
      hasDefaultPrependedSVG_Icon,
      hasDismissButton
    } = MixinParametersValidator.getValidatedParameters(propertiesObject, AttentionBoxComponentPropertiesSpecification);

  div&attributes(attributes)(
    class= CSS_Namespace
    class= `${CSS_Namespace}${BEM_MODIFIER_SEPARATOR}${AttentionBox.SemanticTypesCSS_Modifiers[semanticType]}`
    role="alert"
  )

    if hasDefaultPrependedSVG_Icon
      svg(class=`${CSS_Namespace}${BEM_ELEMENT_SEPARATOR}PrependedSVG_Icon` viewBox="0 0 24 24")
        case semanticType
          when AttentionBox.SemanticTypes.importantInfo
            path(
              d="M13,13H11V7H13M13,17H11V15H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z"
            )
          when AttentionBox.SemanticTypes.secondaryInfo
            path(d="M13 14H11V9H13M13 18H11V16H13M1 21H23L12 2L1 21Z")
          when AttentionBox.SemanticTypes.error
            path(
              d="M13,13H11V7H13M13,17H11V15H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z"
            )
          when AttentionBox.SemanticTypes.warning
            path(d="M13 14H11V9H13M13 18H11V16H13M1 21H23L12 2L1 21Z")

image

I tried that

            path(
              d="M13,13H11V7H13M13,17H11V15H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z"
)

is a valid Pug syntax, but subjectively it makes code formatting ugly. I don't think that everyone wants this rule warn for multiline statements...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions