File tree Expand file tree Collapse file tree 9 files changed +17
-939
lines changed
packages/svelte-file-tree Expand file tree Collapse file tree 9 files changed +17
-939
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ concurrency:
12
12
13
13
jobs :
14
14
check :
15
- name : Check
15
+ name : Svelte Check
16
16
runs-on : ubuntu-latest
17
17
steps :
18
18
- uses : actions/checkout@v4
28
28
- name : Build
29
29
run : pnpm build
30
30
31
- - run : pnpm check
31
+ - name : Run Svelte Check
32
+ run : pnpm check
32
33
33
34
# TODO: re-enable tests in CI
34
35
# test:
51
52
# - run: pnpm test
52
53
53
54
lint :
54
- name : Lint
55
+ name : Formatting
55
56
runs-on : ubuntu-latest
56
57
steps :
57
58
- uses : actions/checkout@v4
67
68
- name : Build
68
69
run : pnpm build
69
70
70
- - run : pnpm lint
71
+ - name : Run Prettier
72
+ run : pnpm format:check
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 9
9
"build:preview" : " pnpm build:packages && pnpm -F preview build" ,
10
10
"check" : " pnpm --parallel check" ,
11
11
"format" : " pnpm --parallel format" ,
12
- "lint " : " pnpm --parallel format:check && eslint . "
12
+ "format:check " : " pnpm --parallel format:check"
13
13
},
14
14
"devDependencies" : {
15
15
"@changesets/cli" : " ^2.28.1" ,
16
- "@eslint/js" : " ^9.21.0" ,
17
- "eslint" : " ^9.21.0" ,
18
- "eslint-plugin-svelte" : " ^3.0.2" ,
19
- "globals" : " ^16.0.0" ,
20
- "playwright" : " ^1.50.1" ,
21
- "typescript" : " ^5.8.2" ,
22
- "typescript-eslint" : " ^8.26.0"
16
+ "playwright" : " ^1.50.1"
23
17
},
24
18
"pnpm" : {
25
19
"onlyBuiltDependencies" : [
28
22
]
29
23
},
30
24
"packageManager" : " pnpm@10.4.1+sha512.c753b6c3ad7afa13af388fa6d808035a008e30ea9993f58c6663e2bc5ff21679aa834db094987129aa4d488b86df57f7b634981b2f827cdcacc698cc0cfb88af"
31
- }
25
+ }
Original file line number Diff line number Diff line change @@ -487,18 +487,23 @@ export function createTreeState<TData extends FileTreeNodeData>({
487
487
}
488
488
489
489
function copyNode ( node : FileTreeNode < TData > ) : FileTreeNode < TData > {
490
+ if ( DEV && Object . getPrototypeOf ( node . data ) !== Object . prototype ) {
491
+ throw new Error ( "Expected the data property to be a POJO" ) ;
492
+ }
493
+
490
494
const id = generateCopyId ( ) ;
495
+ const data = $state . snapshot ( node . data ) as TData ;
491
496
switch ( node . type ) {
492
497
case "file" : {
493
498
return new FileNode ( {
494
499
id,
495
- data : structuredClone ( node . data ) ,
500
+ data,
496
501
} ) ;
497
502
}
498
503
case "folder" : {
499
504
return new FolderNode ( {
500
505
id,
501
- data : structuredClone ( node . data ) ,
506
+ data,
502
507
children : node . children . map ( copyNode ) ,
503
508
} ) ;
504
509
}
Original file line number Diff line number Diff line change 129
129
const navigate = down ? treeState .getNextItem : treeState .getPreviousItem ;
130
130
const shouldSelectMultiple = event .shiftKey && isControlOrMeta (event );
131
131
const maxScrollDistance = Math .min (
132
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
133
132
document .getElementById (treeState .id ())! .clientHeight ,
134
133
document .documentElement .clientHeight ,
135
134
);
201
200
break ;
202
201
}
203
202
case " End" : {
204
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
205
203
let last = treeState .tree ().children .at (- 1 )! ;
206
204
while (
207
205
last .type === " folder" &&
208
206
treeState .expandedIds ().has (last .id ) &&
209
207
last .children .length !== 0
210
208
) {
211
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
212
209
last = last .children .at (- 1 )! ;
213
210
}
214
211
Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ import type { EventHandler } from "svelte/elements";
2
2
3
3
// https://developer.mozilla.org/en-US/docs/Web/API/Navigator/platform#examples
4
4
export function isControlOrMeta ( event : KeyboardEvent | MouseEvent ) : boolean {
5
- // eslint-disable-next-line @typescript-eslint/no-deprecated
6
5
if ( navigator . platform . startsWith ( "Mac" ) || navigator . platform === "iPhone" ) {
7
6
return event . metaKey ;
8
7
}
Original file line number Diff line number Diff line change @@ -8,11 +8,7 @@ export default {
8
8
config ( config ) {
9
9
return {
10
10
...config ,
11
- include : [
12
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
13
- ...config . include ,
14
- "../vitest.workspace.ts" ,
15
- ] ,
11
+ include : [ ...config . include , "../vitest.workspace.ts" ] ,
16
12
} ;
17
13
} ,
18
14
} ,
You can’t perform that action at this time.
0 commit comments