| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- import path from 'node:path';
- import { includeIgnoreFile } from '@eslint/compat';
- import js from '@eslint/js';
- import { defineConfig } from 'eslint/config';
- import prettier from 'eslint-config-prettier';
- import simpleImportSort from 'eslint-plugin-simple-import-sort';
- import svelte from 'eslint-plugin-svelte';
- import globals from 'globals';
- import ts from 'typescript-eslint';
- import svelteConfig from './svelte.config.js';
- const gitignorePath = path.resolve(import.meta.dirname, '.gitignore');
- const prettierignorePath = path.resolve(import.meta.dirname, '.prettierignore');
- export default defineConfig(
- includeIgnoreFile(gitignorePath),
- includeIgnoreFile(prettierignorePath),
- js.configs.recommended,
- ts.configs.recommended,
- svelte.configs.recommended,
- prettier,
- svelte.configs.prettier,
- {
- languageOptions: { globals: { ...globals.browser, ...globals.node } },
- plugins: {
- 'simple-import-sort': simpleImportSort,
- },
- rules: {
- // typescript-eslint strongly recommend that you do not use the no-undef lint rule on TypeScript projects.
- // 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
- 'no-undef': 'off',
- 'simple-import-sort/imports': [
- 'error',
- {
- groups: [
- ['^node:'],
- ['^@?\\w'],
- ['^\\$app/'],
- ['^\\$lib/'],
- ['^\\$'],
- ['^\\.\\./'],
- ['^\\./'],
- ],
- },
- ],
- 'simple-import-sort/exports': 'error',
- },
- },
- {
- files: ['**/*.svelte', '**/*.svelte.ts', '**/*.svelte.js'],
- languageOptions: {
- parserOptions: {
- projectService: true,
- extraFileExtensions: ['.svelte'],
- parser: ts.parser,
- svelteConfig,
- },
- },
- rules: {
- 'svelte/sort-attributes': [
- 'error',
- {
- order: [
- 'this',
- 'bind:this',
- 'id',
- 'name',
- 'slot',
- { match: '/^--/u', sort: 'alphabetical' },
- ['style', '/^style:/u'],
- 'class',
- { match: '/^class:/u', sort: 'alphabetical' },
- {
- match: [
- '!/:/u',
- '!/^(?:this|id|name|slot|style|class)$/u',
- '!/^--/u',
- '!/^on[a-z]/u',
- ],
- sort: 'alphabetical',
- },
- ['/^bind:/u', '!bind:this', '/^on:/u', '/^on[a-z]/u'],
- { match: '/^use:/u', sort: 'alphabetical' },
- { match: '/^transition:/u', sort: 'alphabetical' },
- { match: '/^in:/u', sort: 'alphabetical' },
- { match: '/^out:/u', sort: 'alphabetical' },
- { match: '/^animate:/u', sort: 'alphabetical' },
- { match: '/^let:/u', sort: 'alphabetical' },
- ],
- },
- ],
- },
- },
- );
|