Performance warn by default astro-doctor/no-blocking-script

no-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