Skip to main content

attr-bans

Specify a list of disallowed HTML attributes.

Options

The rule accept the following formats as configuration:

  • ["array", "of", "unwanted", "attributes"]
  • "attributes"
  • /regex/
  • [/regex/]

By default the rule disallow the following attibutes:

[
"align",
"background",
"bgcolor",
"border",
"frameborder",
"longdesc",
"marginwidth",
"marginheight",
"scrolling",
"style",
"width"
]

Given the default value, the following patterns are considered violations:

  <p center>Content</p>
  <div bgcolor="red">Content</p>

The following patterns are not considered violations:

  <p class="text-center">Content</p>