Collection of dependencies for NodeJS Typescript projects
Contains dependencies that can be used as devDependencies to work with a Typescript project containing Eslint for linting and Jest for testing. For the list of included dependencies see package.json. The dependencies have fixed versions, they are updated by Dependabot automatic dependency updates.
- Install NodeJS
- Change to your application folder
- Run
npm init -y
. This will initialize the NodeJS project and create a package.json file. - Run
npm i -D @sgohlke/ts-base-dependencies
. This will install the necessary devDependencies. - Run
npx tsc --init
or copy the tsconfig.json file from this project to your project. - Run
npx ts-jest config:init
or copy the jest.config.js and jest.setup.ts files from this project to your project. - Run
npm init @eslint/config
. When asked if you want to use Typescript answer "yes". Or copy the .eslintrc.json file from this project to your project. - Create "src" folder
- Change "package.json" scripts to contain the scripts below.
- Add the files in the "src" file.
- To test eslint works add some unused variable and run
npm run lint
. This should indicate that unused code is found. - To test jest works add a test file and run
npm test
. This should run the test and show the test result.
Scripts in package.json file:
"scripts": {
"check": "tsc --noEmit --pretty",
"lint": "eslint src/*.ts",
"test": "jest"
}
You can update all dependencies included in this project/"library" at once by updating to a new version of @sgohlke/ts-base-dependencies.