forked from novasamatech/nova-spektr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
121 lines (118 loc) · 3.38 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
const fs = require('fs');
const path = require('path');
const prettierConfig = fs.readFileSync('./.prettierrc', 'utf8');
const prettierOptions = JSON.parse(prettierConfig);
const checkI18n = process.env.I18N === 'true';
const localePath = path.resolve('./src/renderer/shared/api/translation/locales/en.json');
module.exports = {
root: true,
env: {
browser: true,
node: true,
jest: true,
},
globals: {
JSX: 'readonly',
},
parser: '@typescript-eslint/parser',
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:import/recommended',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:jest-dom/recommended',
'plugin:i18n-json/recommended',
'plugin:i18next/recommended',
'plugin:effector/recommended',
'plugin:effector/scope',
'prettier',
],
plugins: ['effector', '@typescript-eslint', 'prettier', 'import', 'unused-imports', 'jest-dom', 'json'],
parserOptions: {
ecmaVersion: 2021,
sourceType: 'module',
project: './tsconfig.json',
tsconfigRootDir: __dirname,
createDefaultProgram: true,
},
settings: {
react: { version: 'detect' },
'import/resolver': {
alias: {
map: [
['@', './'],
['@renderer', './src/renderer/'],
['@app', './src/renderer/app/'],
['@pages', './src/renderer/pages/'],
['@widgets', './src/renderer/widgets/'],
['@features', './src/renderer/features/'],
['@entities', './src/renderer/entities/'],
['@shared', './src/renderer/shared/'],
],
extensions: ['.js', '.jsx', '.ts', '.tsx', '.json'],
},
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx', '.json'],
},
},
},
rules: {
'import/order': [
'error',
{
groups: [
['builtin', 'external'],
['internal', 'sibling', 'parent', 'object', 'index'],
],
'newlines-between': 'always',
},
],
'no-unused-vars': 'off',
'no-irregular-whitespace': 'off',
'newline-before-return': 'error',
'@typescript-eslint/no-empty-interface': 0,
'prettier/prettier': ['error', prettierOptions],
'unused-imports/no-unused-imports': 'error',
'react/no-array-index-key': 'warn',
'react/display-name': 'off',
'react/react-in-jsx-scope': 'off',
'react/jsx-sort-props': ['error', { callbacksLast: true, noSortAlphabetically: true }],
'react/function-component-definition': [
'error',
{
namedComponents: 'arrow-function',
unnamedComponents: 'arrow-function',
},
],
'i18n-json/identical-keys': ['error', { filePath: localePath }],
'i18n-json/identical-placeholders': ['error', { filePath: localePath }],
'i18next/no-literal-string': [
checkI18n ? 'error' : 'off',
{
mode: 'jsx-text-only',
'should-validate-template': true,
'jsx-attributes': {
include: ['alt', 'aria-label', 'title', 'placeholder', 'label', 'description'],
exclude: ['data-testid', 'className'],
},
callees: {
exclude: ['Error', 'log', 'warn'],
},
words: {
exclude: ['[0-9!-/:-@[-`{-~]+', '[A-Z_-]+'],
},
},
],
},
ignorePatterns: [
'.vscode',
'coverage',
'release',
'node_modules',
'coverage.txt',
'junit.xml',
'jest-unit-results.json',
'package.json',
],
};