Performancewarn by default
astro-doctor/no-blocking-scriptno-blocking-script
Disallow render-blocking <script src="..."> tags — add defer, async, or type="module".
Why
A <script src="..."> without defer, async, or type="module" blocks HTML parsing until the script downloads and executes. This delays the First Contentful Paint and Time to Interactive. Adding defer preserves execution order; async fires as soon as the script downloads; type="module" is always deferred.
Examples
Incorrect
Render-blocking script tag
---
---
<html lang="en">
<head>
<script src="/analytics.js"></script>
</head>
</html>Correct
Non-blocking script with defer
---
---
<html lang="en">
<head>
<!-- defer — preserves execution order, non-blocking -->
<script src="/analytics.js" defer></script>
<!-- async — fires as soon as downloaded, order not guaranteed -->
<script src="/widget.js" async></script>
<!-- type="module" is always deferred -->
<script src="/app.js" type="module"></script>
</head>
</html>Configuration
Override the default severity in your ESLint config:
// eslint.config.js
import astroDoctorPlugin from '@santi020k/eslint-plugin-astro-doctor'
export default [
astroDoctorPlugin.configs.recommended,
{
rules: {
'astro-doctor/no-blocking-script': 'error', // or 'warn' or 'off'
},
},
]Or in your doctor.config.ts:
export default {
rules: {
'astro-doctor/no-blocking-script': 'error',
},
}All rules
astro-doctor/no-client-load-overuseastro-doctor/use-astro-imageastro-doctor/require-image-dimensionsastro-doctor/no-missing-altastro-doctor/no-set-htmlastro-doctor/no-public-secret-envastro-doctor/prefer-class-listastro-doctor/no-blocking-script(this page)astro-doctor/no-unprocessed-script-surprisesastro-doctor/no-missing-langastro-doctor/require-island-fallbackastro-doctor/no-process-envastro-doctor/prefer-content-collectionsastro-doctor/no-disabled-origin-checkastro-doctor/no-insecure-session-cookieastro-doctor/no-open-allowed-domainsastro-doctor/prefer-env-schemaastro-doctor/prefer-pnpmastro-doctor/require-action-input-schemaastro-doctor/require-client-router-script-lifecycleastro-doctor/require-content-config