Skip to content

Commit bc1624f

Browse files
authored
chore: configure knip (#13016)
* chore: configure knip * bump vitest * ok prettier * remove some unused warnings * ugh computers are the worst * just shut up
1 parent 5aa082c commit bc1624f

File tree

14 files changed

+180
-224
lines changed

14 files changed

+180
-224
lines changed

Diff for: packages/svelte/knip.json

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"$schema": "https://unpkg.com/knip@5/schema.json",
3+
"entry": [
4+
"src/*/index.js",
5+
"src/index-client.ts",
6+
"src/index-server.ts",
7+
"src/index.d.ts",
8+
"tests/**/*.js",
9+
"tests/**/*.ts",
10+
"!tests/**/*.svelte",
11+
"!tests/**/*.svelte.js",
12+
"!tests/**/_output",
13+
"!tests/runtime-browser/driver.js",
14+
"!tests/runtime-browser/driver-ssr.js",
15+
"!tests/types/component.ts"
16+
],
17+
"project": ["src/**"]
18+
}

Diff for: packages/svelte/messages/client-errors/errors.md

-4
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,3 @@
7979
## state_unsafe_mutation
8080

8181
> Updating state inside a derived is forbidden. If the value should not be reactive, declare it without `$state`
82-
83-
## svelte_component_invalid_this_value
84-
85-
> The `this={...}` property of a `<svelte:component>` must be a Svelte component, if defined

Diff for: packages/svelte/messages/compile-errors/template.md

-4
Original file line numberDiff line numberDiff line change
@@ -302,10 +302,6 @@ HTML restricts where certain elements can appear. In case of a violation the bro
302302

303303
> `<svelte:fragment>` must be the direct child of a component
304304
305-
## svelte_fragment_invalid_slot
306-
307-
> `<svelte:fragment>` slot attribute must have a static value
308-
309305
## svelte_head_illegal_attribute
310306

311307
> `<svelte:head>` cannot have attributes nor directives

Diff for: packages/svelte/messages/compile-warnings/script.md

-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
## derived_iife
2-
3-
> Use `$derived.by(() => {...})` instead of `$derived((() => {...})())`
4-
51
## export_let_unused
62

73
> Component has unused export property '%name%'. If it is for external reference only, please consider using `export const %name%`

Diff for: packages/svelte/package.json

+6-14
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,16 @@
124124
"@rollup/plugin-terser": "^0.4.4",
125125
"@rollup/plugin-virtual": "^3.0.2",
126126
"@types/aria-query": "^5.0.4",
127+
"@types/node": "^20.11.5",
127128
"dts-buddy": "^0.5.1",
128129
"esbuild": "^0.19.11",
130+
"eslint": "^9.6.0",
131+
"prettier": "^3.2.4",
129132
"rollup": "^4.9.5",
130133
"source-map": "^0.7.4",
131-
"tiny-glob": "^0.2.9"
134+
"tiny-glob": "^0.2.9",
135+
"typescript": "^5.5.2",
136+
"vitest": "^1.2.1"
132137
},
133138
"dependencies": {
134139
"@ampproject/remapping": "^2.2.1",
@@ -144,18 +149,5 @@
144149
"locate-character": "^3.0.0",
145150
"magic-string": "^0.30.5",
146151
"zimmerframe": "^1.1.2"
147-
},
148-
"knip": {
149-
"entry": [
150-
"src/*/index.js",
151-
"src/index-client.ts",
152-
"src/index-server.ts",
153-
"src/index.d.ts",
154-
"tests/**/*.js",
155-
"tests/**/*.ts"
156-
],
157-
"project": [
158-
"src/**"
159-
]
160152
}
161153
}

Diff for: packages/svelte/src/compiler/errors.js

-9
Original file line numberDiff line numberDiff line change
@@ -1246,15 +1246,6 @@ export function svelte_fragment_invalid_placement(node) {
12461246
e(node, "svelte_fragment_invalid_placement", "`<svelte:fragment>` must be the direct child of a component");
12471247
}
12481248

1249-
/**
1250-
* `<svelte:fragment>` slot attribute must have a static value
1251-
* @param {null | number | NodeLike} node
1252-
* @returns {never}
1253-
*/
1254-
export function svelte_fragment_invalid_slot(node) {
1255-
e(node, "svelte_fragment_invalid_slot", "`<svelte:fragment>` slot attribute must have a static value");
1256-
}
1257-
12581249
/**
12591250
* `<svelte:head>` cannot have attributes nor directives
12601251
* @param {null | number | NodeLike} node

Diff for: packages/svelte/src/compiler/warnings.js

-9
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ export const codes = [
9494
"options_removed_hydratable",
9595
"options_removed_loop_guard_timeout",
9696
"options_renamed_ssr_dom",
97-
"derived_iife",
9897
"export_let_unused",
9998
"legacy_component_creation",
10099
"non_reactive_update",
@@ -574,14 +573,6 @@ export function options_renamed_ssr_dom(node) {
574573
w(node, "options_renamed_ssr_dom", "`generate: \"dom\"` and `generate: \"ssr\"` options have been renamed to \"client\" and \"server\" respectively");
575574
}
576575

577-
/**
578-
* Use `$derived.by(() => {...})` instead of `$derived((() => {...})())`
579-
* @param {null | NodeLike} node
580-
*/
581-
export function derived_iife(node) {
582-
w(node, "derived_iife", "Use `$derived.by(() => {...})` instead of `$derived((() => {...})())`");
583-
}
584-
585576
/**
586577
* Component has unused export property '%name%'. If it is for external reference only, please consider using `export const %name%`
587578
* @param {null | NodeLike} node

Diff for: packages/svelte/src/internal/client/errors.js

-16
Original file line numberDiff line numberDiff line change
@@ -340,20 +340,4 @@ export function state_unsafe_mutation() {
340340
// TODO print a link to the documentation
341341
throw new Error("state_unsafe_mutation");
342342
}
343-
}
344-
345-
/**
346-
* The `this={...}` property of a `<svelte:component>` must be a Svelte component, if defined
347-
* @returns {never}
348-
*/
349-
export function svelte_component_invalid_this_value() {
350-
if (DEV) {
351-
const error = new Error(`svelte_component_invalid_this_value\nThe \`this={...}\` property of a \`<svelte:component>\` must be a Svelte component, if defined`);
352-
353-
error.name = 'Svelte error';
354-
throw error;
355-
} else {
356-
// TODO print a link to the documentation
357-
throw new Error("svelte_component_invalid_this_value");
358-
}
359343
}

Diff for: packages/svelte/tests/sourcemaps/samples/markup/test.js

-34
This file was deleted.

Diff for: packages/svelte/tests/sourcemaps/samples/source-map-generator/test.js

-1
This file was deleted.

Diff for: packages/svelte/tests/sourcemaps/samples/sourcemap-basename-without-outputname/test.js

-2
This file was deleted.

Diff for: packages/svelte/tests/sourcemaps/samples/sourcemap-names/test.js

-41
This file was deleted.

Diff for: packages/svelte/tsconfig.json

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"strict": true,
1515
"allowJs": true,
1616
"checkJs": true,
17+
"skipLibCheck": true,
1718
"paths": {
1819
"acorn-typescript": ["./src/compiler/phases/1-parse/ambient.d.ts"],
1920
"svelte": ["./src/index.d.ts"],

0 commit comments

Comments
 (0)