-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.mjs
139 lines (133 loc) · 4.5 KB
/
eslint.config.mjs
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
import globals from 'globals'
import tsParser from '@typescript-eslint/parser'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import js from '@eslint/js'
import { FlatCompat } from '@eslint/eslintrc'
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
})
export default [
{
ignores: [
'eslint.config.mjs',
'**/migrations/*',
'*.spec.ts',
'dist/*',
'.angular/*',
'node_modules/*',
'.github/*',
],
},
...compat.extends('plugin:@typescript-eslint/recommended', 'eslint:recommended'),
{
languageOptions: {
globals: {
...globals.node,
...globals.jest,
...globals.browser,
},
parser: tsParser,
ecmaVersion: 5,
sourceType: 'module',
parserOptions: {
project: 'tsconfig.json',
},
},
rules: {
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'no-extra-parens': ['error', 'all'],
'no-unreachable-loop': 'error',
semi: ['error', 'never'],
'accessor-pairs': 'error',
'array-callback-return': ['error', { checkForEach: true }],
'block-scoped-var': 'error',
'consistent-return': 'warn',
'class-methods-use-this': 'warn',
curly: 'error',
'default-case': 'warn',
'default-case-last': 'error',
'default-param-last': 'error',
'dot-location': ['error', 'property'],
'dot-notation': 'error',
eqeqeq: 'warn',
'grouped-accessor-pairs': 'warn',
'guard-for-in': 'error',
'max-classes-per-file': 'error',
'no-caller': 'error',
'no-constructor-return': 'error',
'no-else-return': 'error',
'no-empty-function': ['error', { allow: ['constructors'] }],
'no-eq-null': 'error',
'no-eval': 'error',
'no-extra-bind': 'error',
'no-extra-label': 'error',
'no-implicit-coercion': ['error', { allow: ['!!', '+'] }],
'no-invalid-this': 'error',
'no-iterator': 'error',
'no-implicit-globals': 'error',
'no-implied-eval': 'error',
'no-use-before-define': 'error',
'vars-on-top': 'error',
'require-await': 'error',
'prefer-regex-literals': 'error',
'prefer-named-capture-group': 'warn',
'no-with': 'error',
'no-void': 'error',
'no-useless-return': 'error',
'no-useless-concat': 'error',
'no-unused-vars': ['off', { vars: 'local', args: 'none' }],
'no-unused-expressions': ['error', { allowShortCircuit: true, allowTernary: true }],
'block-spacing': 'error',
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
camelcase: ['error', { ignoreGlobals: true }],
'function-paren-newline': ['error', 'consistent'],
'function-call-argument-newline': ['error', 'consistent'],
'func-style': ['error', 'declaration', { allowArrowFunctions: true }],
'func-call-spacing': 'error',
'eol-last': 'error',
'comma-style': 'error',
'comma-spacing': 'error',
'comma-dangle': ['error', 'always-multiline'],
indent: ['error', 2, { SwitchCase: 1 }],
'jsx-quotes': 'error',
'key-spacing': ['error', { beforeColon: false, afterColon: true }],
'max-len': [
'error',
{
code: 120,
ignoreUrls: true,
ignoreStrings: true,
ignoreRegExpLiterals: true,
},
],
'multiline-ternary': ['error', 'always-multiline'],
'no-lonely-if': 'error',
'no-trailing-spaces': 'error',
'no-unneeded-ternary': 'error',
'prefer-exponentiation-operator': 'error',
'spaced-comment': 'error',
'space-in-parens': 'error',
'semi-style': 'error',
'semi-spacing': 'error',
quotes: ['error', 'single', { avoidEscape: true, allowTemplateLiterals: true }],
'quote-props': ['error', 'consistent-as-needed'],
'prefer-arrow-callback': 'error',
'prefer-const': ['error', { destructuring: 'all' }],
'prefer-destructuring': ['error', { object: true, array: false }],
'object-shorthand': 'error',
'no-var': 'error',
'no-useless-rename': 'error',
'no-duplicate-imports': 'error',
'arrow-spacing': 'error',
'arrow-parens': ['error', 'as-needed'],
'arrow-body-style': ['warn', 'as-needed'],
},
},
]