Skip to content

Instantly share code, notes, and snippets.

@Unalo
Last active June 13, 2021 14:47
Show Gist options
  • Save Unalo/b783b9c97ee79477152cc65bb11191a5 to your computer and use it in GitHub Desktop.
Save Unalo/b783b9c97ee79477152cc65bb11191a5 to your computer and use it in GitHub Desktop.

Eslint For VsCode

ESLint is a tool for formatting (linting) your code. It analyze your code and warn you of any potential errors. In order for it to work, you need to configure it with specific rules. Luckily, Standard provides an ESLint configuration that anyone can use.

  1. First we need to install Node.js
  2. Inside your current project. Initialize npm configuration. Using this command. npm init -y
  3. Now enable support for linting common JavaScript features. Paste this in your terminal
    • npm i -D eslint eslint-config-standard eslint-plugin-import eslint-plugin-node eslint-plugin-promise eslint-plugin-standard
  4. Now create a .eslintrc.js file, use this command touch .eslintrc.js
  5. Add the following content inside your .eslintrc. Paste this inside your .eslintrc.js file.
    "extends": "standard"
    };
    
  6. Open VsCode and press Ctrl + Shift + X
  7. Type ESLint in the search bar
  8. Find ESLint in the results, then click the Install
  9. Go ahead and close VSCode and then re-open it again.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment