Adds typescript support for ESLint, prettier integration for better code formatting and eslint-plugin-jsx-a11y
for accesibility errors.
pnpm i --save-dev eslint @typescript-eslint/parser eslint-plugin-jsx-a11y eslint-plugin-prettier eslint-config-prettier
ESLint config
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:jsx-a11y/recommended',
'plugin:react-hooks/recommended',
// This disables the formatting rules in ESLint that Prettier is going to be responsible for handling.
// Make sure it's always the last config, so it gets the chance to override other configs.
"plugin:prettier/recommended",
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
plugins: ['react-refresh'],
rules: {
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
}