Code for my personal website
1import tsParser from '@typescript-eslint/parser';
2import parser from 'astro-eslint-parser';
3import path from 'node:path';
4import { fileURLToPath } from 'node:url';
5import js from '@eslint/js';
6import { FlatCompat } from '@eslint/eslintrc';
7
8const __filename = fileURLToPath(import.meta.url);
9const __dirname = path.dirname(__filename);
10const compat = new FlatCompat({
11 baseDirectory: __dirname,
12 recommendedConfig: js.configs.recommended,
13 allConfig: js.configs.all
14});
15
16export default [
17 ...compat.extends('plugin:astro/recommended'),
18 {
19 files: ['**/*.ts'],
20
21 languageOptions: {
22 parser: tsParser,
23 ecmaVersion: 'latest',
24 sourceType: 'module',
25
26 parserOptions: {
27 tsconfigRootDir: '.'
28 }
29 }
30 },
31 {
32 files: ['**/*.astro'],
33
34 languageOptions: {
35 parser: parser,
36 ecmaVersion: 5,
37 sourceType: 'script',
38
39 parserOptions: {
40 parser: '@typescript-eslint/parser',
41 extraFileExtensions: ['.astro']
42 }
43 },
44
45 rules: {}
46 }
47];