-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
172 lines (169 loc) · 5.4 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
const process = require('process')
module.exports = {
extends: [
'next/core-web-vitals',
'next',
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
'plugin:react/recommended',
'plugin:@conarti/feature-sliced/recommended',
'plugin:jsx-a11y/recommended',
'plugin:sonarjs/recommended',
'plugin:import/recommended',
'plugin:import/typescript',
],
ignorePatterns: ['.eslintrc.js', 'next.config.js', 'jest.config.ts', 'public/**'],
parserOptions: {
ecmaFeatures: {
jsx: true,
},
project: './tsconfig.json',
tsconfigRootDir: __dirname,
ecmaVersion: 'latest',
parser: '@typescript-eslint/parser',
},
plugins: ['react', '@typescript-eslint', 'react-refresh', 'sonarjs', 'jsdoc', 'prettier'],
settings: {
'import/resolver': {
typescript: {
alwaysTryTypes: true,
typescript: true,
node: true,
},
},
},
rules: {
'react/prop-types': 'off',
'react/react-in-jsx-scope': 'off',
'react/display-name': 'off',
'react-hooks/exhaustive-deps': 'off',
// 'no-use-before-define': 'warn',
quotes: ['warn', 'single'],
'linebreak-style': ['warn', process.platform === 'win32' ? 'windows' : 'unix'],
semi: ['error', 'never', { beforeStatementContinuationChars: 'never' }],
curly: ['error', 'multi'],
'arrow-parens': ['error', 'as-needed'],
'arrow-body-style': ['error', 'as-needed'],
'no-console': ['warn', { allow: ['warn', 'error'] }],
camelcase: 'error',
'react/jsx-props-no-spreading': 'error',
'import/no-named-as-default': 'off',
'@typescript-eslint/no-shadow': 'error',
'@typescript-eslint/adjacent-overload-signatures': 'error',
'@typescript-eslint/prefer-function-type': 'error',
'@typescript-eslint/restrict-plus-operands': 'error',
'@typescript-eslint/consistent-type-definitions': 'error',
'@typescript-eslint/explicit-member-accessibility': 'error',
'@typescript-eslint/member-ordering': [
'error',
{ default: ['signature', 'method', 'constructor', 'field'] },
],
'@typescript-eslint/no-confusing-non-null-assertion': 'error',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-require-imports': 'error',
'@typescript-eslint/prefer-includes': 'error',
'@typescript-eslint/prefer-optional-chain': 'error',
'@typescript-eslint/require-array-sort-compare': 'error',
'@typescript-eslint/switch-exhaustiveness-check': 'error',
'@typescript-eslint/no-empty-interface': [
'error',
{
allowSingleExtends: false,
},
],
'@typescript-eslint/no-inferrable-types': 'error',
'@typescript-eslint/no-misused-new': 'error',
'@typescript-eslint/no-non-null-assertion': 'error',
'@typescript-eslint/no-unused-vars': 'warn',
'@typescript-eslint/type-annotation-spacing': 'error',
'@typescript-eslint/unified-signatures': 'error',
'jsdoc/require-description-complete-sentence': [
'error',
{
tags: ['see', 'copyright'],
},
],
'jsdoc/require-param': [
'error',
{
checkDestructured: true,
},
],
'jsdoc/require-param-name': 'error',
'jsdoc/require-param-description': 'error',
'jsdoc/check-tag-names': 'error',
'jsdoc/no-types': 'error',
'func-style': [
'error',
'declaration',
{
allowArrowFunctions: true,
},
],
'jsdoc/check-alignment': 'error',
'jsdoc/no-bad-blocks': 'error',
'@typescript-eslint/consistent-type-imports': [
'error',
{
prefer: 'type-imports',
fixStyle: 'inline-type-imports',
},
],
'react/self-closing-comp': ['error', { component: true, html: true }],
'react/no-unknown-property': ['error', { ignore: ['css'] }],
'no-restricted-imports': [
'error',
{
patterns: [
'../**/app/',
'../**/pages/',
'../**/widgets/',
'../**/features/',
'../**/entities/',
'../**/shared/',
],
},
],
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
// для accessibility
'jsx-a11y/alt-text': 'error',
'jsx-a11y/click-events-have-key-events': 'error',
'jsx-a11y/no-static-element-interactions': 'error',
'jsx-a11y/mouse-events-have-key-events': 'error',
'jsx-a11y/label-has-associated-control': 'error',
'jsx-a11y/no-noninteractive-element-interactions': [
'error',
{
handlers: ['onClick', 'onMouseDown', 'onMouseUp', 'onKeyPress', 'onKeyDown', 'onKeyUp'],
},
],
'jsx-a11y/no-interactive-element-to-noninteractive-role': [
'error',
{
tr: ['none', 'presentation'],
},
],
'jsx-a11y/no-noninteractive-element-to-interactive-role': [
'error',
{
ul: ['listbox', 'menu', 'menubar', 'radiogroup', 'tablist', 'tree', 'treegrid'],
ol: ['listbox', 'menu', 'menubar', 'radiogroup', 'tablist', 'tree', 'treegrid'],
li: ['menuitem', 'option', 'row', 'tab', 'treeitem'],
table: ['grid'],
td: ['gridcell'],
},
],
'jsx-a11y/no-noninteractive-tabindex': [
'error',
{
tags: [],
roles: ['tabpanel'],
},
],
'sonarjs/prefer-immediate-return': 'error',
'sonarjs/no-duplicate-string': 'error',
'sonarjs/cognitive-complexity': 'error',
},
}