no-unprocessed-script-surprises
Warn when script attributes opt out of Astro script processing.
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
---
---
<script type="module">
console.log('This is not processed by Astro')
</script>Correct
Processed or explicitly inline script
---
---
<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:
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:
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
- no-client-load-overusePrefer client:idle or client:visible over client:load for interactive islands.
- use-astro-imageUse <Image> from astro:assets instead of raw <img> tags.
- require-image-dimensionsRequire dimensions for public and remote astro:assets images.
- no-blocking-scriptDisallow render-blocking <script src="..."> tags — add defer, async, or type="module".