Skip to content

Instantly share code, notes, and snippets.

@fkirc
Last active September 17, 2020 11:22
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 fkirc/8c62c360255e82f11b9eb3815142326b to your computer and use it in GitHub Desktop.
Save fkirc/8c62c360255e82f11b9eb3815142326b to your computer and use it in GitHub Desktop.
ESLint React configuration (combined with Prettier + WebStorm)
module.exports = {
extends: [
"react-app",
"plugin:@typescript-eslint/recommended",
"prettier/@typescript-eslint",
"plugin:prettier/recommended",
"prettier/react",
],
plugins: [
"simple-import-sort"
],
rules: {
"require-await": "error",
"no-var": "error",
"@typescript-eslint/no-non-null-assertion": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/ban-ts-ignore": "error",
"simple-import-sort/sort": "error",
"@typescript-eslint/no-unused-vars": ["error", {"args": "none"}],
"@typescript-eslint/explicit-function-return-type": "off",
"react-hooks/exhaustive-deps": "off",
"@typescript-eslint/no-empty-interface": "off",
}
};
@fkirc
Copy link
Author

fkirc commented May 9, 2020

To be combined with a strict TypeScript config https://gist.github.com/fkirc/8fd2a4cb0289a0a0fd03381318eb2ed0.

WebStorm - ESLint:

  • Automatic ESLint configuration
  • Run eslint --fix on save

package.json:

  "lint-staged": {
    "src/**/*.{ts,tsx}": [
      "npx eslint --ignore-path=.gitignore --fix"
    ]
  },
  "husky": {
    "hooks": {
      "pre-commit": "npx lint-staged"
    }
  },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment