73 lines
1.5 KiB
JavaScript
73 lines
1.5 KiB
JavaScript
import js from '@eslint/js'
|
|
import ts from 'typescript-eslint'
|
|
import svelte from 'eslint-plugin-svelte'
|
|
import prettier from 'eslint-config-prettier'
|
|
import globals from 'globals'
|
|
import { loadConfig } from '@sveltejs/load-config'
|
|
|
|
const loadedConfig = await loadConfig(import.meta.dirname, { traverse: false })
|
|
if (!loadedConfig) throw new Error('Svelte configuration not found')
|
|
if ('error' in loadedConfig) throw loadedConfig.error
|
|
const svelteConfig = loadedConfig.config
|
|
|
|
/** @type {import('eslint').Linter.Config[]} */
|
|
export default [
|
|
js.configs.recommended,
|
|
...ts.configs.recommended,
|
|
...svelte.configs['flat/recommended'],
|
|
prettier,
|
|
...svelte.configs['flat/prettier'],
|
|
{
|
|
languageOptions: {
|
|
globals: {
|
|
...globals.browser,
|
|
...globals.node
|
|
}
|
|
},
|
|
rules: {
|
|
'@typescript-eslint/no-unused-vars': [
|
|
'error',
|
|
{
|
|
argsIgnorePattern: '^_',
|
|
varsIgnorePattern: '^_',
|
|
caughtErrorsIgnorePattern: '^_'
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
files: ['**/*.svelte'],
|
|
languageOptions: {
|
|
parserOptions: {
|
|
parser: ts.parser,
|
|
svelteConfig
|
|
}
|
|
}
|
|
},
|
|
{
|
|
ignores: [
|
|
'build/',
|
|
'.svelte-kit/',
|
|
'test-results/',
|
|
'docker-compose.yml',
|
|
'src/lib/pieces/components/custom/',
|
|
'src/lib/content/components/custom/',
|
|
'demo/content/',
|
|
'demo/archive/',
|
|
'demo/data/',
|
|
'demo/assets/'
|
|
]
|
|
},
|
|
{
|
|
rules: {
|
|
'@typescript-eslint/consistent-type-imports': [
|
|
'error',
|
|
{
|
|
prefer: 'type-imports',
|
|
fixStyle: 'separate-type-imports'
|
|
}
|
|
]
|
|
}
|
|
}
|
|
]
|