Skip to content

Instantly share code, notes, and snippets.

@travishorn
Last active June 7, 2023 16:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save travishorn/67d66ad896f31274c1c4c727c74992ea to your computer and use it in GitHub Desktop.
Save travishorn/67d66ad896f31274c1c4c727c74992ea to your computer and use it in GitHub Desktop.
Set up project with ESLint and Prettier

Install the VS Code extension:

  1. Open VS Code
  2. Ctrl + Shift + X
  3. Search for "ESLint"
  4. Click the blue "Install" button

In your project, install the dependencies

npm i -D eslint eslint-config-prettier eslint-plugin-prettier prettier

Create an .eslintrc.cjs with the contents below.

module.exports = {
extends: ["eslint:recommended", "plugin:prettier/recommended"],
parserOptions: { ecmaVersion: "latest", sourceType: "module" },
env: { node: true },
};
// If you use common JS modules instead of ESM, use this file instead.
// Use the same name (`.eslintrc.cjs`)
module.exports = {
extends: ["eslint:recommended", "plugin:prettier/recommended"],
parserOptions: { ecmaVersion: "latest" },
env: { node: true },
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment