Skip to content

Instantly share code, notes, and snippets.

@alevosia
Last active June 19, 2020 13:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alevosia/8ac93031d21e73e6deb180e3eac1d3fb to your computer and use it in GitHub Desktop.
Save alevosia/8ac93031d21e73e6deb180e3eac1d3fb to your computer and use it in GitHub Desktop.
An eslint configuration for React projects that use TypeScript
{
"root": true,
"parser": "@typescript-eslint/parser", // Specifies the ESLint parser
"extends": [
"react-app",
"plugin:react/recommended", // Uses the recommended rules from [eslint-plugin-react]
// Uses the recommended rules from the [@typescript-eslint/eslint-plugin]
"plugin:@typescript-eslint/recommended",
// Uses [eslint-config-prettier] to disable ESLint rules
// from @typescript-eslint/eslint-plugin that would conflict with prettier
"prettier/@typescript-eslint",
// Enables [eslint-plugin-prettier] and displays prettier errors as ESLint errors.
// Make sure this is always the last configuration in the extends array.
"plugin:prettier/recommended"
],
"parserOptions": {
"ecmaVersion": 2018, // Allows for the parsing of modern ECMAScript features
"sourceType": "module", // Allows for the use of imports
"ecmaFeatures": {
"jsx": true
}
},
"rules": {
// Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs
// e.g. "@typescript-eslint/explicit-function-return-type": "off",
"react/prop-types": [0]
},
"settings": {
"react": {
"version": "detect"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment