Skip to main content

Overview

The @zayne-labs/eslint-config provides an opinionated ESLint configuration with sensible defaults and zero-config setup. It works out-of-the-box with TypeScript, JSX, Vue, JSON, YAML, TOML, Markdown, and more.

Key Features

  • One-line setup with reasonable defaults and best practices
  • ESLint Flat config for easy composition
  • Respects .gitignore by default
  • Highly customizable when needed
  • Interactive CLI for easy setup
  • Requires ESLint v9.5.0+ and Node.js v20+

Installation

Legacy Config Migration

If you have existing eslintrc configs, use @eslint/eslintrc to convert them:
import { FlatCompat } from "@eslint/eslintrc";
import { zayne } from "@zayne-labs/eslint-config";

const compat = new FlatCompat();

export default zayne(
  {
    ignores: [],
  },
  ...compat.config({
    extends: [
      "eslint:recommended",
      // Other extends...
    ],
  })
  // Other flat configs...
);
.eslintignore no longer works in flat config. Use the ignores option instead.

IDE Configuration

Configure your editor to auto-fix ESLint issues on save for the best development experience.
1

Install the ESLint extension

Install the ESLint extension from the VS Code marketplace.
2

Configure settings

Create or update .vscode/settings.json in your project:
{
  // Auto fix on save
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": "explicit",
    "source.organizeImports": "never"
  },

  // Enable eslint for all supported languages
  "eslint.validate": [
    "javascript",
    "javascriptreact",
    "typescript",
    "typescriptreact",
    "vue",
    "html",
    "markdown",
    "json",
    "jsonc",
    "yaml",
    "toml",
    "xml",
    "gql",
    "graphql",
    "astro",
    "svelte",
    "css",
    "less",
    "scss",
    "pcss",
    "postcss"
  ]
}
3

Restart VS Code

Reload your VS Code window to apply the changes.

Running ESLint

Once configured, you can run ESLint using the package scripts:
# Check for issues
pnpm lint:eslint

# Fix issues automatically
pnpm lint:eslint-fix

Inspecting Your Configuration

View your active ESLint rules and configuration using the ESLint Config Inspector:
npx @eslint/config-inspector@latest
This opens an interactive UI in your browser showing all enabled rules, their sources, and configurations.

Next Steps

Customize Rules

Learn how to customize rules and override defaults

Framework Setup

Configure ESLint for React, Vue, Svelte, and more

Build docs developers (and LLMs) love