-
Notifications
You must be signed in to change notification settings - Fork 5
/
.eslintrc.js
76 lines (65 loc) · 2.86 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
module.exports = {
globals: {
__PATH_PREFIX__: true,
},
extends: ['eslint-config-kentcdodds', 'eslint-config-kentcdodds/react'],
ignorePatterns: ['vite.config.ts', '__mocks__'],
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
plugins: ['formatjs', 'unused-imports', 'import'],
rules: {
// Want to make sure imports and exports are always formatted correctly
'unused-imports/no-unused-imports': 'error',
'import/first': 'error',
'import/newline-after-import': 'error',
'import/no-duplicates': 'error',
// Only turning off right now to see more actual issues
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
// Helpful for dev but probably should turn these on eventually
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
// Helpful for dev... maybe make different settings for 'final code'?
'no-console': 'off',
// Design decision we made for how we like code
'react/destructuring-assignment': 'error',
'no-tabs': 'error',
// We're using a new React so I think this is safe
'react/react-in-jsx-scope': 'off',
// Just do not agree with this one
'no-negated-condition': 'off',
'formatjs/enforce-placeholders': 'error',
// 'formatjs/no-literal-string-in-jsx': 'error',
'react/iframe-missing-sandbox': 'error',
'react/jsx-no-leaked-render': 'error',
'no-constant-binary-expression': 'error',
// We should never have these unless commented and explained
'react-hooks/exhaustive-deps': 'error',
// Original LoadingButton can cause issues with Google Translate
// https://github.com/mui/material-ui/issues/27853
// https://github.com/facebook/react/issues/11538
'no-restricted-imports': [
'error',
{
name: '@mui/lab',
importNames: ['LoadingButton'],
message: 'Please use SafeLoadingButton instead.',
},
{
name: '@emotion/react',
message: 'Do not access emotion directly. Load through MUI',
},
],
// TODO: gatsby will release a minor version allowing gatsby-config.mts (ES modules with TS), so let's turn off the rule import/no-import-module-exports until we migrate the gatsby-config and gatsby-node to .mts
'import/no-import-module-exports': 'off',
'react/display-name': 'off',
'react/jsx-filename-extension': [1, { extensions: ['.jsx', '.tsx'] }],
'quotes': 'off',
},
settings: {
'import/core-modules': ['prop-types', 'pg'],
},
};