Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kentonishi/svelte-typescript-template

An opinionated template for my Svelte projects.
https://github.com/kentonishi/svelte-typescript-template

eslint github-pages i18n prettier svelte svelte-ts template typescript vite vscode

Last synced: 3 months ago
JSON representation

An opinionated template for my Svelte projects.

Awesome Lists containing this project

README

        

# svelte-ts-template

An opinionated template for my Svelte projects.

## ⚠️ WARNING (July 2023)

This template was created before SvelteKit had a stable and reliable TypeScript configuration. However, as of July 2023, the default SvelteKit template now uses the same core parsers and formatters as I set up in this template. Therefore, I highly recommend you refer to [SvelteKit's ``Creating a Project''](https://kit.svelte.dev/docs/creating-a-project) page instead of this template.

## What's Included

* TypeScript
* Svelte (with TS support)
* ESLint (with TS support)
* Prettier (with Svelte support)
* Preconfigured `svelte-i18n`
* GitHub Actions template for GitHub Pages
* Vite with preconfigured Svelte support
* Preconfigured VSCode settings for ESLint, i18n, etc.

I prefer this template over other existing templates for several reasons:

* Prettier properly formats everything in `.svelte` files
* ESLint properly lints and autofixes `` tags in `.svelte` files
* ESLint works with TypeScript in both `.svelte` and `.ts` files
* i18n support in Svelte components
* Easy deploy to GitHub Pages
* VSCode extensions work out of the box

At the time of writing, no other template satisfied all of the above. As an autoformat and autofix ~~ab~~user, I NEED this template. I hope you like it too!

## Usage

Click the [***Use this template***](https://github.com/KentoNishi/svelte-typescript-template/generate) button in GitHub to use this template.

Once you clone your repository, run `yarn` to install dependencies. Then, reload VSCode to refresh the ESLint extension. Finally, use the `ESLint: Fix all auto-fixable problems` command to auto-fix any file.

## Commands

```bash
yarn # install
yarn dev # dev server
yarn build # prod build
yarn format # autofix from cli
yarn serve # serve prod
yarn type:check # ts checks
yarn type:check:watch # ts checks (watch mode)
```