no-legacy-astro-7-experimental-flags
Migrate experimental configuration fields removed or stabilized in Astro 7.
astro-doctor/no-legacy-astro-7-experimental-flags
Why it matters
Astro 7 removed the experimental wrappers for advanced routing, caching, logging, route rules, queued rendering, and the Rust compiler. Leaving these fields under experimental can make an upgrade fail validation or silently miss the intended configuration.
See the difference
Incorrect
Astro 6 experimental configuration
export default defineConfig({
experimental: {
advancedRouting: true,
cache: { provider: memoryCache() },
routeRules: {},
rustCompiler: true,
},
})Correct
Astro 7 stable configuration
export default defineConfig({
cache: { provider: memoryCache() },
routeRules: {},
})Configure this check
Project audits are configured in doctor.config.ts:
export default {
rules: {
'astro-doctor/no-legacy-astro-7-experimental-flags': 'error',
},
}Use 'error', 'warn', or 'off'. The configuration guide covers presets and per-file overrides.
Keep exploring best practices
- prefer-class-listUse class:list directive for conditional or dynamic class names.
- no-process-envDisallow process.env in Astro files — use import.meta.env instead.
- prefer-content-collectionsPrefer Content Collections over Astro.glob() or import.meta.glob() for Markdown and MDX files.
- prefer-env-schemaDefine an Astro env schema for variables documented in .env.example.
- prefer-pnpmUse pnpm consistently and remove competing package-manager lockfiles.
- require-client-router-script-lifecycleInitialize scripts on astro:page-load when using ClientRouter.
- require-content-configAdd a content config when src/content contains entries.
- require-fetch-default-exportRequire a default export from Astro 7 advanced-routing entrypoints.