diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 5a6a90eb..00000000 --- a/.eslintignore +++ /dev/null @@ -1,2 +0,0 @@ -dist -.svelte-kit \ No newline at end of file diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 92fc92d2..00000000 --- a/.eslintrc.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "env": { - "node": true, - "browser": true, - "es2021": true - }, - "extends": [ - "eslint:recommended", - "plugin:@typescript-eslint/recommended", - "plugin:svelte/recommended" - ], - "overrides": [ - { - "files": ["*.svelte"], - "parser": "svelte-eslint-parser", - "parserOptions": { - "parser": "@typescript-eslint/parser" - } - } - ], - "parser": "@typescript-eslint/parser", - "parserOptions": { - "ecmaVersion": "latest", - "sourceType": "module", - "extraFileExtensions": [".svelte"] - }, - "plugins": ["@typescript-eslint"], - "rules": { - "no-mixed-spaces-and-tabs": 0 - }, - "settings": { - "svelte3/typescript": true - } -} diff --git a/docs/postcss.config.cjs b/docs/postcss.config.cjs index 4eb987ce..f4db3bd1 100644 --- a/docs/postcss.config.cjs +++ b/docs/postcss.config.cjs @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-require-imports */ const tailwindcss = require('tailwindcss'); const autoprefixer = require('autoprefixer'); diff --git a/docs/src/lib/components/mobile-sidebar/MobileSidebar.svelte b/docs/src/lib/components/mobile-sidebar/MobileSidebar.svelte index 1ebb918d..393f0326 100644 --- a/docs/src/lib/components/mobile-sidebar/MobileSidebar.svelte +++ b/docs/src/lib/components/mobile-sidebar/MobileSidebar.svelte @@ -8,7 +8,7 @@ let enabled = false; $: { - $page.url; + $page.url = $page.url; enabled = false; } diff --git a/docs/src/routes/[...slug]/+page.svelte b/docs/src/routes/[...slug]/+page.svelte index 449ea7b0..65fed0de 100644 --- a/docs/src/routes/[...slug]/+page.svelte +++ b/docs/src/routes/[...slug]/+page.svelte @@ -25,7 +25,7 @@ }); $: if (mounted) { - $page.url; + $page.url = $page.url; clientSideComponent = null; renderClientSideComponent(); } diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 00000000..2ad01443 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,89 @@ +import typescriptEslint from '@typescript-eslint/eslint-plugin'; +import globals from 'globals'; +import tsParser from '@typescript-eslint/parser'; +import parser from 'svelte-eslint-parser'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; +import js from '@eslint/js'; +import { FlatCompat } from '@eslint/eslintrc'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); +const compat = new FlatCompat({ + baseDirectory: __dirname, + recommendedConfig: js.configs.recommended, + allConfig: js.configs.all +}); + +export default [ + { + ignores: [ + '**/dist', + '**/build', + '**/.svelte-kit', + '**/assets', + '.DS_Store', + 'node_modules', + '/build', + '/.svelte-kit', + '/package', + '.env', + '.env.*', + '!.env.example', + 'vite.config.js.timestamp-*', + 'vite.config.ts.timestamp-*', + '.eslintcache', + '.pnpm-debug.log', + '**/dis', + '**/tsconfig.tsbuildinf', + '**/.rollup.cache' + ] + }, + ...compat.extends( + 'eslint:recommended', + 'plugin:@typescript-eslint/recommended', + 'plugin:svelte/recommended' + ), + { + plugins: { + '@typescript-eslint': typescriptEslint + }, + + languageOptions: { + globals: { + ...globals.node, + ...globals.browser + }, + + parser: tsParser, + ecmaVersion: 'latest', + sourceType: 'module', + + parserOptions: { + extraFileExtensions: ['.svelte'] + } + }, + + settings: { + 'svelte3/typescript': true + }, + + rules: { + 'no-mixed-spaces-and-tabs': 0, + '@typescript-eslint/no-unused-expressions': 0 + } + }, + { + files: ['**/*.svelte'], + + languageOptions: { + parser: parser, + ecmaVersion: 5, + sourceType: 'script', + + parserOptions: { + parser: '@typescript-eslint/parser' + } + } + } +]; diff --git a/package.json b/package.json index 4bf6d7ba..3a118731 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,8 @@ "commit": "cz" }, "devDependencies": { + "@eslint/eslintrc": "^3.1.0", + "@eslint/js": "^9.12.0", "@types/node": "^18.16.3", "@typescript-eslint/eslint-plugin": "^8.10.0", "@typescript-eslint/parser": "^8.10.0", @@ -28,6 +30,7 @@ "eslint": "^9.12.0", "eslint-config-prettier": "^8.8.0", "eslint-plugin-svelte": "^2.45.1", + "globals": "^15.11.0", "husky": "^8.0.3", "lint-staged": "^13.2.2", "ora": "^6.3.0", diff --git a/packages/carta-md/src/lib/internal/carta.ts b/packages/carta-md/src/lib/internal/carta.ts index 7f245168..cfe0b92a 100644 --- a/packages/carta-md/src/lib/internal/carta.ts +++ b/packages/carta-md/src/lib/internal/carta.ts @@ -151,7 +151,6 @@ export interface Plugin { * Unified transformers plugins. * @important If the plugin is async, it will not run in SSR rendering. */ - // eslint-disable-next-line @typescript-eslint/no-explicit-any transformers?: UnifiedTransformer<'sync' | 'async'>[]; /** * Additional keyboard shortcuts. diff --git a/packages/carta-md/src/lib/internal/input.ts b/packages/carta-md/src/lib/internal/input.ts index 887a431c..e7a94a25 100644 --- a/packages/carta-md/src/lib/internal/input.ts +++ b/packages/carta-md/src/lib/internal/input.ts @@ -554,7 +554,7 @@ export class InputEnhancer { destroy: () => { try { data.portal.removeChild(elem); - } catch (e: unknown) { + } catch { // Ignore } this.textarea.removeEventListener('input', callback); diff --git a/packages/carta-md/src/lib/internal/utils.ts b/packages/carta-md/src/lib/internal/utils.ts index 317aeca2..ee953c4c 100644 --- a/packages/carta-md/src/lib/internal/utils.ts +++ b/packages/carta-md/src/lib/internal/utils.ts @@ -1,5 +1,5 @@ // Workaround to add intellisense -// eslint-disable-next-line @typescript-eslint/no-empty-interface +// eslint-disable-next-line @typescript-eslint/no-empty-object-type interface Nothing {} type Union = T | (U & Nothing); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3c06055c..eb6847ad 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,6 +8,12 @@ importers: .: devDependencies: + '@eslint/eslintrc': + specifier: ^3.1.0 + version: 3.1.0 + '@eslint/js': + specifier: ^9.12.0 + version: 9.12.0 '@types/node': specifier: ^18.16.3 version: 18.16.3 @@ -32,6 +38,9 @@ importers: eslint-plugin-svelte: specifier: ^2.45.1 version: 2.45.1(eslint@9.12.0(jiti@1.21.0))(svelte@4.2.19)(ts-node@10.9.1(@types/node@18.16.3)(typescript@5.3.3)) + globals: + specifier: ^15.11.0 + version: 15.11.0 husky: specifier: ^8.0.3 version: 8.0.3 @@ -2319,6 +2328,10 @@ packages: resolution: {integrity: sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==} engines: {node: '>=18'} + globals@15.11.0: + resolution: {integrity: sha512-yeyNSjdbyVaWurlwCpcA6XNBrHTMIeDdj0/hnvX/OLJ9ekOXYbLsLinH/MucQyGvNnXhidTdNhTtJaffL2sMfw==} + engines: {node: '>=18'} + globalyzer@0.1.0: resolution: {integrity: sha512-40oNTM9UfG6aBmuKxk/giHn5nQ8RVz/SS4Ir6zgzOv9/qC3kKZ9v4etGTcJbEl/NyVQH7FGU7d+X1egr57Md2Q==} @@ -6768,6 +6781,8 @@ snapshots: globals@14.0.0: {} + globals@15.11.0: {} + globalyzer@0.1.0: {} globby@11.1.0: