[](https://www.npmjs.com/package/svelte-eslint-parser)
[](https://www.npmjs.com/package/svelte-eslint-parser)
[](http://www.npmtrends.com/svelte-eslint-parser)
[](http://www.npmtrends.com/svelte-eslint-parser)
[](http://www.npmtrends.com/svelte-eslint-parser)
[](http://www.npmtrends.com/svelte-eslint-parser)
[](http://www.npmtrends.com/svelte-eslint-parser)
[](https://github.com/sveltejs/svelte-eslint-parser/actions?query=workflow%3ACI)
[](https://coveralls.io/github/sveltejs/svelte-eslint-parser?branch=main)
# svelte-eslint-parser
## [Svelte](https://svelte.dev/) parser for [ESLint](https://eslint.org/)
[Live DEMO](https://sveltejs.github.io/svelte-eslint-parser/playground) •
[Discord](https://svelte.dev/chat)
## Motivation
The `svelte-eslint-parser` aims to make it easy to create your own ESLint rules for [Svelte](https://svelte.dev/).
[eslint-plugin-svelte](https://github.com/sveltejs/eslint-plugin-svelte) is an ESLint plugin built upon this parser, and it already [implements some rules](https://sveltejs.github.io/eslint-plugin-svelte/rules/).
### ESLint Plugins Using svelte-eslint-parser
#### [eslint-plugin-svelte](https://sveltejs.github.io/eslint-plugin-svelte/)
ESLint plugin for Svelte.
Provides a variety of template-based checks using the Svelte AST.
#### [@intlify/eslint-plugin-svelte](https://github.com/intlify/eslint-plugin-svelte)
ESLint plugin for internationalization (i18n) in Svelte applications, offering helpful i18n-related rules.
---
## Installation
```bash
npm install --save-dev eslint svelte-eslint-parser
```
---
## Usage
### ESLint Config (`eslint.config.js`)
```js
import js from "@eslint/js";
import svelteParser from "svelte-eslint-parser";
export default [
js.configs.recommended,
{
files: [
"**/*.svelte",
"*.svelte",
// Need to specify the file extension for Svelte 5 with rune symbols
"**/*.svelte.js",
"*.svelte.js",
"**/*.svelte.ts",
"*.svelte.ts",
],
languageOptions: {
parser: svelteParser,
},
},
];
```
### CLI
```bash
eslint "src/**/*.{js,svelte}"
```
---
## Options
The [parserOptions](https://eslint.org/docs/latest/use/configure/parser#configure-parser-options) for this parser generally match what [espree](https://github.com/eslint/espree#usage)—ESLint's default parser—supports.
For example:
```js
import svelteParser from "svelte-eslint-parser";
export default [
// ...
{
files: [
// Set .svelte/.js/.ts files. See above for more details.
],
languageOptions: {
parser: svelteParser,
parserOptions: {
sourceType: "module",
ecmaVersion: 2024,
ecmaFeatures: {
globalReturn: false,
impliedStrict: false,
jsx: false,
},
},
},
},
];
```
### parserOptions.parser
Use the `parserOptions.parser` property to define a custom parser for `