a template starter repo for sveltekit projects
1.6 kB
48 lines
1// For more info, see https://github.com/storybookjs/eslint-plugin-storybook#configuration-flat-config-format
2import storybook from 'eslint-plugin-storybook';
3
4import prettier from 'eslint-config-prettier';
5import path from 'node:path';
6import { includeIgnoreFile } from '@eslint/compat';
7import js from '@eslint/js';
8import svelte from 'eslint-plugin-svelte';
9import { defineConfig } from 'eslint/config';
10import globals from 'globals';
11import ts from 'typescript-eslint';
12import svelteConfig from './svelte.config.js';
13
14const gitignorePath = path.resolve(import.meta.dirname, '.gitignore');
15
16export default defineConfig(
17 includeIgnoreFile(gitignorePath),
18 js.configs.recommended,
19 ts.configs.recommended,
20 svelte.configs.recommended,
21 prettier,
22 svelte.configs.prettier,
23 ...storybook.configs['flat/recommended'],
24 {
25 languageOptions: { globals: { ...globals.browser, ...globals.node } },
26 rules: {
27 // typescript-eslint strongly recommend that you do not use the no-undef lint rule on TypeScript projects.
28 // see: https://typescript-eslint.io/troubleshooting/faqs/eslint/#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors
29 'no-undef': 'off'
30 }
31 },
32 {
33 files: ['**/*.svelte', '**/*.svelte.ts', '**/*.svelte.js'],
34 languageOptions: {
35 parserOptions: {
36 projectService: true,
37 extraFileExtensions: ['.svelte'],
38 parser: ts.parser,
39 svelteConfig
40 }
41 }
42 },
43 {
44 // Override or add rule settings here, such as:
45 // 'svelte/button-has-type': 'error'
46 rules: {}
47 }
48);