This repository was archived by the owner on Jun 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy path.eslintrc.js
More file actions
99 lines (99 loc) · 2.76 KB
/
.eslintrc.js
File metadata and controls
99 lines (99 loc) · 2.76 KB
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
module.exports = {
env: {
browser: true,
es2015: true, // es6
jest: true,
},
globals: {
Atomics: 'readonly',
SharedArrayBuffer: 'readonly',
},
ignorePatterns: [
'node_modules/*',
'temp/*',
'built/*',
'build/*',
'lib-commonjs/*',
'lib/*',
'dist/*',
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2015, // es6
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
},
react: {
pragma: 'React',
version: 'detect',
},
jest: {
version: 27,
},
},
extends: [
'standard',
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:jest/recommended',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:jsx-a11y/recommended',
// prettier must always be last
'prettier',
],
plugins: ['@typescript-eslint', 'jest', 'react', 'react-hooks', 'jsx-a11y'],
rules: {
'@typescript-eslint/semi': 'off',
'@typescript-eslint/no-unused-vars': 'error',
'@typescript-eslint/explicit-function-return-type': 'error',
'@typescript-eslint/explicit-module-boundary-types': 'error',
'jest/no-disabled-tests': 'warn',
'jest/no-focused-tests': 'error',
'jest/no-identical-title': 'error',
'jest/prefer-to-have-length': 'warn',
'jest/valid-expect': 'error',
'no-underscore-dangle': 'off',
quotes: [
'error',
'single',
{ avoidEscape: true, allowTemplateLiterals: true },
],
'import/prefer-default-export': 'off',
'import/extensions': 'off',
'import/first': 'off', // to allow jest.mock to be placed before imports which is required by jest (ts-jest used to hoist them for us, but we don't use ts-jest anymore)
},
overrides: [
{
files: ['*.jsx', '*.tsx'],
rules: {
'@typescript-eslint/naming-convention': [
'error',
// Allow camelCase variables (23.2), PascalCase variables (23.8), and UPPER_CASE variables (23.10)
{
selector: 'variable',
format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
},
// Allow camelCase functions (23.2), and PascalCase functions (23.8)
{
selector: 'function',
format: ['camelCase', 'PascalCase'],
},
// Airbnb recommends PascalCase for classes (23.3), and although Airbnb does not make TypeScript recommendations, we are assuming this rule would similarly apply to anything "type like", including interfaces, type aliases, and enums
{
selector: 'typeLike',
format: ['PascalCase'],
},
],
},
},
]
}