forked from Faire/mjml-react
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
159 lines (156 loc) · 4.13 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: 2022,
sourceType: "module",
project: "tsconfig-eslint.json",
},
env: {
node: true,
es6: true,
},
plugins: [
"@typescript-eslint",
"react",
"react-hooks",
"import",
/* testing plugins */
"jest",
"jest-dom",
"testing-library",
],
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
],
settings: {
react: {
version: "detect",
},
},
rules: {
/* eslint-rules */
// default max complexity is 20, which appears to be a reasonable point to error
complexity: "error",
curly: "error",
eqeqeq: ["error", "smart"],
"no-alert": "error",
"no-console": "error",
"no-prototype-builtins": "off",
"no-unused-vars": "off",
"no-process-env": "error",
/* typescript-eslint rules */
"@typescript-eslint/adjacent-overload-signatures": "off",
"@typescript-eslint/ban-types": [
"error",
{
types: {
IStringTMap: "Prefer Record<string, T>",
},
},
],
"@typescript-eslint/camelcase": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-member-accessibility": [
"error",
{
accessibility: "no-public",
overrides: { parameterProperties: "explicit" },
},
],
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/interface-name-prefix": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-throw-literal": "error",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-unused-expressions": [
"error",
{
allowShortCircuit: true,
allowTernary: true,
allowTaggedTemplates: true,
enforceForJSX: true,
},
],
"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
ignoreRestSiblings: true,
},
],
"@typescript-eslint/no-var-requires": "off",
/* react rules */
"react/display-name": "off",
"react/jsx-curly-brace-presence": ["error", { props: "never" }],
"react/no-deprecated": "warn",
"react/no-unescaped-entities": ["error", { forbid: [">", "}"] }],
"react/prop-types": "off",
"react/no-danger": "error",
"react/self-closing-comp": "error",
"react/function-component-definition": [
"error",
{
namedComponents: "arrow-function",
},
],
/* import rules */
"import/no-unassigned-import": "error",
"import/order": "off", // Use prettier for import order formatting
},
overrides: [
{
files: ["**/__test?(s)__/**", "**/__stories__/**"],
rules: {
"import/no-unassigned-import": "off",
},
},
{
files: ["**/?(*.)+(test).ts?(x)"],
extends: ["plugin:jest/recommended", "plugin:jest/style"],
rules: {
"jest/expect-expect": [
"warn",
{
assertFunctionNames: ["expect*"],
additionalTestBlockFunctions: [],
},
],
"jest/no-standalone-expect": [
"error",
{ additionalTestBlockFunctions: ["afterEach"] },
],
},
},
{
files: ["test/**/*"],
env: { jest: true },
rules: {
"no-undef": "off",
"@typescript-eslint/no-unused-expressions": "off",
"react/jsx-curly-brace-presence": "off",
},
},
{
files: ["**/?(*.)+(test).tsx"],
extends: ["plugin:testing-library/react", "plugin:jest-dom/recommended"],
rules: {
"testing-library/prefer-user-event": "error",
},
},
{
files: ["src/mjml/*"],
rules: {
"react/function-component-definition": "off",
},
},
],
};