forked from PostHog/posthog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
193 lines (193 loc) · 6.17 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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
/* global module */
module.exports = {
ignorePatterns: ['node_modules', 'plugin-server'],
env: {
browser: true,
es6: true,
'cypress/globals': true,
},
settings: {
react: {
version: 'detect',
},
},
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:react/recommended',
'plugin:eslint-comments/recommended',
'plugin:storybook/recommended',
'prettier',
],
globals: {
Atomics: 'readonly',
SharedArrayBuffer: 'readonly',
},
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 2018,
sourceType: 'module',
},
plugins: ['prettier', 'react', 'cypress', '@typescript-eslint', 'no-only-tests'],
rules: {
'no-only-tests/no-only-tests': 'error',
'react/prop-types': [0],
'react/react-in-jsx-scope': [0],
'react/no-unescaped-entities': [0],
'react/jsx-no-target-blank': [0],
'react/self-closing-comp': [
'error',
{
component: true,
html: true,
},
],
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
ignoreRestSiblings: true,
},
],
'@typescript-eslint/prefer-ts-expect-error': 'error',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-non-null-assertion': 'error',
curly: 'error',
'no-restricted-imports': [
'error',
{
paths: [
{
name: 'dayjs',
message: 'Do not directly import dayjs. Only import the dayjs exported from lib/dayjs.',
},
],
},
],
'react/forbid-dom-props': [
1,
{
forbid: [
{
propName: 'style',
message:
'style should be avoided in favor of utility CSS classes - see https://storybook.posthog.net/?path=/docs/lemon-ui-utilities--overview',
},
],
},
],
'react/forbid-elements': [
1,
{
forbid: [
{
element: 'Row',
message:
'use flex utility classes instead, e.g. <Row align="middle"> could be <div className="flex items-center">',
},
{
element: 'Col',
message: 'use flex utility classes instead - most of the time can simply be a plain <div>',
},
{
element: 'Space',
message: 'use flex or space utility classes instead',
},
{
element: 'Card',
message: 'use utility classes instead',
},
{
element: 'Button',
message: 'use <LemonButton> instead',
},
{
element: 'Input.TextArea',
message: 'use <LemonTextArea> instead',
},
{
element: 'Input',
message: 'use <LemonInput> instead',
},
{
element: 'Skeleton',
message: 'use <LemonSkeleton> instead',
},
{
element: 'Tabs',
message: 'use <LemonTabs> instead',
},
{
element: 'a',
message: 'use <Link> instead',
},
],
},
],
'react/forbid-elements': [
2,
{
forbid: [
{
element: 'Layout',
message: 'use utility classes instead',
},
{
element: 'Spin',
message: 'use Spinner instead',
},
{
element: 'Badge',
message: 'use LemonBadge instead',
},
{
element: 'Collapse',
message: 'use <LemonCollapse> instead',
},
],
},
],
},
overrides: [
{
// disable these rules for files generated by kea-typegen
files: ['*Type.ts', '*Type.tsx'],
rules: {
'@typescript-eslint/no-explicit-any': ['off'],
'@typescript-eslint/ban-types': ['off'],
},
},
{
// enable the rule specifically for TypeScript files
files: ['*.ts', '*.tsx'],
rules: {
'@typescript-eslint/no-explicit-any': ['off'],
'@typescript-eslint/explicit-function-return-type': [
'error',
{
allowExpressions: true,
},
],
'@typescript-eslint/explicit-module-boundary-types': [
'error',
{
allowArgumentsExplicitlyTypedAsAny: true,
},
],
},
},
{
files: ['*.js'],
rules: {
'@typescript-eslint/no-var-requires': 'off',
},
},
],
reportUnusedDisableDirectives: true,
}