-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.eslintrc.js
94 lines (92 loc) · 2.65 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
/*
* SPDX-FileCopyrightText: 2021 Zextras <https://www.zextras.com>
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
module.exports = {
extends: ['../../node_modules/@zextras/carbonio-ui-configs/rules/eslint.js'],
plugins: ['unused-imports', 'jest-dom', 'testing-library', 'notice'],
overrides: [
{
// enable eslint-plugin-testing-library rules or preset only for test files
files: [
'**/__tests__/**/*.[jt]s?(x)',
'**/?(*.)+(spec|test).[jt]s?(x)',
'**/test-setup.tsx',
'jest-setup.ts'
],
extends: ['plugin:jest-dom/recommended', 'plugin:testing-library/react'],
rules: {
'testing-library/no-global-regexp-flag-in-query': 'error',
'testing-library/prefer-user-event': 'error',
'import/no-extraneous-dependencies': 'off'
}
}
],
rules: {
'import/order': [
'warn',
{
groups: [['builtin', 'external']],
pathGroups: [
{
pattern: 'react',
group: 'external',
position: 'before'
}
],
pathGroupsExcludedImportTypes: ['react'],
'newlines-between': 'always',
alphabetize: {
order: 'asc',
caseInsensitive: true
}
}
],
'no-console': ['error', { allow: ['error', 'warn'] }],
'notice/notice': [
'error',
{
templateFile: 'src/carbonio-ui-commons/notice.template.ts'
}
],
// sonar lint rules
'sonarjs/cognitive-complexity': 'warn',
'sonarjs/no-collapsible-if': 'warn',
'sonarjs/no-duplicate-string': 'warn',
'sonarjs/no-duplicated-branches': 'warn',
'sonarjs/no-identical-conditions': 'warn',
'sonarjs/no-identical-expressions': 'warn',
'sonarjs/no-redundant-boolean': 'warn',
'sonarjs/no-small-switch': 'warn',
'sonarjs/no-unused-collection': 'warn',
'sonarjs/no-use-of-empty-return-value': 'warn',
'sonarjs/prefer-immediate-return': 'warn',
'sonarjs/prefer-object-literal': 'warn',
'sonarjs/prefer-single-boolean-return': 'warn',
'sonarjs/prefer-while': 'warn',
'sonarjs/no-useless-catch': 'warn',
'sonarjs/no-nested-template-literals': 'warn',
'sonarjs/no-all-duplicated-branches': 'warn',
'sonarjs/no-gratuitous-expressions': 'warn',
'sonarjs/max-switch-cases': 'warn',
'sonarjs/no-empty-collection': 'warn',
'sonarjs/no-identical-functions': 'warn',
'@typescript-eslint/no-shadow': 'warn',
'@typescript-eslint/no-explicit-any': 'warn',
'no-param-reassign': [
'warn',
{ props: true, ignorePropertyModificationsFor: ['accumulator', 'state', 'event'] }
],
'unused-imports/no-unused-imports': 'warn'
},
settings: {
'import/resolver': {
node: {
moduleDirectory: ['node_modules', 'utils'],
extensions: ['.js', '.jsx', '.d.ts', '.ts', '.tsx']
}
}
},
ignorePatterns: ['notice.template.ts']
};