Svelte Eslint Parser screenshot

Svelte Eslint Parser

Author Avatar Theme by Sveltejs
Updated: 18 May 2025
104 Stars

Svelte parser for ESLint

Overview

Svelte-eslint-parser is a parser for ESLint that is specifically designed for Svelte applications. It allows developers to create their own ESLint rules for Svelte and provides unique check rules for template AST. It is used by eslint-plugin-svelte, an ESLint plugin for Svelte, and @intlify/eslint-plugin-svelte, an ESLint plugin for internationalization (i18n) with Svelte.

Features

  • Custom ESLint rules for Svelte
  • Template AST check rules
  • Integration with eslint-plugin-svelte and @intlify/eslint-plugin-svelte

Installation

To install svelte-eslint-parser, follow these steps:

  1. Add the package to your project:
npm install svelte-eslint-parser
  1. Configure the parser in your .eslintrc.* file:
{
  "parserOptions": {
    "parser": "svelte-eslint-parser"
  }
}
  1. Specify the file pattern for the parser using glob patterns or the --ext .svelte CLI option.

Summary

Svelte-eslint-parser is a parser for ESLint that is specifically designed for Svelte applications. It enables the creation of custom ESLint rules for Svelte and provides unique check rules for template AST. It is used by eslint-plugin-svelte and @intlify/eslint-plugin-svelte to enhance the linting capabilities of Svelte applications. The installation and usage of svelte-eslint-parser are straightforward, making it a valuable tool for Svelte developers.