Skip to content

Instantly share code, notes, and snippets.

@aspen-roller
Last active July 9, 2021 19:04
Show Gist options
  • Save aspen-roller/497239af1c1cad26e5f9122df1e95e1d to your computer and use it in GitHub Desktop.
Save aspen-roller/497239af1c1cad26e5f9122df1e95e1d to your computer and use it in GitHub Desktop.
vscode eslint settings #eslint #vscode
root: true
parser: "@typescript-eslint/parser"
parserOptions:
project: tsconfig.json
sourceType: module
tsConfigRootDir: __dirname
plugins:
- "@typescript-eslint"
extends:
- airbnb-typescript/base
- plugin:@typescript-eslint/recommended
- plugin:@typescript-eslint/recommended-requiring-type-checking
rules:
import/prefer-default-export: 0
no-new: 0

The following will * enable eslint in vscode * autoformat on save

Assumes that your projects are all under a cdk/ subdirectory (settings.json).

  1. install eslint extension: dbaeumer.vscode-eslint
  2. install npm dependencies
    npm i -D @typescript-eslint/{eslint-plugin,parser} eslint{,-config-airbnb-typescript,-plugin-import}
  3. add package.json updates
  4. add .eslintrc.yml
  5. add .eslintignore
  6. restart vscode
{
"scripts": {
"lint": "eslint ."
}
}
// .vscode/settings.json
{
"eslint.format.enable": true,
"eslint.validate": [
"typescript"
],
"eslint.workingDirectories": [
"./cdk",
{
"pattern": "./pulumi/*"
},
],
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment