diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 5b3315844..ba5903f67 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -1,24 +1,36 @@ module.exports = { root: true, + extends: [ + 'eslint:recommended', + 'plugin:@typescript-eslint/recommended', + 'plugin:svelte/recommended', + 'prettier' + ], parser: '@typescript-eslint/parser', - extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'], - plugins: ['svelte3', '@typescript-eslint'], + parserOptions: { + extraFileExtensions: ['.svelte'], // This is a required setting in `@typescript-eslint/parser` v4.24.0. + sourceType: 'module', + ecmaVersion: 2020 + }, ignorePatterns: ['*.cjs'], overrides: [ { files: ['*.svelte'], - processor: 'svelte3/svelte3', - rules: { - 'no-redeclare': 'off' + parser: 'svelte-eslint-parser', + parserOptions: { + parser: '@typescript-eslint/parser' //This is required to parse TypeScript inside Svelte files. } } ], - settings: { - 'svelte3/typescript': () => require('typescript') - }, - parserOptions: { - sourceType: 'module', - ecmaVersion: 2020 + rules: { + 'no-redeclare': 'off', + '@typescript-eslint/no-duplicate-enum-values': 'off', + 'svelte/no-at-html-tags': 'off', + 'no-unused-vars': 'off', // This rule is handled by `@typescript-eslint/no-unused-vars` so it needs to be disabled to avoid conflicts. + '@typescript-eslint/no-unused-vars': [ + 'error', + { argsIgnorePattern: '^_', varsIgnorePattern: '^(_|\\$\\$)' } // Ignore unused variables starting with `_` or `$$`. + ] }, env: { browser: true, diff --git a/.prettierrc b/.prettierrc index 376006219..f4a7780a8 100644 --- a/.prettierrc +++ b/.prettierrc @@ -5,5 +5,5 @@ "trailingComma": "none", "printWidth": 100, "bracketSameLine": true, - "svelteSortOrder": "scripts-options-markup-styles" + "plugins": ["prettier-plugin-svelte"] } diff --git a/package-lock.json b/package-lock.json index 1b096bd7e..df3cd9934 100644 --- a/package-lock.json +++ b/package-lock.json @@ -44,6 +44,7 @@ "@vitest/ui": "^0.29.7", "eslint": "^8.36.0", "eslint-config-prettier": "^8.8.0", + "eslint-plugin-svelte": "^2.33.2", "eslint-plugin-svelte3": "^4.0.0", "jsdom": "^21.1.1", "kleur": "^4.1.5", @@ -3137,6 +3138,18 @@ "dev": true, "license": "MIT" }, + "node_modules/cssesc": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", + "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", + "dev": true, + "bin": { + "cssesc": "bin/cssesc" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/cssstyle": { "version": "3.0.0", "dev": true, @@ -3613,6 +3626,40 @@ "eslint": ">=7.0.0" } }, + "node_modules/eslint-plugin-svelte": { + "version": "2.33.2", + "resolved": "https://registry.npmjs.org/eslint-plugin-svelte/-/eslint-plugin-svelte-2.33.2.tgz", + "integrity": "sha512-knWmauax+E/jvQ9CmuX5dAhQKP9P4eGQZxWa5RMutEJVCcy0wFmiUvOeDND2jR4vUkbDlX4khKjaceY7QzbkYw==", + "dev": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@jridgewell/sourcemap-codec": "^1.4.14", + "debug": "^4.3.1", + "esutils": "^2.0.3", + "known-css-properties": "^0.28.0", + "postcss": "^8.4.5", + "postcss-load-config": "^3.1.4", + "postcss-safe-parser": "^6.0.0", + "postcss-selector-parser": "^6.0.11", + "semver": "^7.5.3", + "svelte-eslint-parser": ">=0.33.0 <1.0.0" + }, + "engines": { + "node": "^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ota-meshi" + }, + "peerDependencies": { + "eslint": "^7.0.0 || ^8.0.0-0", + "svelte": "^3.37.0 || ^4.0.0" + }, + "peerDependenciesMeta": { + "svelte": { + "optional": true + } + } + }, "node_modules/eslint-plugin-svelte3": { "version": "4.0.0", "dev": true, @@ -5695,6 +5742,12 @@ "node": ">=6" } }, + "node_modules/known-css-properties": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/known-css-properties/-/known-css-properties-0.28.0.tgz", + "integrity": "sha512-9pSL5XB4J+ifHP0e0jmmC98OGC1nL8/JjS+fi6mnTlIf//yt/MfVLtKg7S6nCtj/8KTcWX7nRlY0XywoYY1ISQ==", + "dev": true + }, "node_modules/leven": { "version": "3.1.0", "dev": true, @@ -5716,6 +5769,15 @@ "node": ">= 0.8.0" } }, + "node_modules/lilconfig": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.1.0.tgz", + "integrity": "sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==", + "dev": true, + "engines": { + "node": ">=10" + } + }, "node_modules/lines-and-columns": { "version": "1.2.4", "dev": true, @@ -6439,7 +6501,9 @@ } }, "node_modules/postcss": { - "version": "8.4.28", + "version": "8.4.31", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz", + "integrity": "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==", "funding": [ { "type": "opencollective", @@ -6454,7 +6518,6 @@ "url": "https://github.com/sponsors/ai" } ], - "license": "MIT", "dependencies": { "nanoid": "^3.3.6", "picocolors": "^1.0.0", @@ -6464,6 +6527,90 @@ "node": "^10 || ^12 || >=14" } }, + "node_modules/postcss-load-config": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-3.1.4.tgz", + "integrity": "sha512-6DiM4E7v4coTE4uzA8U//WhtPwyhiim3eyjEMFCnUpzbrkK9wJHgKDT2mR+HbtSrd/NubVaYTOpSpjUl8NQeRg==", + "dev": true, + "dependencies": { + "lilconfig": "^2.0.5", + "yaml": "^1.10.2" + }, + "engines": { + "node": ">= 10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + "peerDependencies": { + "postcss": ">=8.0.9", + "ts-node": ">=9.0.0" + }, + "peerDependenciesMeta": { + "postcss": { + "optional": true + }, + "ts-node": { + "optional": true + } + } + }, + "node_modules/postcss-safe-parser": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-safe-parser/-/postcss-safe-parser-6.0.0.tgz", + "integrity": "sha512-FARHN8pwH+WiS2OPCxJI8FuRJpTVnn6ZNFiqAM2aeW2LwTHWWmWgIyKC6cUo0L8aeKiF/14MNvnpls6R2PBeMQ==", + "dev": true, + "engines": { + "node": ">=12.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + "peerDependencies": { + "postcss": "^8.3.3" + } + }, + "node_modules/postcss-scss": { + "version": "4.0.9", + "resolved": "https://registry.npmjs.org/postcss-scss/-/postcss-scss-4.0.9.tgz", + "integrity": "sha512-AjKOeiwAitL/MXxQW2DliT28EKukvvbEWx3LBmJIRN8KfBGZbRTxNYW0kSqi1COiTZ57nZ9NW06S6ux//N1c9A==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss-scss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "engines": { + "node": ">=12.0" + }, + "peerDependencies": { + "postcss": "^8.4.29" + } + }, + "node_modules/postcss-selector-parser": { + "version": "6.0.13", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.13.tgz", + "integrity": "sha512-EaV1Gl4mUEV4ddhDnv/xtj7sxwrwxdetHdWUGnT4VJQf+4d05v6lHYZr8N573k5Z0BViss7BDhfWtKS3+sfAqQ==", + "dev": true, + "dependencies": { + "cssesc": "^3.0.0", + "util-deprecate": "^1.0.2" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/postcss/node_modules/nanoid": { "version": "3.3.6", "funding": [ @@ -7422,6 +7569,58 @@ "version": "1.2.4", "license": "MIT" }, + "node_modules/svelte-eslint-parser": { + "version": "0.33.0", + "resolved": "https://registry.npmjs.org/svelte-eslint-parser/-/svelte-eslint-parser-0.33.0.tgz", + "integrity": "sha512-5awZ6Bs+Tb/zQwa41PSdcLynAVQTwW0HGyCBjtbAQ59taLZqDgQSMzRlDmapjZdDtzERm0oXDZNE0E+PKJ6ryg==", + "dev": true, + "dependencies": { + "eslint-scope": "^7.0.0", + "eslint-visitor-keys": "^3.0.0", + "espree": "^9.0.0", + "postcss": "^8.4.28", + "postcss-scss": "^4.0.7" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ota-meshi" + }, + "peerDependencies": { + "svelte": "^3.37.0 || ^4.0.0" + }, + "peerDependenciesMeta": { + "svelte": { + "optional": true + } + } + }, + "node_modules/svelte-eslint-parser/node_modules/eslint-scope": { + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", + "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/svelte-eslint-parser/node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, "node_modules/svelte-hmr": { "version": "0.15.3", "dev": true, @@ -8268,6 +8467,15 @@ "license": "ISC", "peer": true }, + "node_modules/yaml": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", + "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "dev": true, + "engines": { + "node": ">= 6" + } + }, "node_modules/yargs": { "version": "17.7.2", "dev": true, diff --git a/package.json b/package.json index 3002dc66d..d9c3541cd 100644 --- a/package.json +++ b/package.json @@ -56,6 +56,7 @@ "@vitest/ui": "^0.29.7", "eslint": "^8.36.0", "eslint-config-prettier": "^8.8.0", + "eslint-plugin-svelte": "^2.33.2", "eslint-plugin-svelte3": "^4.0.0", "jsdom": "^21.1.1", "kleur": "^4.1.5", diff --git a/src/lib/actions/analytics.ts b/src/lib/actions/analytics.ts index 210e1471f..a94c30b3a 100644 --- a/src/lib/actions/analytics.ts +++ b/src/lib/actions/analytics.ts @@ -187,7 +187,7 @@ export enum Submit { FunctionUpdateLogging = 'submit_function_update_logging', FunctionUpdateTimeout = 'submit_function_update_timeout', FunctionUpdateEvents = 'submit_function_update_events', - FunctionConnectRepo = 'submit_function_disconnect_repo', + FunctionConnectRepo = 'submit_function_connect_repo', FunctionDisconnectRepo = 'submit_function_disconnect_repo', FunctionRedeploy = 'submit_function_redeploy', DeploymentCreate = 'submit_deployment_create', diff --git a/src/lib/actions/multi-actions.ts b/src/lib/actions/multi-actions.ts index b78221d29..3dc5fae52 100644 --- a/src/lib/actions/multi-actions.ts +++ b/src/lib/actions/multi-actions.ts @@ -1,6 +1,8 @@ import type { Action } from 'svelte/action'; -export type MultiActionArray = Array<(node: HTMLElement) => ReturnType>; +export type MultiActionArray = Array< + (node: HTMLElement) => ReturnType> +>; export function multiAction(node: HTMLElement, arr: MultiActionArray) { const destroyFns = arr.map((fn) => { diff --git a/src/lib/commandCenter/commandCenter.svelte b/src/lib/commandCenter/commandCenter.svelte index e13498a25..3e527a0f4 100644 --- a/src/lib/commandCenter/commandCenter.svelte +++ b/src/lib/commandCenter/commandCenter.svelte @@ -112,7 +112,7 @@ {#if openSubPanel} -
+
{/if} @@ -120,7 +120,7 @@ {#if dev && debugOverlayEnabled}
{#each keys as key, i (i)} - + {key.length === 1 ? key.toUpperCase() : key} {/each} diff --git a/src/lib/commandCenter/panels/template.svelte b/src/lib/commandCenter/panels/template.svelte index 6ed25c8ef..3b5ce24e7 100644 --- a/src/lib/commandCenter/panels/template.svelte +++ b/src/lib/commandCenter/panels/template.svelte @@ -9,6 +9,7 @@ import { clearSubPanels, popSubPanel, subPanels } from '../subPanels'; + /* eslint no-undef: "off" */ type Option = $$Generic & { group?: string }>; export let options: Option[] | null = null; export let search = ''; diff --git a/src/lib/commandCenter/subPanels.ts b/src/lib/commandCenter/subPanels.ts index 13921922d..8bd262815 100644 --- a/src/lib/commandCenter/subPanels.ts +++ b/src/lib/commandCenter/subPanels.ts @@ -1,9 +1,9 @@ -import type { SvelteComponentDev } from 'svelte/internal'; +import type { SvelteComponent } from 'svelte'; import { writable } from 'svelte/store'; export type SubPanel = { name: string; - component: typeof SvelteComponentDev; + component: typeof SvelteComponent; }; type CastSubPanel = Omit & { diff --git a/src/lib/components/card.svelte b/src/lib/components/card.svelte index 043b7a8c3..24c81e6e1 100644 --- a/src/lib/components/card.svelte +++ b/src/lib/components/card.svelte @@ -46,6 +46,7 @@ class:is-allowed-focus={href} on:click on:keyup={clickOnEnter} + role={href || isButton ? 'button' : 'generic'} {href}> diff --git a/src/lib/components/code.svelte b/src/lib/components/code.svelte index 1c3576682..5a358d548 100644 --- a/src/lib/components/code.svelte +++ b/src/lib/components/code.svelte @@ -64,6 +64,7 @@ class:line-numbers={withLineNumbers}>{code} + diff --git a/src/lib/components/collapsibleItem.svelte b/src/lib/components/collapsibleItem.svelte index f504bfde3..cd44bc824 100644 --- a/src/lib/components/collapsibleItem.svelte +++ b/src/lib/components/collapsibleItem.svelte @@ -7,7 +7,13 @@
  • - + +
    diff --git a/src/lib/components/copy.svelte b/src/lib/components/copy.svelte index ca49af4cb..5431c83fd 100644 --- a/src/lib/components/copy.svelte +++ b/src/lib/components/copy.svelte @@ -34,6 +34,8 @@ +