Advertisement
soirs

My eslint setup - add AirBnb

May 20th, 2022
781
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module.exports = {
  2.   root: true,
  3.   parser: "@typescript-eslint/parser",
  4.   plugins: [
  5.     "react",
  6.     "react-hooks",
  7.     "prettier",
  8.     "no-inline-styles",
  9.     "relay",
  10.     "graphql",
  11.     "@typescript-eslint"
  12.   ],
  13.   extends: [
  14.     "react-app",
  15.     "prettier",
  16.     "plugin:relay/recommended",
  17.     "eslint:recommended",
  18.     "plugin:react/recommended"
  19.   ],
  20.   settings: {
  21.     react: {
  22.       version: "detect"
  23.     }
  24.   },
  25.   rules: {
  26.     "no-restricted-imports": [
  27.       "error",
  28.       {
  29.         paths: [
  30.           {
  31.             name: "@material-ui/core",
  32.             importNames: ["makeStyles", "withStyles"],
  33.             message: "Please import makeStyles/withStyles from @material-ui/core/styles instead."
  34.           }
  35.         ]
  36.       }
  37.     ],
  38.     "graphql/no-deprecated-fields": [
  39.       "warn",
  40.       {
  41.         env: "relay",
  42.         tagName: "graphql",
  43.         schemaJson: require("./ql/schema.json")
  44.       }
  45.     ],
  46.     "no-var": "error",
  47.     "no-debugger": "warn",
  48.     "prefer-const": "error",
  49.     "prettier/prettier": "error",
  50.     "jsx-a11y/anchor-is-valid": "off",
  51.     "react-hooks/rules-of-hooks": "error",
  52.     "react-hooks/exhaustive-deps": [
  53.       "warn",
  54.       {
  55.         additionalHooks: "(useUpdateEffect)"
  56.       }
  57.     ],
  58.     "no-console": ["warn", { allow: ["warn", "info", "error"] }],
  59.     "no-unused-expressions": "off",
  60.     "no-inline-styles/no-inline-styles": "warn",
  61.  
  62.     "react/display-name": "off",
  63.     "react/prop-types": "off",
  64.  
  65.     "react/jsx-handler-names": "warn",
  66.     "react/jsx-pascal-case": "error",
  67.     "padding-line-between-statements": [
  68.       "error",
  69.       { blankLine: "always", prev: "*", next: ["const", "let", "var"] },
  70.       { blankLine: "always", prev: ["const", "let", "var"], next: "*" },
  71.       { blankLine: "any", prev: ["const", "let", "var"], next: ["const", "let", "var"] },
  72.       {
  73.         blankLine: "always",
  74.         prev: "*",
  75.         next: [
  76.           "multiline-const",
  77.           "return",
  78.           "function",
  79.           "multiline-expression",
  80.           "multiline-block-like"
  81.         ]
  82.       },
  83.       {
  84.         blankLine: "always",
  85.         prev: ["multiline-const", "function", "multiline-expression", "multiline-block-like"],
  86.         next: "*"
  87.       }
  88.     ],
  89.     "relay/generated-flow-types": "off",
  90.     "relay/must-colocate-fragment-spreads": "warn",
  91.  
  92.     "no-unused-vars": "off",
  93.     "no-useless-catch": "off",
  94.     "@typescript-eslint/no-unused-vars": ["warn", { ignoreRestSiblings: true }],
  95.     "unused-imports/no-unused-imports": "error",
  96.     "no-use-before-define": "off", // this one is broken
  97.     "@typescript-eslint/no-use-before-define": ["off"], // this one works,
  98.     "import/order": [
  99.       "error",
  100.       {
  101.         groups: ["builtin", "external", "internal", ["parent", "sibling"]],
  102.         pathGroups: [
  103.           {
  104.             pattern: "react",
  105.             group: "external",
  106.             position: "before"
  107.           }
  108.         ],
  109.         pathGroupsExcludedImportTypes: ["react"],
  110.         "newlines-between": "always",
  111.         alphabetize: {
  112.           order: "asc",
  113.           caseInsensitive: true
  114.         }
  115.       }
  116.     ]
  117.   }
  118. };
  119.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement