npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@jmlweb/eslint-config-astro

v1.0.9

Published

ESLint configuration for Astro projects with TypeScript. Extends @jmlweb/eslint-config-base with Astro-specific rules.

Readme

@jmlweb/eslint-config-astro

npm version License: MIT Node.js ESLint TypeScript Astro

ESLint configuration for Astro projects with TypeScript. Extends @jmlweb/eslint-config-base with Astro-specific rules and best practices for .astro files.

✨ Features

  • 🔒 Strict Type Checking: Inherits all strict TypeScript rules from base config
  • 🚀 Astro Support: Enforces Astro-specific rules and patterns
  • 📝 Astro File Handling: Proper linting for .astro files
  • 📦 Import Management: Enforces type-only imports with inline style + automatic sorting
  • 🎯 Code Quality: Prevents common Astro pitfalls and anti-patterns
  • 🎨 Prettier Integration: Disables all ESLint rules that conflict with Prettier
  • 🚀 Flat Config: Uses ESLint 9+ flat config format (latest stable)

📦 Installation

pnpm add -D @jmlweb/eslint-config-astro eslint @eslint/js typescript-eslint eslint-config-prettier eslint-plugin-astro eslint-plugin-simple-import-sort @jmlweb/eslint-config-base

💡 Upgrading from a previous version? See the Migration Guide for breaking changes and upgrade instructions.

🚀 Quick Start

Create an eslint.config.js file in your project root:

import astroConfig from '@jmlweb/eslint-config-astro';

export default [
  ...astroConfig,
  // Add your project-specific overrides here
];

💡 Examples

Basic Setup

// eslint.config.js
import astroConfig from '@jmlweb/eslint-config-astro';

export default [...astroConfig];

With Project-Specific Overrides

// eslint.config.js
import astroConfig from '@jmlweb/eslint-config-astro';

export default [
  ...astroConfig,
  {
    files: ['**/*.test.ts', '**/*.test.astro'],
    rules: {
      // Allow any in tests
      '@typescript-eslint/no-explicit-any': 'off',
      // Allow console in tests
      'no-console': 'off',
    },
  },
  {
    ignores: ['dist/', '.astro/', 'node_modules/', '*.config.ts'],
  },
];

With Custom Astro Settings

// eslint.config.js
import astroConfig from '@jmlweb/eslint-config-astro';

export default [
  ...astroConfig,
  {
    files: ['**/*.astro'],
    rules: {
      // Customize Astro-specific rules
      'astro/no-conflict-set-directives': 'error',
      'astro/no-unused-define-vars-in-style': 'warn',
    },
  },
];

📋 Configuration Details

Astro Files

This configuration applies Astro-specific rules to:

  • **/*.astro - Astro component files

TypeScript Files

TypeScript rules are also applied to:

  • **/*.ts - TypeScript files
  • **/*.tsx - TypeScript React files (if used in Astro project)

Key Rules Enforced

| Rule | Level | Description | | -------------------------------------- | ------- | ----------------------------------- | | astro/no-conflict-set-directives | error | Prevents conflicting set directives | | astro/no-unused-define-vars-in-style | warn | Warns about unused CSS variables | | simple-import-sort/imports | error | Enforces import sorting | | simple-import-sort/exports | error | Enforces export sorting |

What's Included

  • ✅ All TypeScript ESLint rules from @jmlweb/eslint-config-base
  • ✅ Astro recommended rules from eslint-plugin-astro
  • ✅ Proper handling of .astro files with TypeScript parser
  • ✅ Automatic import/export sorting
  • ✅ Prettier conflict resolution

🔄 Import Sorting

The configuration automatically sorts imports and enforces type-only imports:

Before:

import { Component } from './component';
import type { User } from './types';
import fs from 'fs';

After auto-fix:

import fs from 'fs';
import type { User } from './types';
import { Component } from './component';

Fix import order automatically:

pnpm exec eslint --fix .

🤔 Why Use This?

Philosophy: Astro components should follow Astro's mental model - islands of interactivity with server-first rendering.

This package extends the base TypeScript config with Astro-specific rules that enforce best practices for .astro files, prevent common pitfalls with Astro's unique component model, and ensure proper usage of Astro directives.

Design Decisions

Astro Plugin (eslint-plugin-astro): Enforces Astro-specific rules and patterns

  • Why: Astro has a unique component format that blends frontmatter, markup, and optional client-side interactivity. The plugin catches misuse of directives, style conflicts, and component structure issues
  • Trade-off: Additional rules specific to Astro, but prevents framework-specific bugs
  • When to override: When you have a legitimate reason to deviate from Astro conventions (rare)

Astro File Support: Properly lints .astro files with awareness of their structure

  • Why: .astro files have three sections (frontmatter, template, style) that need different parsing. Standard linters don't understand this format
  • Trade-off: None - this is essential for Astro development
  • When to override: Never - Astro files require Astro-aware linting

Extends Base TypeScript Config: Inherits all strict type checking rules for TypeScript in frontmatter

  • Why: Astro components often contain complex TypeScript logic in frontmatter. Strict typing catches bugs early
  • Trade-off: More verbose frontmatter code, but prevents runtime errors
  • When to override: Follow the same guidelines as the base TypeScript config

🎯 When to Use

Use this configuration when you want:

  • ✅ Astro project development with TypeScript
  • ✅ Maximum type safety with Astro
  • ✅ Strict code quality standards for Astro code
  • ✅ Consistent Astro patterns across the team
  • ✅ Prevention of common Astro pitfalls

For non-Astro TypeScript projects, use @jmlweb/eslint-config-base instead.

For React projects, use @jmlweb/eslint-config-react instead.

🔧 Extending the Configuration

You can extend or override the configuration for your specific needs:

import astroConfig from '@jmlweb/eslint-config-astro';

export default [
  ...astroConfig,
  {
    files: ['**/*.test.ts', '**/*.test.astro'],
    rules: {
      // Test-specific rules
      '@typescript-eslint/no-explicit-any': 'off',
    },
  },
  {
    ignores: ['dist/', '.astro/', 'node_modules/'],
  },
];

📝 Usage with Scripts

Add linting scripts to your package.json:

{
  "scripts": {
    "lint": "eslint .",
    "lint:fix": "eslint . --fix"
  }
}

Then run:

pnpm lint      # Lint all files
pnpm lint:fix  # Fix auto-fixable issues

📋 Requirements

  • Node.js >= 20.11.0 (required for import.meta.dirname in config files)
  • ESLint >= 9.0.0 (flat config format)
  • TypeScript project with tsconfig.json
  • Astro >= 4.0.0
  • TypeScript project service enabled (automatic with this config)

📦 Peer Dependencies

This package requires the following peer dependencies:

  • eslint (^9.0.0)
  • @eslint/js (^9.0.0)
  • typescript-eslint (^8.0.0)
  • eslint-config-prettier (^9.1.0)
  • eslint-plugin-astro (^1.5.0)
  • eslint-plugin-simple-import-sort (^12.0.0)
  • @jmlweb/eslint-config-base (^2.0.2)

🔗 Related Packages

Internal Packages

External Tools

🔄 Migration Guide

Upgrading to a New Version

Note: If no breaking changes were introduced in a version, it's safe to upgrade without additional steps.

No breaking changes have been introduced yet. This package follows semantic versioning. When breaking changes are introduced, detailed migration instructions will be provided here.

For version history, see the Changelog.

Need Help? If you encounter issues during migration, please open an issue.

📜 Changelog

See CHANGELOG.md for version history and release notes.

📄 License

MIT