-
Notifications
You must be signed in to change notification settings - Fork 22
/
xo.config.cjs
104 lines (88 loc) · 3.54 KB
/
xo.config.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
const OFF = 0
const WARN = 1
const ERROR = 2
const NEVER = 'never'
const ALWAYS = 'always'
module.exports = {
plugins: ['unused-imports'],
// use existing prettier config
prettier: true,
ignore: [
// not bothering with config files & scripts for now
'*.cjs',
'*.js',
// or with the demo
'demos/**/*',
],
rules: {
// ADDED RULES
'unused-imports/no-unused-imports': ERROR,
'unused-imports/no-unused-vars': [
ERROR,
{
vars: 'all',
varsIgnorePattern: '^_',
args: 'after-used',
argsIgnorePattern: '^_',
},
],
// DISABLED RULES
'@typescript-eslint/consistent-type-assertions': OFF, // sometimes you need to assert
'@typescript-eslint/no-empty-function': OFF, // don't see the problem
'@typescript-eslint/no-implicit-any-catch': OFF, // deprecated
'@typescript-eslint/padding-line-between-statements': OFF, // leave formatting to prettierjs
'capitalized-comments': OFF, // case in point this comment
'default-case': OFF, // not necessary with typescript
'guard-for-in': OFF, // not necessary with typescript
'import/no-extraneous-dependencies': OFF, // haven't figured out how to make this work with monorepo
'n/file-extension-in-import': OFF, // duplicate of import/extensions
'n/prefer-global/process': OFF, // use globalThis
'no-else-return': OFF, // don't agree
'unicorn/no-array-reduce': OFF, // sometimes I like to reduce
'unicorn/no-negated-condition': OFF, // sometimes prefer to keep conditions in a certain order
'unicorn/prefer-node-protocol': OFF, // false positives with /util folder
'unicorn/prefer-spread': OFF, // don't find [...a] readable compared to a.split('')
'unicorn/prevent-abbreviations': OFF, // gets mad about "numLikes" etc.
// DISABLED FOR EXPEDIENCY, MIGHT REVISIT
'max-params': OFF,
'no-prototype-builtins': OFF,
'import/no-unassigned-import': OFF,
'unicorn/no-array-callback-reference': OFF,
'unicorn/prefer-event-target': OFF,
'no-warning-comments': OFF,
'unicorn/filename-case': OFF,
'unicorn/no-object-as-default-parameter': OFF,
'unicorn/prefer-array-some': OFF,
'@typescript-eslint/default-param-last': OFF,
'@typescript-eslint/no-unsafe-argument': OFF,
'@typescript-eslint/no-unsafe-assignment': OFF,
'@typescript-eslint/no-unsafe-return': OFF,
'@typescript-eslint/no-unsafe-call': OFF,
'@typescript-eslint/member-ordering': OFF,
'@typescript-eslint/no-redeclare': OFF,
'import/order': OFF,
'max-nested-callbacks': OFF,
complexity: OFF,
// MODIFIED RULES
// default makes us wrap every arrow function shorthand expression with braces,
// which spreads a single line out to 3 lines
'@typescript-eslint/no-confusing-void-expression': [WARN, { ignoreArrowShorthand: true }],
// default is camelCase only. We want PascalCase for React components, and UPPER_CASE for constants.
'@typescript-eslint/naming-convention': [
ERROR,
{
selector: 'variable',
format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
leadingUnderscore: 'allow',
},
],
// require file extensions on imports
'import/extensions': [ERROR, ALWAYS, { ignorePackages: true }],
// default is kebabCase
'unicorn/filename-case': [ERROR, { cases: { camelCase: true, pascalCase: true } }],
// don't flag wallaby magic comment `//?`
'spaced-comment': [ERROR, ALWAYS, { line: { markers: ['?'] } }],
'ava/no-import-test-files': [ERROR, { files: ['*.test.ts'] }],
},
overrides: [],
}