Skip to content

Commit

Permalink
Switch to TypeScript
Browse files Browse the repository at this point in the history
Fixes #243
  • Loading branch information
maiertech committed Sep 30, 2024
1 parent 52d4d36 commit a606354
Show file tree
Hide file tree
Showing 8 changed files with 613 additions and 714 deletions.
12 changes: 3 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# template-sveltekit-example

This is a [SvelteKit](https://kit.svelte.dev/) skeleton project which I use as a [GitHub template](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template) to create SvelteKit examples:

- It uses [JSDoc annotations](https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html) for TypeScript support.
- It comes with linting support for JSDoc.
- It includes workspace settings for VS Code.
This is a [SvelteKit](https://kit.svelte.dev/) skeleton project which I use as a [GitHub template](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template) to create SvelteKit examples.

## Keeping dependencies up-to-date

Expand All @@ -14,11 +10,9 @@ I update dependencies in this template regularly. These are the steps:
1. **Where should we create your project?** Hit enter to use the current directory.
1. **Directory not empty. Continue?** Yes.
1. **Which Svelte app template?** Skeleton project.
1. **Add type checking with TypeScript?** Yes, using JavaScript with JSDoc comments.
1. Add ESLint and Prettier.
1. **Add type checking with TypeScript?** Yes, using TypeScript syntax.
1. Add ESLint, Prettier and Svelte 5.
1. Revert `README.md`.
1. Run `pnpm i -D eslint-plugin-jsdoc`.
1. Check changes in `eslint.config.js` and manually revert preserving `eslint-plugin-jsdoc`.
1. Delete folder `node_modules` and file `pnpm-lock.yaml` and run `pnpm i`.

## Debugging
Expand Down
21 changes: 14 additions & 7 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import js from '@eslint/js';
import eslint from '@eslint/js';
import prettier from 'eslint-config-prettier';
import jsdoc from 'eslint-plugin-jsdoc';
import svelte from 'eslint-plugin-svelte';
import globals from 'globals';
import tseslint from 'typescript-eslint';

/** @type {import('eslint').Linter.FlatConfig[]} */
export default [
js.configs.recommended,
export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
...svelte.configs['flat/recommended'],
prettier,
...svelte.configs['flat/prettier'],
jsdoc.configs['flat/recommended'],
{
languageOptions: {
globals: {
Expand All @@ -19,7 +18,15 @@ export default [
}
}
},
{
files: ['**/*.svelte'],
languageOptions: {
parserOptions: {
parser: tseslint.parser
}
}
},
{
ignores: ['build/', '.svelte-kit/', 'dist/']
}
];
);
31 changes: 16 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,27 @@
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json --watch",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --check . && eslint .",
"format": "prettier --write ."
},
"devDependencies": {
"@sveltejs/adapter-auto": "^3.2.2",
"@sveltejs/kit": "^2.5.18",
"@sveltejs/vite-plugin-svelte": "^3.1.1",
"eslint": "^9.7.0",
"@sveltejs/adapter-auto": "^3.0.0",
"@sveltejs/kit": "^2.0.0",
"@sveltejs/vite-plugin-svelte": "^4.0.0-next.6",
"@types/eslint": "^9.6.0",
"eslint": "^9.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-jsdoc": "^48.7.0",
"eslint-plugin-svelte": "^2.42.0",
"globals": "^15.8.0",
"prettier": "^3.3.3",
"prettier-plugin-svelte": "^3.2.5",
"svelte": "^4.2.18",
"svelte-check": "^3.8.4",
"typescript": "^5.5.3",
"vite": "^5.3.4"
"eslint-plugin-svelte": "^2.36.0",
"globals": "^15.0.0",
"prettier": "^3.1.1",
"prettier-plugin-svelte": "^3.1.2",
"svelte": "^5.0.0-next.1",
"svelte-check": "^4.0.0",
"typescript": "^5.0.0",
"typescript-eslint": "^8.0.0",
"vite": "^5.0.3"
},
"type": "module"
}
Loading

0 comments on commit a606354

Please sign in to comment.