-
Notifications
You must be signed in to change notification settings - Fork 127
/
.eslintrc.js
110 lines (110 loc) · 3.77 KB
/
.eslintrc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
module.exports = {
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: 2020,
sourceType: "module",
project: ["./tsconfig.json", ".erb/tsconfig.json"],
tsconfigRootDir: __dirname,
createDefaultProgram: true,
},
plugins: ["simple-import-sort", "strict-booleans", "react-hooks", "prettier", "@stylexjs", "lodash"],
extends: [
"plugin:react/recommended",
"eslint:recommended",
// 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
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript",
"plugin:storybook/recommended",
"plugin:jest/recommended",
"plugin:promise/recommended",
// Make sure prettier goes last
"prettier",
],
settings: {
react: {
version: "detect",
},
"import/resolver": {
// See https://github.com/benmosher/eslint-plugin-import/issues/1396#issuecomment-575727774 for line below
node: {},
webpack: {
config: require.resolve("./.erb/configs/webpack.config.eslint.ts"),
},
typescript: {},
},
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"],
},
},
env: {
browser: true,
node: true,
},
rules: {
"prettier/prettier": [
"error",
{
semi: true,
trailingComma: "all",
singleQuote: false,
printWidth: 120,
tabWidth: 2,
},
],
"arrow-body-style": "off",
"prefer-arrow-callback": "off",
// 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": "off",
"react/display-name": "off",
"react/no-unescaped-entities": "warn",
"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
},
],
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/explicit-member-accessibility": ["error", { overrides: { constructors: "no-public" } }],
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/consistent-type-imports": "warn",
"promise/always-return": "off",
"promise/catch-or-return": [
"warn",
{
allowFinally: true,
},
],
"import/no-named-as-default-member": "off",
"simple-import-sort/imports": "warn",
"simple-import-sort/exports": "warn",
"strict-booleans/no-nullable-numbers": "error",
"no-undef": "off",
"new-cap": "error",
"@typescript-eslint/consistent-type-imports": "warn",
"@typescript-eslint/no-non-null-assertion": "off",
"react-hooks/rules-of-hooks": "error", // Checks rules of Hooks
"react-hooks/exhaustive-deps": "warn", // Checks effect dependencies
curly: "error",
"@typescript-eslint/explicit-function-return-type": "off",
"no-param-reassign": ["error", { props: false }],
// A temporary hack related to IDE not resolving correct package.json
"import/no-extraneous-dependencies": "off",
"import/no-unresolved": "error",
// Since React 17 and typescript 4.1 you can safely disable the rule
"react/react-in-jsx-scope": "off",
"react/jsx-boolean-value": ["error", "always"],
"react/no-unstable-nested-components": "error",
"@stylexjs/valid-styles": "error",
"lodash/chaining": "error",
"lodash/import-scope": [2, "method"],
"no-restricted-imports": ["error", "lodash/chain"],
"react/jsx-curly-brace-presence": ["error", "never"]
},
ignorePatterns: ["/*.js", "node_modules"],
};