git-log--graph icon indicating copy to clipboard operation
git-log--graph copied to clipboard

Add typechecking to build process

Open alexrecuenco opened this issue 1 year ago • 2 comments

I set typescript version to 5.6 until this is fixed, which will likely be soon

alexrecuenco avatar Nov 26 '24 01:11 alexrecuenco

I wouldn't be confident merging this until the linting issues are fixed, and we see the job get all the way to the build step.

I run it locally however and there are some type issues to address

Found 565 errors in 19 files.

Errors  Files
    13  ../node_modules/lodash.isregexp/index.js:11
    13  ../node_modules/postcss-sanitize/index.js:6
     1  ../src/extension.js:7
     1  main.js:1
   489  node_modules/vue-virtual-scroller/dist/vue-virtual-scroller.umd.js:3
    14  src/components/PromiseForm.vue:19
     1  src/directives/drop.js:36
     4  src/directives/moveable.js:21
     3  src/state/commit-stats.js:75
     1  src/state/store.js:129
     5  src/utils/log-parser.js:219
     1  src/views/AllBranches.vue:10
     1  src/views/CommitDetails.vue:151
     4  src/views/CommitRow.vue:21
     1  src/views/CommitsDetails.vue:60
     3  src/views/GitInput.vue:27
     1  src/views/History.vue:16
     4  src/views/MainView.vue:42
     5  src/vue-app.js:4

Although I think the Vue Extension really dislikes the jsconfig.json, and it would prefer that file be called tsconfig.json (you can still set it to allowJS: true and checkJS: true)

alexrecuenco avatar Nov 26 '24 01:11 alexrecuenco

Looks good. I'll fix the Linter messages first.

phil294 avatar Dec 07 '24 15:12 phil294

I have fixed most(all?) type and lint errors now and tried to merge your branch. After rebasing, I'm also seeing various problems in node_modules/vue-virtual-scroller/dist/vue-virtual-scroller.umd.js like in your output. Honestly I have no idea how to get rid of them. Adding a .d.ts file with custom types such as explained in https://github.com/Akryum/vue-virtual-scroller/issues/199 makes VSCode understand them and update references accordingly, but I can't seem to get rid of the errors in vue-tsc.

Also global imports (../src/globals.d.ts) is not picked up from within the web folder but I guess that could be imported somewhere. It seems problematic that the jsconfig is in the parent folder but web needs access to it... I'd very much like to avoid duplicating the jsconfig.json though, as both src and web/src follow identical rules

Also we'll need to add tsc to the /src project too, it's all supposed to be type-safe by JSDoc just as well.

The latter two points are surely solveable though, my main concern is just with vue-virtual-scroller :|

phil294 avatar Jun 10 '25 22:06 phil294

the vue virtual scroller problem is fixed by renamng jsconfig to tsconfig like you suggested, might be a TS bug https://github.com/microsoft/TypeScript/issues/40426#issuecomment-3014744110

Thanks @alexrecuenco, everything should work now after all

phil294 avatar Jun 29 '25 23:06 phil294