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 { includeIgnoreFile } from '@eslint/compat';
6import js from '@eslint/js';
7import svelte from 'eslint-plugin-svelte';
8import globals from 'globals';
9import { fileURLToPath } from 'node:url';
10import ts from 'typescript-eslint';
11import svelteConfig from './svelte.config.js';
12
13const gitignorePath = fileURLToPath(new URL('./.gitignore', import.meta.url));
14
15export default ts.config(
16 includeIgnoreFile(gitignorePath),
17 js.configs.recommended,
18 ...ts.configs.recommended,
19 ...svelte.configs.recommended,
20 prettier,
21 ...svelte.configs.prettier,
22 {
23 languageOptions: {
24 globals: { ...globals.browser, ...globals.node }
25 },
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 'svelte/no-at-html-tags': 'off'
31 }
32 },
33 {
34 files: ['**/*.svelte', '**/*.svelte.ts', '**/*.svelte.js'],
35 languageOptions: {
36 parserOptions: {
37 projectService: true,
38 extraFileExtensions: ['.svelte'],
39 parser: ts.parser,
40 svelteConfig
41 }
42 }
43 },
44 {
45 // Exclude Storybook files from main ESLint rules
46 ignores: ['.storybook/**/*']
47 },
48 storybook.configs['flat/recommended']
49);