web based infinite canvas
1import { includeIgnoreFile } from "@eslint/compat";
2import js from "@eslint/js";
3import prettier from "eslint-config-prettier";
4import svelte from "eslint-plugin-svelte";
5import { defineConfig } from "eslint/config";
6import globals from "globals";
7import { fileURLToPath } from "node:url";
8import { dirname } from "node:path";
9import ts from "typescript-eslint";
10import svelteConfig from "./svelte.config.js";
11
12const __dirname = dirname(fileURLToPath(import.meta.url));
13const gitignorePath = fileURLToPath(new URL("./.gitignore", import.meta.url));
14
15export default defineConfig(
16 includeIgnoreFile(gitignorePath),
17 js.configs.recommended,
18 ...ts.configs.recommended,
19 ...svelte.configs.recommended,
20 prettier,
21 ...svelte.configs.prettier,
22 {
23 languageOptions: {
24 globals: { ...globals.browser, ...globals.node },
25 parserOptions: {
26 tsconfigRootDir: __dirname,
27 },
28 },
29
30 rules: {
31 // typescript-eslint strongly recommend that you do not use the no-undef lint rule on TypeScript projects.
32 // 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
33 "no-undef": "off",
34 // Allow unused vars that start with _
35 "@typescript-eslint/no-unused-vars": [
36 "error",
37 {
38 argsIgnorePattern: "^_",
39 varsIgnorePattern: "^_",
40 caughtErrorsIgnorePattern: "^_",
41 },
42 ],
43 },
44 },
45 {
46 files: ["**/*.svelte", "**/*.svelte.ts", "**/*.svelte.js"],
47 languageOptions: {
48 parserOptions: {
49 projectService: true,
50 extraFileExtensions: [".svelte"],
51 parser: ts.parser,
52 svelteConfig,
53 tsconfigRootDir: __dirname,
54 },
55 },
56 },
57);