forked from Manuel1234477/Stellar-Micro-Donation-API
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.eslintrc.js
More file actions
51 lines (49 loc) · 1.4 KB
/
.eslintrc.js
File metadata and controls
51 lines (49 loc) · 1.4 KB
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
const hasSecurityPlugin = (() => {
try {
require.resolve('eslint-plugin-security');
return true;
} catch (error) {
return false;
}
})();
module.exports = {
env: {
node: true,
es2021: true,
jest: true,
},
extends: ['eslint:recommended'],
plugins: ['no-secrets', ...(hasSecurityPlugin ? ['security'] : [])],
parserOptions: {
ecmaVersion: 12,
},
rules: {
// Security rules
'no-secrets/no-secrets': 'error',
...(hasSecurityPlugin ? {
'security/detect-object-injection': 'warn',
'security/detect-non-literal-regexp': 'warn',
'security/detect-unsafe-regex': 'error',
'security/detect-buffer-noassert': 'error',
'security/detect-child-process': 'warn',
'security/detect-disable-mustache-escape': 'error',
'security/detect-eval-with-expression': 'error',
'security/detect-no-csrf-before-method-override': 'error',
'security/detect-non-literal-fs-filename': 'warn',
'security/detect-non-literal-require': 'warn',
'security/detect-possible-timing-attacks': 'warn',
'security/detect-pseudoRandomBytes': 'error',
} : {}),
// Code quality rules that affect security
'no-eval': 'error',
'no-implied-eval': 'error',
'no-new-func': 'error',
'no-console': 'off', // We use structured logging
},
ignorePatterns: [
'node_modules/',
'data/',
'logs/',
'coverage/',
],
};