-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbase.js
82 lines (76 loc) · 2.68 KB
/
base.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
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import importXPlugin from 'eslint-plugin-import-x';
import stylistic from '@stylistic/eslint-plugin';
import simpleImportSort from 'eslint-plugin-simple-import-sort';
import { createTypeScriptImportResolver } from 'eslint-import-resolver-typescript';
const baseConfig = tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
importXPlugin.flatConfigs.recommended,
{
settings: {
'import-x/resolver-next': [
createTypeScriptImportResolver()
],
},
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
}
}],
'import-x/no-duplicates': 'error',
// Disabled rules from presets
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'import-x/no-unresolved': 'off',
},
},
{
files: ['*.test.*', '*.spec.*'],
rules: {
'prefer-promise-reject-errors': 'off',
'no-param-reassign': 'off',
'@typescript-eslint/no-shadow': 'off',
},
},
);
export default baseConfig;