Skip to content

Instantly share code, notes, and snippets.

@ayushgupta11
Created May 9, 2024 05:08
Show Gist options
  • Save ayushgupta11/b90e713521b36febed3a82b01961a3d2 to your computer and use it in GitHub Desktop.
Save ayushgupta11/b90e713521b36febed3a82b01961a3d2 to your computer and use it in GitHub Desktop.
.eslintrc.json for typescript + react
{
"env": {
"browser": true,
"es2021": true,
"jest": true
},
"extends": [
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
"prettier",
"plugin:prettier/recommended",
"plugin:import/recommended",
"plugin:import/typescript"
],
"overrides": [],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": [ "react", "@typescript-eslint", "react-hooks" ],
"rules": {
"no-use-before-define": "off",
"@typescript-eslint/no-use-before-define": [ "error" ],
"react/jsx-filename-extension": [ "warn", { "extensions": [ ".tsx" ] } ],
"import/extensions": [ "error", "ignorePackages", { "ts": "never", "tsx": "never" } ],
"no-shadow": "off",
"@typescript-eslint/no-shadow": [ "error" ],
"@typescript-eslint/explicit-function-return-type": [ "error", { "allowExpressions": true } ],
"max-len": [ "off", { "code": 200, "ignoreComments": true, "ignoreUrls": true } ],
"max-lines": [ "warn", { "max": 200, "skipBlankLines": true, "skipComments": true } ],
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
"import/prefer-default-export": "off",
"react/prop-types": "off",
"prettier/prettier": [ "error", { "endOfLine": "auto" } ],
"@typescript-eslint/no-explicit-any": "warn"
},
"settings": {
"react": {
"version": "detect"
},
"import/resolver": {
"typescript": {
"node": {
"extensions": [".js", ".jsx", ".ts", ".tsx"],
"moduleDirectory": ["node_modules", "src/"]
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment