eslint.config.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // For more info, see https://github.com/storybookjs/eslint-plugin-storybook#configuration-flat-config-format
  2. import storybook from 'eslint-plugin-storybook';
  3. import prettier from 'eslint-config-prettier';
  4. import { includeIgnoreFile } from '@eslint/compat';
  5. import js from '@eslint/js';
  6. import svelte from 'eslint-plugin-svelte';
  7. import globals from 'globals';
  8. import { fileURLToPath } from 'node:url';
  9. import ts from 'typescript-eslint';
  10. import svelteConfig from './svelte.config.js';
  11. const gitignorePath = fileURLToPath(new URL('./.gitignore', import.meta.url));
  12. export default ts.config(
  13. includeIgnoreFile(gitignorePath),
  14. js.configs.recommended,
  15. ...ts.configs.recommended,
  16. ...svelte.configs.recommended,
  17. prettier,
  18. ...svelte.configs.prettier,
  19. {
  20. languageOptions: {
  21. globals: { ...globals.browser, ...globals.node }
  22. },
  23. rules: {
  24. // typescript-eslint strongly recommend that you do not use the no-undef lint rule on TypeScript projects.
  25. // 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
  26. 'no-undef': 'off',
  27. 'svelte/no-at-html-tags': 'off'
  28. }
  29. },
  30. {
  31. files: ['**/*.svelte', '**/*.svelte.ts', '**/*.svelte.js'],
  32. languageOptions: {
  33. parserOptions: {
  34. projectService: true,
  35. extraFileExtensions: ['.svelte'],
  36. parser: ts.parser,
  37. svelteConfig
  38. }
  39. }
  40. },
  41. {
  42. // Exclude Storybook files from main ESLint rules
  43. ignores: ['.storybook/**/*']
  44. },
  45. storybook.configs['flat/recommended']
  46. );