An ESLint plugin for linting Astro components. Version 1.7.0 is the latest stable release, with active development and releases roughly monthly. It lints frontmatter, HTML templates, JSX-like expressions, client-side scripts, and directives. Supports both flat config (eslint.config.js) and legacy config (.eslintrc). Ships TypeScript types. Requires eslint >=8.57.0 and Node.js ^18.18.0 || ^20.9.0 || >=21.1.0. Differentiators: official AST-based parsing for Astro, rules for sort-attributes, no-unsafe-inline-scripts, and no-prerender-export-outside-pages. Community-maintained by ota-meshi.
npm install eslint-plugin-astroVerified import paths — ran on the pinned version, not inferred.
Shows flat config setup with recommended Astro rules and TypeScript integration.
For flat config: import eslintPluginAstro from 'eslint-plugin-astro' and spread configs. For legacy: use 'extends': ['plugin:astro/recommended'].
Use import syntax (ESM). If you must use require, install an older version (e.g., 0.x).
Review rule documentation and migrate to recommended replacements.
Install @typescript-eslint/parser and include it in parser options for .astro files.
Install eslint-plugin-jsx-a11y or disable the A11Y rules.
npm install --save-dev eslint-plugin-astro (ESM). If using require(), switch to import or downgrade to 0.x.
Upgrade eslint-plugin-astro to >=1.4.0: npm install eslint-plugin-astro@latest
Use the plugin's bundled parser: in flat config, include eslintPluginAstro.configs.recommended. In legacy config, set 'parser': 'astro-eslint-parser'.
Ensure you are spreading an array: ...eslintPluginAstro.configs['flat/recommended'] (or check version).