ESLint: Migrate to flat config

This commit is contained in:
IRHM
2026-07-28 04:06:46 +01:00
committed by momi
parent 68150b38ec
commit 347113be68
6 changed files with 725 additions and 721 deletions
-15
View File
@@ -1,15 +0,0 @@
.DS_Store
node_modules
/build
/.svelte-kit
/package
.env
.env.*
!.env.example
/doc
# Ignore files for PNPM, NPM and YARN
pnpm-lock.yaml
package-lock.json
yarn.lock
-27
View File
@@ -1,27 +0,0 @@
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
extends: ["plugin:svelte/recommended"],
plugins: ["@typescript-eslint"],
ignorePatterns: ["*.cjs", "*.config.js"],
overrides: [
{
files: ["*.svelte"],
parser: "svelte-eslint-parser",
parserOptions: {
parser: "@typescript-eslint/parser",
},
},
],
parserOptions: {
project: "./tsconfig.json",
extraFileExtensions: [".svelte"],
sourceType: "module",
ecmaVersion: 2020,
},
env: {
browser: true,
es2017: true,
node: false,
},
};
+10
View File
@@ -18,6 +18,16 @@ These changes are awaiting release:
- Workflows: Upgrade action versions & set Node version to `24`.
- Dockerfile: Upgrade node steps to use version `24`.
- Workflows: test-pr-server: Set go-version-file for setup-go action.
- Upgrade devDependencies:
- eslint: 8.57.0 -> 10.7.0
- eslint-config-prettier: 10.1.2 -> 10.1.8
- eslint-plugin-svelte: 2.45.1 -> 3.20.0
- prettier: 3.4.2 -> 3.9.5
- prettier-plugin-svelte: 3.4.0 -> 4.1.1
- svelte-eslint-parser: 0.42.0 -> 1.8.0
- typescript-eslint: 8.32.1 -> 8.63.0
- Added devDependencies: `@eslint/js` (new eslint has split this module out into a new package) and `globals` (as a result of new eslint architecture, we now have this as a direct dev dependency).
- ESLint: Migrate to flat config: I ran `npx sv add eslint` and modified the eslint.config.js it generated to line up better with our old one and work a bit better (i think) with our normal ts files. Also set `ecmaVersion` to `latest`, previously was `2020`.
# [4.1.1] - 2026-07-26T02:00:00Z
+60
View File
@@ -0,0 +1,60 @@
import prettier from "eslint-config-prettier";
import path from "node:path";
import js from "@eslint/js";
import svelte from "eslint-plugin-svelte";
import { defineConfig, includeIgnoreFile } from "eslint/config";
import globals from "globals";
import ts from "typescript-eslint";
import svelteConfig from "./svelte.config.js";
const gitignorePath = path.resolve(import.meta.dirname, ".gitignore");
export default defineConfig(
includeIgnoreFile(gitignorePath),
js.configs.recommended,
ts.configs.recommended,
svelte.configs.recommended,
prettier,
svelte.configs.prettier,
{
languageOptions: {
globals: { ...globals.browser /* ...globals.node */ },
parserOptions: {
projectService: true,
parser: ts.parser,
ecmaVersion: "latest",
},
},
rules: {
// typescript-eslint strongly recommend that you do not use the no-undef lint rule on TypeScript projects.
// 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
"no-undef": "off",
},
},
{
files: ["**/*.svelte", "**/*.svelte.ts", "**/*.svelte.js"],
languageOptions: {
parserOptions: {
extraFileExtensions: [".svelte"],
svelteConfig,
},
},
},
{
// Override or add rule settings here.
rules: {
"@typescript-eslint/no-empty-object-type": [
"error",
{
// Allowing this because it's nice to create an empty
// interface that extends a base interface for specific
// use, even if it is currently empty, incase i add stuff
// to it in the future. It's also less confusing to read
// the actual type name I want instead of the base type
// everywhere in certain scenarios.
allowInterfaces: "with-single-extends",
},
],
},
},
);
+646 -671
View File
File diff suppressed because it is too large Load Diff
+9 -8
View File
@@ -14,23 +14,24 @@
"format": "prettier --write ."
},
"devDependencies": {
"@eslint/js": "10.0.1",
"@sveltejs/adapter-node": "5.2.12",
"@sveltejs/kit": "2.21.0",
"@types/papaparse": "5.3.15",
"@typescript-eslint/eslint-plugin": "8.32.1",
"@typescript-eslint/parser": "8.32.1",
"@vite-pwa/sveltekit": "0.6.6",
"eslint": "8.57.0",
"eslint-config-prettier": "10.1.2",
"eslint-plugin-svelte": "2.45.1",
"prettier": "3.4.2",
"prettier-plugin-svelte": "3.4.0",
"eslint": "10.7.0",
"eslint-config-prettier": "10.1.8",
"eslint-plugin-svelte": "3.20.0",
"globals": "17.7.0",
"prettier": "3.9.5",
"prettier-plugin-svelte": "4.1.1",
"sass": "1.97.3",
"svelte": "5.17.3",
"svelte-check": "4.1.3",
"svelte-eslint-parser": "0.42.0",
"svelte-eslint-parser": "1.8.0",
"svelte-preprocess": "6.0.3",
"typescript": "5.8.3",
"typescript-eslint": "8.63.0",
"vite": "6.3.5"
},
"type": "module",