From 0bba406f960d74d269ea1ee91be16b4b1fb666ca Mon Sep 17 00:00:00 2001 From: Jesse Winton Date: Mon, 31 Mar 2025 12:40:27 -0400 Subject: [PATCH] update eslint config --- eslint.config.js | 44 +++++++++++++++++++++++++++++++------------- package.json | 1 + pnpm-lock.yaml | 16 ++++++++++++++++ 3 files changed, 48 insertions(+), 13 deletions(-) diff --git a/eslint.config.js b/eslint.config.js index 09537bd61..6a5f0c364 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,33 +1,51 @@ -import prettier from 'eslint-config-prettier'; +import { includeIgnoreFile } from '@eslint/compat'; import js from '@eslint/js'; +import prettier from 'eslint-config-prettier'; import svelte from 'eslint-plugin-svelte'; import globals from 'globals'; +import { fileURLToPath } from 'node:url'; import ts from 'typescript-eslint'; +import svelteConfig from './svelte.config.js'; + +const gitignorePath = fileURLToPath(new URL('./.gitignore', import.meta.url)); export default ts.config( + includeIgnoreFile(gitignorePath), js.configs.recommended, ...ts.configs.recommended, - ...svelte.configs['flat/recommended'], + ...svelte.configs.recommended, prettier, - ...svelte.configs['flat/prettier'], + ...svelte.configs.prettier, { languageOptions: { - globals: { - ...globals.browser, - ...globals.node - } + globals: { ...globals.browser, ...globals.node } + }, + rules: { + // TODO: remove them one by one + '@typescript-eslint/no-unused-vars': 'off', + '@typescript-eslint/no-duplicate-enum-values': 'off', + '@typescript-eslint/no-empty-object-type': 'off', + '@typescript-eslint/no-unused-expressions': 'off', + 'svelte/infinite-reactive-loop': 'off', + 'svelte/require-each-key': 'off', + 'svelte/no-immutable-reactive-statements': 'off', + 'svelte/no-at-html-tags': 'off', + 'svelte/no-useless-mustaches': 'off', + 'svelte/no-reactive-reassign': 'off', + 'svelte/no-reactive-literals': 'off' } }, { - files: ['**/*.svelte'], - + files: ['**/*.svelte', '**/*.svelte.ts', '**/*.svelte.js'], + ignores: ['eslint.config.js', 'svelte.config.js'], languageOptions: { parserOptions: { - parser: ts.parser + // Only uncomment this if you want it to take 3 minutes https://github.com/sveltejs/eslint-plugin-svelte/issues/1084 + // projectService: true, + extraFileExtensions: ['.svelte'], + parser: ts.parser, + svelteConfig } } - }, - { - ignores: ['build/', '.svelte-kit/', 'dist/'] } ); diff --git a/package.json b/package.json index d26a73d93..0dc6e3f42 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "@appwrite.io/pink": "~0.26.0", "@appwrite.io/pink-icons": "~0.26.0", "@appwrite.io/repo": "github:appwrite/appwrite#1.6.x", + "@eslint/compat": "^1.2.7", "@eslint/js": "^9.21.0", "@fingerprintjs/fingerprintjs": "^4.5.1", "@internationalized/date": "3.5.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 08430c657..599b9fe14 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -36,6 +36,9 @@ importers: '@appwrite.io/repo': specifier: github:appwrite/appwrite#1.6.x version: https://codeload.github.com/appwrite/appwrite/tar.gz/2c803b262cbf62b499df28ff11d2ca40e16ab909 + '@eslint/compat': + specifier: ^1.2.7 + version: 1.2.7(eslint@9.22.0(jiti@2.4.2)) '@eslint/js': specifier: ^9.21.0 version: 9.22.0 @@ -476,6 +479,15 @@ packages: resolution: {integrity: sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==} engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} + '@eslint/compat@1.2.7': + resolution: {integrity: sha512-xvv7hJE32yhegJ8xNAnb62ggiAwTYHBpUCWhRxEj/ksvgDJuSXfoDkBcRYaYNFiJ+jH0IE3K16hd+xXzhBgNbg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + eslint: ^9.10.0 + peerDependenciesMeta: + eslint: + optional: true + '@eslint/config-array@0.19.2': resolution: {integrity: sha512-GNKqxfHG2ySmJOBSHg7LxeUx4xpuCoFjacmlCoYWEbaPXLwvfIjixRI12xCQZeULksQb23uiA8F40w5TojpV7w==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -4722,6 +4734,10 @@ snapshots: '@eslint-community/regexpp@4.12.1': {} + '@eslint/compat@1.2.7(eslint@9.22.0(jiti@2.4.2))': + optionalDependencies: + eslint: 9.22.0(jiti@2.4.2) + '@eslint/config-array@0.19.2': dependencies: '@eslint/object-schema': 2.1.6