Skip to content

redundant-type-attr

Added in 0.2.9 · Related issues · View source

Fix is always available.

What it does

Checks for redundant type attributes on <script>, <style> and <link rel="stylesheet"> tags.

Why is this bad?

Since HTML5, <script> defaults to type="text/javascript", and <style> and stylesheet <link>s default to type="text/css". Specifying these default values is redundant and adds unnecessary noise.

Example

<script type="text/javascript" src="app.js"></script>
<style type="text/css">.foo { color: red; }</style>
<link rel="stylesheet" type="text/css" href="app.css">

Use instead:

<script src="app.js"></script>
<style>.foo { color: red; }</style>
<link rel="stylesheet" href="app.css">

References