@nnry/eslint-config-svelte
v0.0.4
Published
Shared ESLint flat config for Svelte projects.
Readme
@nnry/eslint-config-svelte
Shared ESLint flat config for Svelte projects.
This package builds on top of @nnry/eslint-config and adds Svelte support with:
eslint-plugin-sveltesvelte-eslint-parser@typescript-eslint/parser
Install
Install the package and its peer dependencies:
pnpm add -D eslint @nnry/eslint-config @nnry/eslint-config-svelte eslint-plugin-svelte svelte-eslint-parserIf your Svelte files use TypeScript, also install:
pnpm add -D @typescript-eslint/parserUsage
Create an eslint.config.js file:
import { defineConfig } from 'eslint/config';
import nnrylintSvelte from '@nnry/eslint-config-svelte';
export default defineConfig([
...nnrylintSvelte.configs.svelte,
]);You can also import the config directly:
import { defineConfig } from 'eslint/config';
import { svelte } from '@nnry/eslint-config-svelte';
export default defineConfig([
...svelte,
]);What this config includes
The exported svelte config applies:
@nnry/eslint-configbase rules@nnry/eslint-configstylistic ruleseslint-plugin-svelteflat base configsvelte-eslint-parserfor*.sveltefiles@typescript-eslint/parseras the script parser inside Svelte filessvelte/indentwith 2-space indentation
Linting
Add a script to your project:
{
"scripts": {
"lint": "eslint ."
}
}Then run:
pnpm lint