-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
114 lines (107 loc) · 3.26 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
110
111
112
113
114
import eslint from '@eslint/js';
import stylistic from '@stylistic/eslint-plugin';
import pluginJsxA11y from 'eslint-plugin-jsx-a11y';
import react from 'eslint-plugin-react';
import eslintPluginReactHooks from 'eslint-plugin-react-hooks';
import simpleImportSort from 'eslint-plugin-simple-import-sort';
import tseslint from 'typescript-eslint';
export const baseConfig = tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
{
plugins: {
'@stylistic': stylistic,
'simple-import-sort': simpleImportSort,
},
rules: {
'@stylistic/arrow-parens': 'error',
'@stylistic/arrow-spacing': 'error',
'@stylistic/block-spacing': 'error',
'@stylistic/comma-dangle': ['error', 'always-multiline'],
'@stylistic/eol-last': 'error',
'@stylistic/function-call-spacing': 'error',
'@stylistic/indent': ['error', 2],
'@stylistic/key-spacing': 'error',
'@stylistic/keyword-spacing': 'error',
'@stylistic/max-len': [
'error',
// Do not allow more than 120 characters per line, except for long strings and comments in the same line
{ 'code': 120, 'ignoreComments': true, 'ignoreStrings': true, 'ignoreTemplateLiterals': true },
],
'@stylistic/no-trailing-spaces': 'error',
'@stylistic/object-curly-spacing': ['error', 'always'],
'@stylistic/quotes': ['error', 'single'],
'@stylistic/jsx-quotes': ['error', 'prefer-double'],
'@stylistic/rest-spread-spacing': 'error',
'@stylistic/semi': 'error',
'@stylistic/spaced-comment': 'error',
'@stylistic/no-multiple-empty-lines': ['error', { 'max': 1 }],
'@typescript-eslint/consistent-type-imports': 'error',
'simple-import-sort/imports': ['error', {
'groups': [
// First external imports, then local imports, then styles imports
['^', '^\\.', '\\.s?css$']
]
}],
'no-restricted-exports': ['error', {
'restrictDefaultExports': {
'direct': true,
'named': true,
'defaultFrom': true,
'namedFrom': true,
'namespaceFrom': true
}
}],
// Disabled rules from presets
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
},
},
{
files: ['*.test.*', '*.spec.*'],
rules: {
'prefer-promise-reject-errors': 'off',
'no-param-reassign': 'off',
'@typescript-eslint/no-shadow': 'off',
},
},
);
export const reactConfig = [
react.configs.flat.recommended,
react.configs.flat['jsx-runtime'],
pluginJsxA11y.flatConfigs.recommended,
{
plugins: {
'react-hooks': eslintPluginReactHooks,
},
languageOptions: {
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},
settings: {
react: {
version: 'detect'
}
},
rules: {
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'error',
// Disabled rules from presets
'react/display-name': ['off', { 'ignoreTranspilerName': false }],
'react/prop-types': 'off',
},
},
{
files: ['*.test.*', '*.spec.*'],
rules: {
'react/no-children-prop': 'off',
},
},
];
export default [
...baseConfig,
...reactConfig,
];