https://pulumi.com logo
#typescript
Title
# typescript
s

stocky-island-3676

01/31/2020, 9:06 AM
Someone uses ESLint/TSLint for Pulumi? What are configs you recommend?
b

broad-helmet-79436

01/31/2020, 9:49 AM
I recommend using ESLint (TSLint is deprecated) and use the same config you use for all your other JS/TS code 🙂 probably with Prettier for formatting rules
n

nice-guitar-97142

01/31/2020, 3:45 PM
+1 for prettier/eslint combo, using the
@typescript-eslint
plugin. if you are looking for something to get you started, this is our
.eslintrc.json
file
Copy code
{
  "parser": "@typescript-eslint/parser",
  "plugins": [
    "@typescript-eslint",
    "prettier"
  ],
  "extends": [
    "eslint:recommended",
    "plugin:@typescript-eslint/recommended",
    "prettier/@typescript-eslint",
    "plugin:prettier/recommended"
  ],
  "rules": {
    "@typescript-eslint/member-naming": [
      "error",
      {
        "private": "^__",
        "protected": "^_"
      }
    ],
    "@typescript-eslint/camelcase": [
      "error",
      {
        "properties": "never"
      }
    ],
    "camelcase": "off"
  },
  "env": {
    "node": true
  },
  "parserOptions": {
    "ecmaVersion": 2018,
    "sourceType": "module"
  }
}
and our prettierrc json
Copy code
{
  "$schema": "<http://json.schemastore.org/prettierrc>",
  "singleQuote": true,
  "trailingComma": "none",
  "endOfLine": "lf",
  "semi": false,
  "printWidth": 120
}
t

tall-librarian-49374

01/31/2020, 5:03 PM
FWIW, we use tslint in Pulumi itself
a

ambitious-ram-5811

02/01/2020, 12:39 AM
I would consider moving away from it soon - Palantir has basically said it's no longer interested in maintaining it, so at some point it's going to block you from using new TypeScript features because TSLint won't parse
s

stocky-island-3676

02/10/2020, 4:45 PM
Thanks for all your input. @broad-helmet-79436 @nice-guitar-97142 @tall-librarian-49374 @ambitious-ram-5811
👍 1
12 Views