reactjstypescripteslinteslintrc

What is the reason ESlint doesn't work in VS Code


ESlint does not hook the code and does not give errors when saving, but if you run the npm run lint command, then the errors are shown, I will attach screenshots with the settings

enter image description here

enter image description here

enter image description here

    "@typescript-eslint/eslint-plugin": "^5.12.1",
    "@typescript-eslint/parser": "^5.12.1",
    "eslint": "^8.10.0",
    "eslint-config-airbnb": "^19.0.4",
    "eslint-plugin-import": "^2.25.4",
    "eslint-plugin-jsx-a11y": "^6.5.1",
    "eslint-plugin-react": "^7.29.2",
    "eslint-plugin-react-hooks": "^4.3.0",

Solution

  • You can check this steps:

    1. Install eslint extention on vscode
    2. From vscode settings, formatting section, uncheck Format on save
    3. Add settings to .vscode folder

    Depending on which features/presets you are using, you can add the related options to .vscode/settings.json

    {
      "editor.formatOnSave": true,
      "editor.codeActionsOnSave": [
        "source.fixAll.eslint"
      ],
      "eslint.validate": ["javascript", "javascriptreact", "typescript", "vue"]
    }
    
    1. Close and re-open vscode