Skip to content

Commit dae33c9

Browse files
committed
chore: lint the new SDKs with their framework eslint plugins
Add eslint-plugin-solid, eslint-plugin-svelte and eslint-plugin-qwik to the respective packages, matching React's framework-linting depth. Qwik enables type-aware linting for src and keeps a justified no-use-visible-task disable on the event-wiring task; Svelte lints .svelte with the TS sub-parser.
1 parent ca8daeb commit dae33c9

8 files changed

Lines changed: 297 additions & 20 deletions

File tree

packages/sdk-qwik/eslint.config.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import prettierConfig from 'eslint-config-prettier';
66
import importPlugin from 'eslint-plugin-import';
77
import perfectionistPlugin from 'eslint-plugin-perfectionist';
88
import prettierPlugin from 'eslint-plugin-prettier';
9+
import qwikPlugin from 'eslint-plugin-qwik';
910
import tseslint from 'typescript-eslint';
1011

1112
export default tseslint.config(
@@ -47,6 +48,19 @@ export default tseslint.config(
4748
],
4849
},
4950
},
51+
{
52+
// Qwik rules cover the component source; `valid-lexical-scope` needs
53+
// type-aware linting, so enable the project service for src files only.
54+
files: ['src/**/*.{ts,tsx}'],
55+
plugins: { qwik: qwikPlugin.qwikEslint9Plugin },
56+
languageOptions: {
57+
parserOptions: {
58+
projectService: true,
59+
tsconfigRootDir: import.meta.dirname,
60+
},
61+
},
62+
rules: qwikPlugin.configs.recommended.rules,
63+
},
5064
{
5165
files: ['**/*.{test,spec}.{ts,tsx}', '**/__tests__/**/*.{ts,tsx}'],
5266
rules: { '@typescript-eslint/no-non-null-assertion': 'off' },

packages/sdk-qwik/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"eslint-plugin-import": "^2.31.0",
5656
"eslint-plugin-perfectionist": "^4.0.0",
5757
"eslint-plugin-prettier": "^5.0.0",
58+
"eslint-plugin-qwik": "^1.19.0",
5859
"jsdom": "catalog:",
5960
"prettier": "^3.0.0",
6061
"typescript": "^5.7.3",

packages/sdk-qwik/src/index.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ export interface ZitadelLoginProps {
4444

4545
export const ZitadelLogin = component$<ZitadelLoginProps>((props) => {
4646
const host = useSignal<HTMLElement>();
47+
// Wiring native listeners on a third-party custom element requires the DOM
48+
// post-mount; `useOn` does not catch these programmatic events.
49+
// eslint-disable-next-line qwik/no-use-visible-task
4750
useVisibleTask$(({ track, cleanup }) => {
4851
const el = track(() => host.value);
4952
if (!el) return;
@@ -81,6 +84,8 @@ export interface ZitadelLogoutProps {
8184

8285
export const ZitadelLogout = component$<ZitadelLogoutProps>((props) => {
8386
const host = useSignal<HTMLElement>();
87+
// Client-only registration of the (browser-only Lit) components.
88+
// eslint-disable-next-line qwik/no-use-visible-task
8489
useVisibleTask$(({ track }) => {
8590
const el = track(() => host.value);
8691
if (el) void import('@zitadel/components');

packages/sdk-solid/eslint.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import prettierConfig from 'eslint-config-prettier';
66
import importPlugin from 'eslint-plugin-import';
77
import perfectionistPlugin from 'eslint-plugin-perfectionist';
88
import prettierPlugin from 'eslint-plugin-prettier';
9+
import solid from 'eslint-plugin-solid/configs/typescript';
910
import tseslint from 'typescript-eslint';
1011

1112
export default tseslint.config(
@@ -47,6 +48,10 @@ export default tseslint.config(
4748
],
4849
},
4950
},
51+
{
52+
...solid,
53+
files: ['**/*.{tsx,jsx}'],
54+
},
5055
{
5156
files: ['**/*.{test,spec}.{ts,tsx}', '**/__tests__/**/*.{ts,tsx}'],
5257
rules: { '@typescript-eslint/no-non-null-assertion': 'off' },

packages/sdk-solid/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
"eslint-plugin-import": "^2.31.0",
5353
"eslint-plugin-perfectionist": "^4.0.0",
5454
"eslint-plugin-prettier": "^5.0.0",
55+
"eslint-plugin-solid": "^0.14.5",
5556
"jsdom": "catalog:",
5657
"prettier": "^3.0.0",
5758
"solid-js": "^1.9.12",

packages/sdk-svelte/eslint.config.js

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@ import prettierConfig from 'eslint-config-prettier';
66
import importPlugin from 'eslint-plugin-import';
77
import perfectionistPlugin from 'eslint-plugin-perfectionist';
88
import prettierPlugin from 'eslint-plugin-prettier';
9+
import sveltePlugin from 'eslint-plugin-svelte';
910
import tseslint from 'typescript-eslint';
1011

11-
// `.svelte` files are type-checked and linted by `svelte-check` (the `check`
12-
// script) — Svelte's first-party tool — so ESLint here covers the `.ts`/`.js`
13-
// surface, mirroring the hardened rules of the other SPA SDKs.
12+
// `.svelte` files are linted by eslint-plugin-svelte (and type-checked by
13+
// `svelte-check`, the `check` script); ESLint also covers the `.ts`/`.js`
14+
// surface with the hardened rules shared across the SPA SDKs.
1415
export default tseslint.config(
15-
{ ignores: ['dist/**', 'node_modules/**', '.svelte-kit/**', '**/*.svelte'] },
16+
{ ignores: ['dist/**', 'node_modules/**', '.svelte-kit/**'] },
1617
{
1718
...eslint.configs.recommended,
1819
files: ['**/*.{ts,js,mjs,cjs}'],
@@ -52,6 +53,17 @@ export default tseslint.config(
5253
],
5354
},
5455
},
56+
// Scope eslint-plugin-svelte strictly to `.svelte` files so its rules
57+
// (e.g. comment-directive) never run on `.ts`/`.md` without svelte context.
58+
...sveltePlugin.configs['flat/recommended'].map((c) => ({
59+
...c,
60+
files: ['**/*.svelte'],
61+
})),
62+
{
63+
// Parse `<script lang="ts">` blocks with the TypeScript parser.
64+
files: ['**/*.svelte'],
65+
languageOptions: { parserOptions: { parser: tseslint.parser } },
66+
},
5567
{
5668
files: ['**/*.{test,spec}.{ts,tsx}', '**/__tests__/**/*.{ts,tsx}'],
5769
rules: { '@typescript-eslint/no-non-null-assertion': 'off' },

packages/sdk-svelte/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
"eslint-plugin-import": "^2.31.0",
5555
"eslint-plugin-perfectionist": "^4.0.0",
5656
"eslint-plugin-prettier": "^5.0.0",
57+
"eslint-plugin-svelte": "^3.0.0",
5758
"jsdom": "catalog:",
5859
"prettier": "^3.0.0",
5960
"svelte": "^5.0.0",

pnpm-lock.yaml

Lines changed: 254 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)