ESLint Plugin
Under the hood, Astro Doctor is powered by an ESLint plugin: @santi020k/eslint-plugin-astro-doctor. While the CLI and GitHub Action wrap this plugin to provide a health score and easy integration, you can also use the plugin directly in your editor or existing linting pipeline!
Installation
Install the plugin as a development dependency. Its Astro and accessibility rule dependencies are included:
pnpm add -D @santi020k/eslint-plugin-astro-doctornpm install --save-dev @santi020k/eslint-plugin-astro-doctoryarn add -D @santi020k/eslint-plugin-astro-doctorbun add -D @santi020k/eslint-plugin-astro-doctorUsage
Astro Doctor fully supports the new ESLint "flat config" format. Import the plugin and add the recommended config to your eslint.config.js file:
// eslint.config.js
import astroDoctorPlugin from '@santi020k/eslint-plugin-astro-doctor'
export default [
// ...your other configs
astroDoctorPlugin.configs.recommended,
]The recommended config automatically sets up astro-eslint-parser for *.astro files and enables the proprietary rules alongside the official Astro recommended rules.
Presets
recommended— proprietary rules plus official Astro recommended rules.strict— adds official accessibility, security, and best-practice rules.all— all 54 non-deprecated official Astro rules, including stylistic rules.
Astro Doctor deduplicates overlapping checks. The all preset exposes 63 unique ESLint checks rather than reporting the same problem twice.
Customizing Rules
If you are using the ESLint plugin directly, you can override the default severity of any rule just like any other ESLint plugin:
// eslint.config.js
import astroDoctorPlugin from '@santi020k/eslint-plugin-astro-doctor'
export default [
astroDoctorPlugin.configs.recommended,
{
rules: {
// Upgrade this rule to an error
'astro-doctor/no-client-load-overuse': 'error',
// Disable this rule completely
'astro-doctor/prefer-class-list': 'off',
}
}
]Available Rules
To see the full list of rules, what they catch, and how to fix them, check out the Rules Overview.