Skip to content

Instantly share code, notes, and snippets.

@okerx
Last active April 9, 2021 19:51
Show Gist options
  • Save okerx/c07af35becadc09839288da5d3760dcb to your computer and use it in GitHub Desktop.
Save okerx/c07af35becadc09839288da5d3760dcb to your computer and use it in GitHub Desktop.
Eslint Airbnb Configs for React + Typescript Project
module.exports = {
env: {
browser: true,
es2021: true,
node: true,
},
extends: [
'plugin:react/recommended',
'airbnb',
],
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
},
},
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 12,
sourceType: 'module',
},
plugins: [
'react',
'@typescript-eslint',
],
rules: {
'react/jsx-filename-extension': [1, { extensions: ['.tsx', '.ts'] }],
'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': ['error'],
'jsx-a11y/click-events-have-key-events': 'off',
'jsx-a11y/no-static-element-interactions': 'off',
'import/extensions': [
'error',
'ignorePackages',
{
js: 'never',
jsx: 'never',
ts: 'never',
tsx: 'never',
},
],
},
};

Eslint Airbnb Configs for React + Typescript Project

Install the following packages as devDeppendencies

with npm

npm install eslint @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-config-airbnb eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-react eslint-plugin-react-hooks -D

or with yarn

yarn add eslint @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-config-airbnb eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-react eslint-plugin-react-hooks -D
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment