-
Notifications
You must be signed in to change notification settings - Fork 1
/
.eslintrc.cjs
67 lines (62 loc) · 1.77 KB
/
.eslintrc.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
/* eslint sort-keys: "error" */
// The nicest rules
const nicest = {
'@typescript-eslint/no-unused-vars': [
'error',
// allow unused vars starting with _
{
argsIgnorePattern: '^_',
ignoreRestSiblings: true,
varsIgnorePattern: '^_',
},
],
'default-param-last': 1,
eqeqeq: [2, 'allow-null'], // == and != are nice for null+undefined
'no-console': 2, // we want a clean console - eslint-disable every wanted one
'no-implicit-coercion': [2, {allow: ['!!']}], // !! is fun
'no-shadow': 2, // sometimes causes logic bugs.
'object-shorthand': 2,
'prefer-destructuring': [
2,
{AssignmentExpression: {array: false, object: false}},
],
'prettier/prettier': 1, // don't distract while programming
'valid-typeof': [2, {requireStringLiterals: true}],
}
// Would be nice to make these error
const maybe = {
'@typescript-eslint/ban-ts-comment': 1,
'no-warning-comments': 1, // set to 0 and remove allowWarning from unicorn rule above
'require-atomic-updates': 1, // too many false positives
}
// these rules suck
const suck = {
'@typescript-eslint/no-explicit-any': 0,
'capitalized-comments': 0,
'no-eq-null': 0,
'no-mixed-operators': 0,
'one-var': 0,
'padding-line-between-statements': 0,
'prefer-template': 0,
}
const rules = {...nicest, ...maybe, ...suck}
module.exports = {
env: {
commonjs: true,
es6: true,
node: true,
'vitest-globals/env': true,
},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:vitest-globals/recommended',
// Keep this last, it overrides all style rules
'plugin:prettier/recommended',
],
ignorePatterns: ['/build/**/*', '/coverage/**/*', '/dist/**/*'],
parser: '@typescript-eslint/parser',
plugins: ['prefer-arrow', 'prettier', '@typescript-eslint'],
reportUnusedDisableDirectives: true,
rules,
}