Initial commit
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
import prettier from 'eslint-config-prettier';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { includeIgnoreFile } from '@eslint/compat';
|
||||
import js from '@eslint/js';
|
||||
import svelte from 'eslint-plugin-svelte';
|
||||
import { defineConfig } from 'eslint/config';
|
||||
import globals from 'globals';
|
||||
import ts from 'typescript-eslint';
|
||||
// highlight-start
|
||||
// 1. Plugin importieren
|
||||
import unusedImports from 'eslint-plugin-unused-imports';
|
||||
// highlight-end
|
||||
import svelteConfig from './svelte.config.js';
|
||||
|
||||
const gitignorePath = fileURLToPath(new URL('./.gitignore', import.meta.url));
|
||||
|
||||
export default defineConfig(
|
||||
includeIgnoreFile(gitignorePath),
|
||||
js.configs.recommended,
|
||||
...ts.configs.recommended,
|
||||
...svelte.configs.recommended,
|
||||
prettier,
|
||||
...svelte.configs.prettier,
|
||||
{
|
||||
languageOptions: {
|
||||
globals: { ...globals.browser, ...globals.node }
|
||||
},
|
||||
// highlight-start
|
||||
// 2. Plugin hier hinzufügen
|
||||
plugins: {
|
||||
'unused-imports': unusedImports
|
||||
},
|
||||
// 3. Regeln für das Plugin definieren
|
||||
rules: {
|
||||
'no-undef': 'off',
|
||||
'no-unused-vars': 'off', // Wichtig: Die Standard-ESLint-Regel deaktivieren
|
||||
'unused-imports/no-unused-imports': 'error', // Regel des Plugins aktivieren
|
||||
'unused-imports/no-unused-vars': [
|
||||
// Sicherstellen, dass keine benutzten Variablen fälschlich entfernt werden
|
||||
'warn',
|
||||
{
|
||||
vars: 'all',
|
||||
varsIgnorePattern: '^_',
|
||||
args: 'after-used',
|
||||
argsIgnorePattern: '^_'
|
||||
}
|
||||
]
|
||||
}
|
||||
// highlight-end
|
||||
},
|
||||
{
|
||||
files: ['**/*.svelte', '**/*.svelte.ts', '**/*.svelte.js'],
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
projectService: true,
|
||||
extraFileExtensions: ['.svelte'],
|
||||
parser: ts.parser,
|
||||
svelteConfig
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
Reference in New Issue
Block a user