Skip to content

Instantly share code, notes, and snippets.

@MiguelMachado-dev
Last active August 1, 2019 14:55
Show Gist options
  • Save MiguelMachado-dev/eebaea75a43cde4d0732527d26f04fae to your computer and use it in GitHub Desktop.
Save MiguelMachado-dev/eebaea75a43cde4d0732527d26f04fae to your computer and use it in GitHub Desktop.
Install eslint nodeJS

Install the packages

yarn add eslint prettier eslint-config-prettier eslint-plugin-prettier -D

Run yarn eslint --init

In eslintrc.js, paste and override the next code

module.exports = {
  env: {
    es6: true,
    node: true
  },
  extends: ["airbnb-base", "prettier"],
  plugins: ["prettier"],
  globals: {
    Atomics: "readonly",
    SharedArrayBuffer: "readonly"
  },
  parserOptions: {
    ecmaVersion: 2018,
    sourceType: "module"
  },
  rules: {
    "prettier/prettier": "error",
    "class-methods-use-this": "off",
    "no-param-reassign": "off",
    camelcase: "off",
    "no-unused-vars": ["error", { argsIgnorePattern: "next" }]
  }
};

Create .prettierrc file

paste this code in this file:

{
  "singleQuote": true,
  "trailingComma": "es5"
}

Auto fix your code

And run yarn eslint --fix src --ext .js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment