Skip to content

Instantly share code, notes, and snippets.

@darksinge
Last active October 5, 2022 16:10
Show Gist options
  • Save darksinge/f2d125e0036e624fbead522eaabd8694 to your computer and use it in GitHub Desktop.
Save darksinge/f2d125e0036e624fbead522eaabd8694 to your computer and use it in GitHub Desktop.
Eslint+prettier setup

Typescript Setup (npm)

Install dependencies

$ npm i --save-dev eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin prettier eslint-config-prettier eslint-plugin-prettier

.eslintrc.js

module.exports = {
  env: {
    browser: true,
    es2021: true,
  },
  extends: [
    'plugin:@typescript-eslint/recommended',
    'plugin:prettier/recommended',
  ],
  env: {
    node: true,
    jest: true,
  },
  parser: '@typescript-eslint/parser',
  parserOptions: {
    ecmaVersion: 'latest',
    sourceType: 'module',
  },
  plugins: ['@typescript-eslint', 'prettier'],
  rules: {
    'prettier/prettier': 'warn',
    '@typescript-eslint/no-explicit-any': 'off',
  },
  ignorePatterns: ['jest.config.js', 'dist/**/*'],
}

.prettierrc.json

{
  "semi": false,
  "trailingComma": "all",
  "singleQuote": true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment