New project setup #
Node.js, TypeScript, tsx, eslint, prettier #
npm init
npm i typescript tsx prettier @types/node @tsconfig/strictest eslint-config-prettier --save-dev
npx tsc --init --noEmit
npm init @eslint/config@latest
Do the following changes in eslint.config.mjs
import eslintConfigPrettier from "eslint-config-prettier";
export default [
// ...
tseslint.configs.strictTypeChecked,
eslintConfigPrettier,
{
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
}
];
.prettierrc
contents
{
"singleQuote": true
}
package.json
scripts
{
"scripts": {
"test": "tsx --test",
"lint": "eslint",
"compile": "tsc --noEmit",
"start": "tsx index.ts"
}
}
tsconfig.json
changes
{
"compilerOptions": {
"...": "",
"checkJs": false
},
"extends": "@tsconfig/strictest/tsconfig.json"
}
Webstorm settings #
- Run prettier on save