|
| 1 | +import { defineConfig } from 'eslint/config'; |
| 2 | +import typescriptEslint from '@typescript-eslint/eslint-plugin'; |
| 3 | +import parser from 'astro-eslint-parser'; |
| 4 | +import path from 'node:path'; |
| 5 | +import { fileURLToPath } from 'node:url'; |
| 6 | +import js from '@eslint/js'; |
| 7 | +import { FlatCompat } from '@eslint/eslintrc'; |
| 8 | + |
| 9 | +const __filename = fileURLToPath(import.meta.url); |
| 10 | +const __dirname = path.dirname(__filename); |
| 11 | +const compat = new FlatCompat({ |
| 12 | + baseDirectory: __dirname, |
| 13 | + recommendedConfig: js.configs.recommended, |
| 14 | + allConfig: js.configs.all, |
| 15 | +}); |
| 16 | + |
| 17 | +export default defineConfig([ |
| 18 | + { |
| 19 | + extends: compat.extends( |
| 20 | + 'plugin:@typescript-eslint/recommended', |
| 21 | + 'plugin:astro/recommended' |
| 22 | + ), |
| 23 | + |
| 24 | + plugins: { |
| 25 | + '@typescript-eslint': typescriptEslint, |
| 26 | + }, |
| 27 | + |
| 28 | + rules: { |
| 29 | + '@typescript-eslint/no-unused-vars': 'error', |
| 30 | + '@typescript-eslint/no-explicit-any': 'error', |
| 31 | + }, |
| 32 | + }, |
| 33 | + { |
| 34 | + files: ['**/*.astro'], |
| 35 | + |
| 36 | + languageOptions: { |
| 37 | + parser: parser, |
| 38 | + ecmaVersion: 5, |
| 39 | + sourceType: 'script', |
| 40 | + |
| 41 | + parserOptions: { |
| 42 | + parser: '@typescript-eslint/parser', |
| 43 | + extraFileExtensions: ['.astro'], |
| 44 | + }, |
| 45 | + }, |
| 46 | + |
| 47 | + rules: {}, |
| 48 | + }, |
| 49 | +]); |
0 commit comments