-
Notifications
You must be signed in to change notification settings - Fork 4
/
eslint.config.js
83 lines (77 loc) · 2.27 KB
/
eslint.config.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
/*
Eslint doesn't like that this file is using commonjs module syntax.
Hopefully, we will be able to migrate the whole project to ES modules eventually.
In the meantime, the linting of this file is disabled.
*/
/* eslint-disable */
const eslint = require('@eslint/js');
const tseslint = require('typescript-eslint');
const prettierConfig = require('eslint-config-prettier');
const reactPlugin = require('eslint-plugin-react');
const reactHooksPlugin = require('eslint-plugin-react-hooks');
const reactRecommended = require('eslint-plugin-react/configs/recommended');
const jestPlugin = require('eslint-plugin-jest');
module.exports = tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
reactRecommended,
reactPlugin.configs.flat['jsx-runtime'],
prettierConfig,
{
languageOptions: {
parserOptions: {
sourceType: 'module',
ecmaFeatures: {
jsx: true
}
},
},
plugins: {
react: reactPlugin
},
rules: {
'no-console': [1, { allow: ['error', 'info', 'warn'] }],
'@typescript-eslint/camelcase': 0,
'@typescript-eslint/interface-name-prefix': 0,
'@typescript-eslint/prefer-interface': 0,
'@typescript-eslint/explicit-function-return-type': 0,
'@typescript-eslint/explicit-module-boundary-types': 0,
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/no-use-before-define': 0,
'@typescript-eslint/no-unused-vars': ['warn', { args: 'after-used' }],
'react/display-name': 0,
'react/prop-types': 0,
'react/no-unescaped-entities': 0,
'prettier/prettier': 0,
'no-unused-vars': 'off',
'no-unneeded-ternary': 'error',
'no-empty': 'error',
'eqeqeq': 'error'
},
settings: {
react: {
version: 'detect' // Makes eslint-plugin-react automatically detect React version
}
}
},
// settings for eslint-plugin-react-hooks
{
plugins: {
'react-hooks': reactHooksPlugin,
},
rules: {
'react-hooks/rules-of-hooks': 2
},
},
// settings for eslint-plugin-jest
{
plugins: {
'jest': jestPlugin,
},
rules: {
'jest/no-focused-tests': 'error',
'jest/no-identical-title': 'error',
'jest/valid-expect': 'error'
},
},
);