WIP: My personal website
1import prettier from 'eslint-config-prettier';
2import path from 'node:path';
3import js from '@eslint/js';
4import svelte from 'eslint-plugin-svelte';
5import { defineConfig, includeIgnoreFile } from 'eslint/config';
6import globals from 'globals';
7import ts from 'typescript-eslint';
8import svelteConfig from './svelte.config.js';
9
10const gitignorePath = path.resolve(import.meta.dirname, '.gitignore');
11
12export default defineConfig(
13 includeIgnoreFile(gitignorePath),
14 // Generated atproto lexicon schemas (`pnpm lex:gen`) — not authored by hand.
15 { ignores: ['lexicons/', 'src/lib/lexicons/'] },
16 js.configs.recommended,
17 ts.configs.recommended,
18 svelte.configs.recommended,
19 prettier,
20 svelte.configs.prettier,
21 {
22 languageOptions: { globals: { ...globals.browser, ...globals.node } },
23 rules: {
24 // typescript-eslint strongly recommend that you do not use the no-undef lint rule on TypeScript projects.
25 // 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
26 'no-undef': 'off',
27 quotes: ['error', 'single', { avoidEscape: true }],
28 semi: ['error', 'always'],
29 'object-curly-spacing': ['error', 'always'],
30 // This is a single-page site that uses in-page hash anchors and a static
31 // home link for navigation, so resolve() is unnecessary here.
32 'svelte/no-navigation-without-resolve': 'off'
33 }
34 },
35 {
36 files: ['**/*.svelte', '**/*.svelte.ts', '**/*.svelte.js'],
37 languageOptions: {
38 parserOptions: {
39 projectService: true,
40 extraFileExtensions: ['.svelte'],
41 parser: ts.parser,
42 svelteConfig
43 }
44 }
45 },
46 {
47 // Override or add rule settings here, such as:
48 // 'svelte/button-has-type': 'error'
49 rules: {}
50 }
51);