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 and the Astro parser as development dependencies:

pnpm add -D @santi020k/eslint-plugin-astro-doctor astro-eslint-parser
npm install --save-dev @santi020k/eslint-plugin-astro-doctor astro-eslint-parser
yarn add -D @santi020k/eslint-plugin-astro-doctor astro-eslint-parser
bun add -D @santi020k/eslint-plugin-astro-doctor astro-eslint-parser

Usage

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 all of the Astro Doctor rules with their default severities.

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',
    }
  }
]
Tip: If you are using the Astro Doctor CLI instead of running ESLint directly, you can customize rule severities using a doctor.config.ts file. See the Configuration page.

Available Rules

To see the full list of rules, what they catch, and how to fix them, check out the Rules Overview.