Skip to content

Alex793x/node-full-stack-kea24

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KEA - Node Full-Stack Project Repo

Svelte Setup With TS and Eslint

Install vite template with typescript

npm create vite@lates <app-name> -- --template svelte-ts

Eslint Configuration

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"
}

Eslint for Typescript Airbnb

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"
+ }
}

Finalize Eslint

As the last step, we need to initialize our settings, run the eslint comment:

npx eslint . --ext .js,.jsx,.ts,.tsx