1. Mkdir Create a folder.

  2. Search for ESLint in the VSCode extension and install it;

  3. Execute NPM init to generate package.json file;

  4. NPM I typescript eslint -d installs typescript and ESLint;

  5. Shift + command + p or run eslint –init to generate.eslintrc.js;

  6. Click enable ESLint in the lower right corner of the VSCode editor;

  7. Restart vscode;

  8. To create the index.ts file in the root directory, add the statement console.log(‘1’) and add “no-unused-vars” to the rules rule in the.eslintrc.js file: 2 Verify whether ESLint takes effect.

  9. You can configure esLint rules in the.vscode setting.json file, such as automatically formatting code when saving files:

    {
      "editor.codeActionsOnSave": {
            "source.fixAll": true}}Copy the code