Skip to contentView the source on GitHub

no-unprocessed-script-surprises

Warn when script attributes opt out of Astro script processing.

Performancewarning by default ESLint rule

astro-doctor/no-unprocessed-script-surprises

Why it matters

Astro bundles, deduplicates, TypeScript-processes, and may inline scripts with no attributes other than src. Unexpected attributes such as type, defer, async, or data-* opt out of that pipeline. Explicit is:inline scripts and JSON-LD data scripts are accepted because their processing opt-out is intentional.

See the difference

Incorrect

Accidentally unprocessed script

astroIncorrect example
---
---
<script type="module">
  console.log('This is not processed by Astro')
</script>

Correct

Processed or explicitly inline script

astroCorrect example
---
---
<script>
  console.log('Bundled, deduped, and processed by Astro')
</script>

<script is:inline>
  document.documentElement.dataset.theme = 'dark'
</script>

Configure this check

Override the default severity in your ESLint config:

javascripteslint.config.js
import astroDoctorPlugin from '@santi020k/eslint-plugin-astro-doctor'

export default [
  astroDoctorPlugin.configs.recommended,
  {
    rules: {
      'astro-doctor/no-unprocessed-script-surprises': 'error',
    },
  },
]

Or set the severity for CLI scans in doctor.config.ts:

typescriptdoctor.config.ts
export default {
  rules: {
    'astro-doctor/no-unprocessed-script-surprises': 'error',
  },
}

Use 'error', 'warn', or 'off'. The configuration guide covers presets and per-file overrides.

Keep exploring performance

Browse every rule and project audit