-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy path.eslintrc.js
118 lines (118 loc) · 3.54 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
comment: true,
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 'latest',
project: true,
sourceType: 'module',
},
extends: [
'plugin:react/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
],
overrides: [
{
files: ['**/src/**/*.ts', '**/src/**/*.tsx'],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
extends: ['plugin:@typescript-eslint/recommended'],
overrides: [
{
// 3) Now we enable eslint-plugin-testing-library rules or preset only for matching testing files!
files: ['**/?(*.)+(spec).ts?(x)'],
extends: ['plugin:testing-library/react'],
},
],
rules: {
'react/prop-types': 'off',
'@typescript-eslint/no-unused-vars': 'error',
},
},
],
settings: {
react: {
version: 'detect',
},
},
plugins: ['@typescript-eslint', 'react-hooks', 'eslint-plugin-react-hooks'],
rules: {
'sort-imports': [
'error',
{
ignoreDeclarationSort: true,
},
],
'no-restricted-imports': [
'error',
{
patterns: [
{
group: ['@patternfly/react-icons/dist/esm**'],
message: 'Import using the full js path `@patternfly/react-icons/dist/js/icons<icon>` instead',
},
{
group: ['@patternfly/react-tokens/dist/esm**'],
message: 'Import using the full js path `@patternfly/react-tokens/dist/js/icons<icon>` instead',
},
],
paths: [
{
name: '@patternfly/react-icons',
message: 'Import using full path `@patternfly/react-icons/dist/js/icons<icon>` instead',
},
{
name: '@patternfly/react-tokens',
message: 'Import using full path `@patternfly/react-tokens/dist/js/<token>` instead',
},
{
name: '@patternfly/react-core',
importNames: ['ActionGroup'],
message: 'Use FlightCtlActionGroup wrapper',
},
{
name: '@patternfly/react-core',
importNames: ['DescriptionList'],
message: 'Use FlightCtlDescriptionList wrapper',
},
{
name: '@patternfly/react-core',
importNames: ['Form'],
message: 'Use FlightCtlForm wrapper',
},
{
name: 'react-i18next',
importNames: ['useTranslation'],
message: 'Import useTranslation from @flightctl/ui-components/hooks/useTranslation instead',
},
{
name: 'lodash',
message: 'Import using full path `lodash/<function>` instead',
},
],
},
],
'@typescript-eslint/explicit-function-return-type': 'off',
'react/self-closing-comp': 'error',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'error',
'react/prop-types': 'off',
'@typescript-eslint/interface-name-prefix': 'off',
'prettier/prettier': 'off',
'import/no-unresolved': 'off',
'import/extensions': 'off',
'no-console': 'error',
'testing-library/prefer-user-event': 'error',
'@typescript-eslint/no-misused-promises': 'off',
'@typescript-eslint/no-floating-promises': 'off',
'@typescript-eslint/no-unsafe-enum-comparison': 'off',
},
env: {
browser: true,
node: true,
},
ignorePatterns: ['*.json'],
};