# Astro - [ESLint](#eslint) - [Oxlint](#oxlint)
## ESLint To use ESLint with Astro files, first install the [astro-eslint-parser](https://github.com/ota-meshi/astro-eslint-parser) and optionally [TypeScript ESLint](https://typescript-eslint.io/getting-started). Then, configure ESLint to use this parser for Astro files. ```sh npm i -D astro-eslint-parser typescript-eslint ``` To lint Tailwind CSS classes in Astro files, ensure that: - The `astro-eslint-parser` is installed and configured. - The `typescript-eslint` package is installed if you want to lint TypeScript within Astro files. - The plugin is added to your configuration. - The `settings` object contains the correct Tailwind CSS configuration paths.
### Flat config Read more about the [ESLint flat config format](https://eslint.org/docs/latest/use/configure/configuration-files-new)
```js // eslint.config.js import eslintParserAstro from "astro-eslint-parser"; import eslintPluginBetterTailwindcss from "eslint-plugin-better-tailwindcss"; import { defineConfig } from "eslint/config"; import { parser as eslintParserTypeScript } from "typescript-eslint"; export default defineConfig({ // enable all recommended rules extends: [ eslintPluginBetterTailwindcss.configs.recommended ], // if needed, override rules to configure them individually // rules: { // "better-tailwindcss/enforce-consistent-line-wrapping": ["warn", { printWidth: 100 }] // }, settings: { "better-tailwindcss": { // tailwindcss 4: the path to the entry file of the css based tailwind config (eg: `src/global.css`) entryPoint: "src/global.css", // tailwindcss 3: the path to the tailwind config file (eg: `tailwind.config.js`) tailwindConfig: "tailwind.config.js" } }, files: ["**/*.astro"], languageOptions: { parser: eslintParserAstro, parserOptions: { // optionally use TypeScript parser within for Astro files parser: eslintParserTypeScript } } }); ```

Legacy config


To use ESLint with Astro files using the legacy config, first install the [astro-eslint-parser](https://github.com/ota-meshi/astro-eslint-parser) and optionally [@typescript-eslint/parser](https://typescript-eslint.io/getting-started/legacy-eslint-setup). Then, configure ESLint to use this parser for Astro files. ```sh npm i -D astro-eslint-parser @typescript-eslint/parser ``` To lint Tailwind CSS classes in TypeScript files, ensure that: - The `astro-eslint-parser` is installed and configured. - The `@typescript-eslint/parser` is installed and configured if you want to lint TypeScript within Astro files. - The plugin is added to your configuration. - The `settings` object contains the correct Tailwind CSS configuration paths.
```jsonc // .eslintrc.json { // enable all recommended rules "extends": [ "plugin:better-tailwindcss/legacy-recommended" ], // if needed, override rules to configure them individually // "rules": { // "better-tailwindcss/enforce-consistent-line-wrapping": ["warn", { "printWidth": 100 }] // }, "settings": { "better-tailwindcss": { // tailwindcss 4: the path to the entry file of the css based tailwind config (eg: `src/global.css`) "entryPoint": "src/global.css", // tailwindcss 3: the path to the tailwind config file (eg: `tailwind.config.js`) "tailwindConfig": "tailwind.config.js" } }, "parser": "astro-eslint-parser", "parserOptions": { // optionally use TypeScript parser within for Astro files "parser": "@typescript-eslint/parser" } } ```

## Oxlint Oxlint currently does **not** support Astro files (`.astro`). Framework-specific parsers like Astro are not supported in Oxlint yet, so `eslint-plugin-better-tailwindcss` cannot currently lint Astro templates through Oxlint. You can continue using ESLint for Astro files until Oxlint adds framework parser support.