Skip to content

Instantly share code, notes, and snippets.

@plastic041
Created May 5, 2021 12:02
Show Gist options
  • Save plastic041/2e02aa7cff84ecd6f0740fb5d3b79fcf to your computer and use it in GitHub Desktop.
Save plastic041/2e02aa7cff84ecd6f0740fb5d3b79fcf to your computer and use it in GitHub Desktop.
Eslint settings

yarn

yarn add -D @typescript-eslint/eslint-plugin @typescript-eslint/parser babel-eslint eslint-config-airbnb-typescript eslint-config-react-app eslint-import-resolver-typescript eslint-plugin-flowtype eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-react eslint-plugin-react-hooks

.eslintrc.js

module.exports = {
  env: {
    browser: true,
    es2020: true,
  },
  extends: ['plugin:react/recommended', 'airbnb-typescript'],
  parser: '@typescript-eslint/parser',
  parserOptions: {
    ecmaFeatures: {
      jsx: true,
    },
    ecmaVersion: 2020,
    sourceType: 'module',
    project: ['./tsconfig.json'],
  },
  plugins: ['react', '@typescript-eslint'],
  rules: {
    'linebreak-style': 0,
    'no-use-before-define': 'off',
    '@typescript-eslint/no-use-before-define':	 ['error'],
    'react/jsx-filename-extension': [
      2,
      { extensions: ['.js', '.jsx', '.ts', '.tsx'] },
    ],
  },
  ignorePatterns: ['.eslintrc.js'],
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment