Install the VS Code extensions:
- Open VS Code
- Ctrl + Shift + X
- Search for "ESLint"
- Click the blue "Install" button
- Search for "Prettier"
- Click the blue "Install" button
In your project directory (the one containing package.json), install the development dependencies:
npm i -D @eslint/js eslint eslint-config-prettier globals prettierCreate .prettierrc containing only {} or the configuration you want to use.
Create eslint.config.js with the contents below or the configuration you want to use.
Add the scripts below to package.json.
Want to add type checking?
tsconfig.json:
{ "compilerOptions": { "checkJs": true, "allowJs": true, "noEmit": true, "strict": true, "module": "NodeNext", "skipLibCheck": true }, "include": ["./**/*.js"] }package.json: