generated from jimador/typescript-node-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.eslintrc.js
109 lines (104 loc) · 2.75 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
module.exports = {
env: {
'node': true,
'jest/globals': true,
},
plugins: ['@typescript-eslint', 'jest', 'import', 'unused-imports', 'eslint-plugin-tsdoc'],
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:jest/recommended',
'prettier',
'prettier/@typescript-eslint',
],
globals: {
Atomics: 'readonly',
SharedArrayBuffer: 'readonly',
},
settings: {
'import/extensions': ['.js', '.ts'],
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
'import/resolver': {
node: {
extensions: ['.js', '.ts'],
},
},
},
parser: '@typescript-eslint/parser',
parserOptions: {
tsconfigRootDir: __dirname,
ecmaVersion: 2018,
sourceType: 'module',
},
rules: {
// Opt-in
'tsdoc/syntax': 'warn',
'unused-imports/no-unused-imports-ts': 'error',
'object-shorthand': 'error',
// Opt-out
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-explicit-any': 'off',
// Configure
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: ['/test/**/*', '**/*.test.js', '**/*.spec.js'],
optionalDependencies: false,
peerDependencies: false,
},
],
'import/order': [
'error',
{
'groups': ['builtin', ['external', 'internal'], ['parent', 'sibling'], ['index']],
'newlines-between': 'always',
'alphabetize': {
order: 'asc',
caseInsensitive: true,
},
},
],
// line spacing
'padding-line-between-statements': [
'error',
// wildcard inclusions
{
blankLine: 'always',
prev: ['multiline-block-like', 'multiline-const', 'multiline-expression'],
next: '*',
},
{
blankLine: 'always',
prev: '*',
next: ['multiline-block-like', 'multiline-const', 'multiline-expression', 'switch', 'return'],
},
// specific exclusions for case statements
{ blankLine: 'never', prev: 'case', next: 'multiline-block-like' },
{ blankLine: 'never', prev: 'multiline-block-like', next: 'case' },
],
// ignore unused vars prefixed with '_'
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
vars: 'all',
varsIgnorePattern: '^_',
args: 'after-used',
argsIgnorePattern: '^_',
},
],
},
ignorePatterns: ['build', 'node_modules'],
overrides: [
{
files: ['*.test.*'],
rules: {
'@typescript-eslint/explicit-function-return-type': ['off'],
'import/no-extraneous-dependencies': 'off',
},
},
],
}