generated from abriginets/nest-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
115 lines (115 loc) · 3.22 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
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
module.exports = {
parser: '@typescript-eslint/parser',
extends: [
'airbnb-base',
'plugin:@typescript-eslint/recommended',
'prettier',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
'plugin:jest/recommended',
'plugin:prettier/recommended',
],
plugins: ['@typescript-eslint', 'jest', 'prettier'],
parserOptions: {
ecmaVersion: 15,
sourceType: 'module',
},
env: {
node: true,
es6: true,
jest: true,
},
rules: {
'eol-last': ['error', 'always'],
'newline-before-return': 'warn',
'import/extensions': 0,
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: false,
optionalDependencies: false,
peerDependencies: false,
},
],
'semi': 'warn',
// comma-dangle controlled by @typescript-eslint below
'comma-dangle': 'off',
'@typescript-eslint/comma-dangle': ['error', 'always-multiline'],
// quotes controlled by @typescript-eslint below
'quotes': 'off',
'@typescript-eslint/quotes': [
'warn',
'single',
{
allowTemplateLiterals: true,
},
],
'no-shadow': 'off', // no-shadow controlled by @typescript-eslint below
'@typescript-eslint/no-shadow': ['error'],
'arrow-parens': ['warn', 'always'],
// indent controlled by prettier, no linters must be involved here
'indent': 'off',
'@typescript-eslint/indent': 'off',
// do not trust anybody, even yourself
'@typescript-eslint/no-non-null-assertion': 'off',
// unused vars are only allowed using preceeding underscore
'@typescript-eslint/no-unused-vars': [
'warn',
{
argsIgnorePattern: '^_',
},
],
// single whitespace before comment. Readability 📈📈📈
'spaced-comment': ['warn', 'always'],
// empty lines don't do anything, man
'no-multiple-empty-lines': [
'warn',
{
max: 2,
maxEOF: 0,
},
],
// no default export because why would you want to have one thing names differently across the app?
'import/prefer-default-export': 'off',
'import/export': 'off',
'import/order': [
'error',
{
'groups': [['external', 'internal', 'builtin'], ['sibling', 'parent'], 'index', 'object'],
'pathGroups': [
{
pattern: '@nestjs/**',
group: 'external',
position: 'after',
},
],
'pathGroupsExcludedImportTypes': ['builtin'],
'newlines-between': 'always',
'alphabetize': {
order: 'asc',
caseInsensitive: true,
},
},
],
// NestJS tends to have empty constructors
'no-useless-constructor': 'off',
// empty function = empty constructor as well
'no-empty-function': 'off',
// make sure to always have return type specified!
'@typescript-eslint/explicit-function-return-type': 'error',
// useless in NestJS
'class-methods-use-this': 'off',
// up to developer, feel free to disable
'consistent-return': 'off',
// NestJS tends to have circular dependencies
'import/no-cycle': 'off',
},
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.ts'],
},
},
},
};