Install vite template with typescript
npm create vite@lates <app-name> -- --template svelte-ts
We prefer the airbnb linting, so follow the following commands and eslint setup if you have npm version. +5
npx install-peerdeps --dev eslint-config-airbnb-base
next create the eslint config file .eslintrc, and inside add the following extension:
{
"extends": "airbnb-base"
}
Since we added Typescript, we further want to add the airbnb-typescript standard
npm install eslint-config-airbnb-typescript \
@typescript-eslint/eslint-plugin@^7.0.0 \
@typescript-eslint/parser@^7.0.0 \
--save-dev
This saves the plugins relevant for typescript eslint
in our .eslintrc file, we add the following line.
extends: [
'airbnb',
+ 'airbnb-typescript/base'
]
We add the base at the end, because svelte doesn't need to have React to work.
Next, we add some parser:
{
"extends": ["airbnb", "airbnb-typescript"],
+ parserOptions: {
+ "project": "./tsconfig.json"
+ }
}
As the last step, we need to initialize our settings, run the eslint comment:
npx eslint . --ext .js,.jsx,.ts,.tsx