-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.cjs
122 lines (105 loc) · 3.16 KB
/
index.cjs
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
module.exports = {
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
rules: {
// This reverts the "no null" decision from xo
'@typescript-eslint/ban-types': 'off',
// This would be nice in an ideal world, even warnings are too much
'@typescript-eslint/naming-convention': 'off',
// This can be too dangerous if not all values exist in the type
'@typescript-eslint/switch-exhaustiveness-check': 'off',
// These rules are too restrictive
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
// Enable Typescript version of no-unused-vars
'@typescript-eslint/no-unused-vars': [
'error',
{
vars: 'all',
args: 'after-used',
ignoreRestSiblings: true,
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrors: 'all',
caughtErrorsIgnorePattern: '^_$',
},
],
// This rule is too restrictive
'@typescript-eslint/restrict-template-expressions': 'off',
// We prefer interfaces
'@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
// Let’s enable this when we switch to ESM
'import/extensions': 'off',
// Arbitrary import order rules
'import/order': [
'error',
{
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
pathGroups: [
{
pattern: '@/lib/**',
group: 'internal',
position: 'after',
},
{
pattern: '@/tests/**',
group: 'internal',
position: 'after',
},
{
pattern: '@/types/**',
group: 'internal',
position: 'after',
},
{
pattern: '@/!(lib|tests|types)/**',
group: 'internal',
position: 'after',
},
],
'newlines-between': 'always',
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
},
],
// Disable in favor of @typescript-eslint/no-unused-vars
'no-unused-vars': 'off',
// Let’s only warn one using reduce
'unicorn/no-array-reduce': 'warn',
// These rules are broken
'unicorn/no-array-callback-reference': 'off',
'unicorn/no-array-method-this-argument': 'off',
'unicorn/no-thenable': 'off',
'unicorn/prevent-abbreviations': [
'error',
{
replacements: {
// We don’t want fnSku to be replaced anywhere
fn: false,
// This is ok
i: false,
props: false,
},
},
],
// Let’s not use ESM yet
'unicorn/prefer-module': 'off',
// This sorts named imports
'sort-imports': [
'error',
{
ignoreCase: true,
ignoreDeclarationSort: true,
},
],
// Some dependencies do not respect this, let’s only warn
camelcase: 'warn',
// Broken rule, let’s not use
'n/file-extension-in-import': 'off',
},
}