Skip to content

Instantly share code, notes, and snippets.

@ianschmitz
Created July 7, 2022 04: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 ianschmitz/ba47bcc6e5e0d0093fbdf1246b40dc3c to your computer and use it in GitHub Desktop.
Save ianschmitz/ba47bcc6e5e0d0093fbdf1246b40dc3c to your computer and use it in GitHub Desktop.
Current ESLint config
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaFeatures: {
jsx: true,
},
tsconfigRootDir: __dirname,
project: "./tsconfig.json",
},
env: {
es2020: true,
browser: true,
jest: true,
node: true,
},
settings: {
// Fixes no-unresolved resolution of .jsx modules.
"import/resolver": {
node: {
extensions: [".js", ".jsx", ".ts", ".tsx"],
},
},
react: {
version: "detect",
},
},
plugins: [
"@typescript-eslint",
"import",
"jest",
"jsx-a11y",
"react",
"react-hooks",
],
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:import/errors",
"plugin:import/warnings",
"prettier",
"plugin:jest/recommended",
"plugin:jest/style",
"plugin:jsx-a11y/recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
],
rules: {
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/prefer-nullish-coalescing": "warn",
"@typescript-eslint/prefer-optional-chain": "warn",
curly: "warn",
"jest/expect-expect": [
"warn",
{
assertFunctionNames: ["expect*"],
},
],
"jsx-a11y/no-autofocus": "off",
// Low value with TypeScript.
"import/named": "off",
"import/no-unresolved": "off",
"import/order": ["warn", { alphabetize: { order: "asc" } }],
"prefer-const": "warn",
"react/display-name": "off",
"react/no-unescaped-entities": "off",
"react/no-unstable-nested-components": [
"error",
{ allowAsProps: true },
],
"react/prop-types": "off",
"react/react-in-jsx-scope": "off",
// Disallow top level imports from MUI to avoid pulling in unused modules.
"no-restricted-imports": [
"error",
"@mui/core",
"@mui/material",
"@mui/system",
"@testing-library/react",
],
"sort-keys": "warn",
"no-console": "warn",
"no-prototype-builtins": "off",
"no-var": "error",
},
overrides: [
{
files: "**/__tests__/*",
// Rules that are lower value in tests
rules: {
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
},
},
],
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment