Skip to content

script-type

Reports a <script> whose type is a JavaScript MIME type (text/javascript, application/javascript, …) or empty. type="module" and other types are not reported.

The browser assumes that type, so the attribute says nothing and is only more text.

To fix, remove the type.

Reported
<!DOCTYPE html>
<title>x</title>
<script type="text/javascript"></script>
<script type="module"></script>
<script></script>
...
angular:
lint:
rules:
script-type: warn # off (default), warn, error
html:
lint:
rules:
script-type: warn # off (default), warn, error
svelte:
lint:
rules:
script-type: warn # off (default), warn, error
vue:
lint:
rules:
script-type: warn # off (default), warn, error

Enabled by the presets: html/html-validate-recommended.

Suppress one line with sudsy-disable-next-line script-type in a comment of the file’s language.

The same check in other tools. full: Sudsy reports what the upstream rule reports; partial: only part of it, as the last column says.

Tool Rule Match What differs
html-validate script-type partial the JavaScript MIME types and an empty type; the allowed module and importmap types are not special