-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.js
109 lines (109 loc) · 3.1 KB
/
index.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
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
extends: [
'plugin:react/recommended',
'plugin:@typescript-eslint/stylistic',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
'plugin:react-hooks/recommended',
],
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
rules: {
'@typescript-eslint/explicit-function-return-type': ['warn', { allowExpressions: true }],
'@typescript-eslint/consistent-type-definitions': 'off',
'@typescript-eslint/consistent-indexed-object-style': 'off',
'@typescript-eslint/array-type': ['warn', { default: 'array-simple' }],
'react/prop-types': 'off',
'no-console': 'warn',
'react/react-in-jsx-scope': 'off',
'react/jsx-pascal-case': [2, { allowNamespace: true }],
'no-duplicate-imports': 'error',
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'typeLike',
format: ['PascalCase'],
},
{
selector: ['variableLike', 'memberLike', 'method'],
format: ['camelCase'],
},
{
selector: 'parameter',
// allow parameters with leading underscore
leadingUnderscore: 'allow',
// PascalCase for components, camelCase for everything else
format: ['camelCase', 'PascalCase'],
},
{
selector: ['function'],
format: ['camelCase', 'PascalCase'],
},
{
selector: 'property',
leadingUnderscore: 'allowSingleOrDouble',
format: ['camelCase', 'snake_case'],
},
{
selector: 'property',
leadingUnderscore: 'allowSingleOrDouble',
modifiers: ['requiresQuotes'],
// no validation for properties that require quotes (HTTP headers, HTML properties etc.)
format: null,
},
{
selector: 'objectLiteralProperty',
leadingUnderscore: 'allowSingleOrDouble',
// PascalCase for style object properties, camelCase for everything else
format: ['camelCase', 'PascalCase'],
},
{
selector: 'objectLiteralProperty',
leadingUnderscore: 'allowSingleOrDouble',
modifiers: ['requiresQuotes'],
// no validation for object properties that require quotes (HTTP headers, HTML properties etc.)
format: null,
},
{
selector: 'enumMember',
format: ['UPPER_CASE'],
},
{
selector: 'variable',
modifiers: ['const'],
// PascalCase for components, UPPER_CASE for constants, camelCase for everything else
format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
},
],
},
overrides: [
{
files: [
'**/*.test.ts',
'**/*.spec.ts',
'**/*.test.tsx',
'**/*.spec.tsx',
'**/*.cy.ts',
'**/*.cy.tsx',
],
plugins: ['jest'],
rules: {
'jest/no-commented-out-tests': 'warn',
'jest/no-focused-tests': 'error',
'jest/no-identical-title': 'error',
},
},
],
settings: {
react: {
version: 'detect',
},
},
};