generated from Salmon42/ts-lib-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.cjs
95 lines (82 loc) · 2.06 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
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
/** @type {import('@types/eslint').ESLint.ConfigData} */
module.exports = {
root: true,
env: {
browser: true,
},
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module'
},
ignorePatterns: [
// Ignored folders
'dist',
"docs",
// Ignored patterns
'lib/**/*.d.ts',
// Ignored files
'.eslintrc.cjs',
'types/vite-env.d.ts',
'typedoc.config.cjs',
],
plugins: [
'@stylistic',
'@typescript-eslint',
],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended'
],
rules: {
// General JS/TS
'no-console': process.env.NODE_ENV === 'production' ?
['error', { allow: ['warn', 'error', 'info'] }] :
['warn', { allow: ['warn', 'error', 'info'] }],
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-empty': 'warn',
// 'no-unused-vars': process.env.NODE_ENV === 'production' ? 'error' : 'warn',
'@typescript-eslint/no-unused-vars': process.env.NODE_ENV === 'production' ? 'error' : 'warn',
// ---- ---- TypeScript only
'@typescript-eslint/no-explicit-any': 'off',
'@stylistic/type-generic-spacing': ['warn'],
'@stylistic/type-named-tuple-spacing': ['warn'],
// ---- ---- Code formatting
'@stylistic/semi': process.env.NODE_ENV === 'production' ? ['error', 'never'] : ['warn', 'never'],
'@stylistic/quotes': ['warn', 'single'],
'@stylistic/comma-dangle': ['warn', 'always-multiline'],
'@stylistic/brace-style': ['error', 'stroustrup', { allowSingleLine: true }],
'@stylistic/no-trailing-spaces': ['warn'],
'@stylistic/spaced-comment': ['warn', 'always'],
'@stylistic/no-multi-spaces': ['warn'],
'@stylistic/space-before-function-paren': ['warn', 'always'],
'@stylistic/indent': [
'warn',
'tab',
{
'SwitchCase': 0,
}
],
'@stylistic/no-tabs': [
'warn',
{
allowIndentationTabs: true,
}
],
'@stylistic/no-multiple-empty-lines': [
'warn',
{
max: 2,
maxBOF: 0,
maxEOF: 0
},
],
'@stylistic/padded-blocks': [
'warn',
'never',
{
allowSingleLineBlocks: true,
}
],
}
}