How to set up auto-fix on save by using the project’s Eslint config with VS Code
- By : Mydatahack
- Category : Front-End, Web Technologies
- Tags: ESLint, VS Code
This is a quick instruction to set up auto-fix on save by using the project’s eslint config with VS Code. It works for both TS and JS.
1. Install ESLint plugin for VS Code.
2. Add config to VS code
Go to Code -> Preference -> Settings (or press cmd + ,).
Search codeActionsOnSave, click edit in settings.json and add the config below.
"editor.codeActionsOnSave": { "source.fixAll.eslint": true }, "eslint.validate": ["javascript", "typescript"]