@santi020k/eslint-plugin-astro-doctor
v1.3.2
Published
ESLint plugin for Astro Doctor: diagnose Astro codebases for performance, accessibility, security, and best-practice issues
Maintainers
Readme
@santi020k/eslint-plugin-astro-doctor
ESLint plugin for Astro Doctor — Astro-specific rules for performance, accessibility, security, and best practices.
Install
pnpm add -D @santi020k/eslint-plugin-astro-doctorUsage
Presets
// eslint.config.js
import astroDoctorPlugin from '@santi020k/eslint-plugin-astro-doctor'
export default [
astroDoctorPlugin.configs.recommended,
// astroDoctorPlugin.configs.strict,
// astroDoctorPlugin.configs.all,
]recommendedenables the 13 proprietary rules plus the official Astro recommended rules.strictadds official accessibility, security, and best-practice rules.allenables every non-deprecated official Astro rule, including stylistic rules.
Overlapping checks are automatically disabled so a problem is reported once. The all preset provides 63 unique ESLint checks: 13 proprietary rules plus 54 upstream rules, minus four overlaps.
Manual config
// eslint.config.js
import astroDoctorPlugin from '@santi020k/eslint-plugin-astro-doctor'
import * as astroParser from 'astro-eslint-parser'
export default [
{
files: ['**/*.astro'],
plugins: { 'astro-doctor': astroDoctorPlugin },
languageOptions: { parser: astroParser },
rules: {
'astro-doctor/no-client-load-overuse': 'warn',
'astro-doctor/use-astro-image': 'warn',
'astro-doctor/require-image-dimensions': 'warn',
'astro-doctor/no-blocking-script': 'warn',
'astro-doctor/no-unprocessed-script-surprises': 'warn',
'astro-doctor/no-missing-alt': 'error',
'astro-doctor/no-missing-lang': 'error',
'astro-doctor/require-island-fallback': 'warn',
'astro-doctor/no-public-secret-env': 'warn',
'astro-doctor/no-set-html': 'warn',
'astro-doctor/prefer-class-list': 'warn',
'astro-doctor/no-process-env': 'warn',
'astro-doctor/prefer-content-collections': 'warn',
},
},
]With @santi020k/eslint-config-basic
If your project already uses @santi020k/eslint-config-basic, Astro Doctor integrates directly:
// eslint.config.js
import { defineConfig } from '@santi020k/eslint-config-basic'
import astroDoctorPlugin from '@santi020k/eslint-plugin-astro-doctor'
export default await defineConfig({
frameworks: { astro: true },
}, astroDoctorPlugin.configs.recommended)Proprietary Rules
| Rule | Category | Default |
| ---- | -------- | ------- |
| no-client-load-overuse | performance | ⚠️ warn |
| use-astro-image | performance | ⚠️ warn |
| require-image-dimensions | performance | ⚠️ warn |
| no-blocking-script | performance | ⚠️ warn |
| no-unprocessed-script-surprises | performance | ⚠️ warn |
| no-missing-alt | accessibility | ❌ error |
| no-missing-lang | accessibility | ❌ error |
| require-island-fallback | accessibility | ⚠️ warn |
| no-public-secret-env | security | ⚠️ warn |
| no-set-html | security | ⚠️ warn |
| prefer-class-list | best-practices | ⚠️ warn |
| no-process-env | best-practices | ⚠️ warn |
| prefer-content-collections | best-practices | ⚠️ warn |
See Also
- Full documentation
@santi020k/astro-doctor— the CLI- Inspired by react-doctor by Million Software, Inc
License
MIT — santi020k
