-
Notifications
You must be signed in to change notification settings - Fork 2
/
.eslintrc.js
90 lines (88 loc) · 2.44 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
87
88
89
90
module.exports = {
parser: '@typescript-eslint/parser',
ignorePatterns: ['build', '*.js'],
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
plugins: ['@typescript-eslint', 'import'],
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:import/errors',
'plugin:import/typescript',
'prettier',
],
settings: {
'import/resolver': {
typescript: {
project: `${__dirname}/tsconfig.json`,
alwaysTryTypes: true,
},
},
},
rules: {
// Require all external imports to be declared as a dependency
'import/no-extraneous-dependencies': ['error'],
// Imports must not cause cyclical dependencies
'import/no-cycle': ['error'],
// Imports must be ordered appropriately
'import/order': [
'error',
{
pathGroups: [
{
pattern: '@*/**',
group: 'parent',
},
],
},
],
// Imports must be placed before non-import statements
'import/first': 'error',
// Disallow console.* calls - these must be explicitly allowed through
// eslint comments, otherwise we assume they were unintended:
'no-console': 'error',
// Favor omitting curly brackets when possible for arrow functions
'arrow-body-style': ['error', 'as-needed'],
// Disallow names ending with an underscore_
'no-underscore-dangle': 'off',
// Require a space at the start of comments
'spaced-comment': [
'error',
'always',
{
markers: ['/'],
},
],
'@typescript-eslint/consistent-type-imports': [
'error',
{
prefer: 'type-imports',
},
],
// Disallow annotating types where the type can be easily inferred
'@typescript-eslint/no-inferrable-types': [
'error',
{
ignoreParameters: false,
ignoreProperties: false,
},
],
// Allow non-null assertions
'@typescript-eslint/no-non-null-assertion': 'off',
// Disallow using 'any' explicitly in annotations
'@typescript-eslint/no-explicit-any': 'error',
// Require promise outcomes to be properly handled
'@typescript-eslint/no-floating-promises': 'error',
// Disallow unused variables
'@typescript-eslint/no-unused-vars': [
'error',
{
args: 'after-used',
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
},
],
'@typescript-eslint/no-empty-function': 'off',
},
};