babichjacob / sapper-firebase-typescript-graphql-tailwindcss-actions-template

A template that includes Sapper for Svelte, Firebase functions and hosting, TypeScript and TypeGraphQL, Tailwind CSS, ESLint, and automatic building and deployment with GitHub Actions
MIT License
106 stars 14 forks source link

TS warning #1

Closed caiquelsousa closed 4 years ago

caiquelsousa commented 4 years ago

This repo seems to be an awesome boilerplate, congrats!

I was just wondering if you have the same warning as I'm having, it seems that a lot of the TS warnings is shown since it doesn't understand the imports..

image image

Do you have any extra config on your extensions? which ones are you using?

babichjacob commented 4 years ago

Thanks! There are two different issues here:

  1. Errors arising in other JavaScript files after reformatting on save. I am reasonably certain this is fixed in the new branch fix-vscode-warnings, where I created a Workspace settings file that disables VS Code's reformatting for JS and TS so that it only uses ESLint.
  2. TypeScript in Svelte components can't tell that component imports are being used in the HTMLX markup, or when stores are used with the $ prefix (TS 6133). This one is yet to be fixed, and it may be out of my hands for that to be the case (because I don't notice a difference when changing preprocessor options in svelte.config.js), but it is possible to work around this for each line with // @ts-ignore. Otherwise, you can silence all TypeScript errors/warnings in Svelte files throughout the entire project by changing "svelte.plugin.typescript.diagnostics.enable" in Workspace settings to false, which practically eliminates the point of TypeScript (at least in Svelte files).

My relevant extensions:

I have no (relevant) extra configuration for these beyond what has been posted in the Workspace settings in the new branch.

If you can check if 1. is solved (i.e. the rollup.config.js file you screenshotted will be correctly reformatted when you re-save the file in VS Code) and 2. is satisfactory, then I will go ahead and merge those changes into master.

For the future, it may be worth switching away from svelte-typescript to svelte-preprocess, because (from looking at the README) it can support both TypeScript and PostCSS in Svelte files. In this template currently, PostCSS is compiled in a separate workflow that is not ideal, and cannot support PostCSS inside Svelte files, which is a greatly missed feature to me.

babichjacob commented 4 years ago

These, and new commits on the same subject, were merged to master from #3.

Hope these work for you! Thanks!