forked from signalapp/libsignal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
86 lines (69 loc) · 2.06 KB
/
.eslintrc.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
// For reference: https://github.com/airbnb/javascript
module.exports = {
root: true,
parserOptions: {
project: './tsconfig.json',
ecmaVersion: 2018,
sourceType: 'module',
},
settings: {
'import/core-modules': ['electron'],
},
plugins: ['header', 'import', 'mocha', 'more', '@typescript-eslint'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
],
rules: {
'header/header': [
2,
'line',
[
'',
{ pattern: ' Copyright \\d{4}(-\\d{4})? Signal Messenger, LLC.' },
' SPDX-License-Identifier: AGPL-3.0-only',
'',
],
],
'comma-dangle': [
'error',
{
arrays: 'always-multiline',
objects: 'always-multiline',
imports: 'always-multiline',
exports: 'always-multiline',
functions: 'never',
},
],
// prevents us from accidentally checking in exclusive tests (`.only`):
'mocha/no-exclusive-tests': 'error',
// encourage consistent use of `async` / `await` instead of `then`
'more/no-then': 'error',
// it helps readability to put public API at top,
'no-use-before-define': 'off',
// useful for unused or internal fields
'no-underscore-dangle': 'off',
// useful for unused parameters
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
],
// though we have a logger, we still remap console to log to disk
'no-console': 'error',
// consistently place operators at end of line except ternaries
'operator-linebreak': 'error',
quotes: [
'error',
'single',
{ avoidEscape: true, allowTemplateLiterals: false },
],
// We prefer named exports
'import/prefer-default-export': 'off',
'@typescript-eslint/no-require-imports': 'error',
'@typescript-eslint/consistent-type-assertions': 'error',
'@typescript-eslint/explicit-module-boundary-types': 'error',
},
};