|
@@ -1,17 +1,22 @@
|
|
|
-import prettier from 'eslint-config-prettier';
|
|
|
|
|
import path from 'node:path';
|
|
import path from 'node:path';
|
|
|
|
|
+
|
|
|
import { includeIgnoreFile } from '@eslint/compat';
|
|
import { includeIgnoreFile } from '@eslint/compat';
|
|
|
import js from '@eslint/js';
|
|
import js from '@eslint/js';
|
|
|
-import svelte from 'eslint-plugin-svelte';
|
|
|
|
|
import { defineConfig } from 'eslint/config';
|
|
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 globals from 'globals';
|
|
|
import ts from 'typescript-eslint';
|
|
import ts from 'typescript-eslint';
|
|
|
|
|
+
|
|
|
import svelteConfig from './svelte.config.js';
|
|
import svelteConfig from './svelte.config.js';
|
|
|
|
|
|
|
|
const gitignorePath = path.resolve(import.meta.dirname, '.gitignore');
|
|
const gitignorePath = path.resolve(import.meta.dirname, '.gitignore');
|
|
|
|
|
+const prettierignorePath = path.resolve(import.meta.dirname, '.prettierignore');
|
|
|
|
|
|
|
|
export default defineConfig(
|
|
export default defineConfig(
|
|
|
includeIgnoreFile(gitignorePath),
|
|
includeIgnoreFile(gitignorePath),
|
|
|
|
|
+ includeIgnoreFile(prettierignorePath),
|
|
|
js.configs.recommended,
|
|
js.configs.recommended,
|
|
|
ts.configs.recommended,
|
|
ts.configs.recommended,
|
|
|
svelte.configs.recommended,
|
|
svelte.configs.recommended,
|
|
@@ -19,11 +24,29 @@ export default defineConfig(
|
|
|
svelte.configs.prettier,
|
|
svelte.configs.prettier,
|
|
|
{
|
|
{
|
|
|
languageOptions: { globals: { ...globals.browser, ...globals.node } },
|
|
languageOptions: { globals: { ...globals.browser, ...globals.node } },
|
|
|
|
|
+ plugins: {
|
|
|
|
|
+ 'simple-import-sort': simpleImportSort,
|
|
|
|
|
+ },
|
|
|
rules: {
|
|
rules: {
|
|
|
// typescript-eslint strongly recommend that you do not use the no-undef lint rule on TypeScript projects.
|
|
// 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
|
|
// 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'
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ 'no-undef': 'off',
|
|
|
|
|
+ 'simple-import-sort/imports': [
|
|
|
|
|
+ 'error',
|
|
|
|
|
+ {
|
|
|
|
|
+ groups: [
|
|
|
|
|
+ ['^node:'],
|
|
|
|
|
+ ['^@?\\w'],
|
|
|
|
|
+ ['^\\$app/'],
|
|
|
|
|
+ ['^\\$lib/'],
|
|
|
|
|
+ ['^\\$'],
|
|
|
|
|
+ ['^\\.\\./'],
|
|
|
|
|
+ ['^\\./'],
|
|
|
|
|
+ ],
|
|
|
|
|
+ },
|
|
|
|
|
+ ],
|
|
|
|
|
+ 'simple-import-sort/exports': 'error',
|
|
|
|
|
+ },
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
files: ['**/*.svelte', '**/*.svelte.ts', '**/*.svelte.js'],
|
|
files: ['**/*.svelte', '**/*.svelte.ts', '**/*.svelte.js'],
|
|
@@ -32,8 +55,42 @@ export default defineConfig(
|
|
|
projectService: true,
|
|
projectService: true,
|
|
|
extraFileExtensions: ['.svelte'],
|
|
extraFileExtensions: ['.svelte'],
|
|
|
parser: ts.parser,
|
|
parser: ts.parser,
|
|
|
- svelteConfig
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ 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' },
|
|
|
|
|
+ ],
|
|
|
|
|
+ },
|
|
|
|
|
+ ],
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
);
|
|
);
|