forked from microsoft/BotFramework-Composer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
127 lines (120 loc) · 4.28 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
116
117
118
119
120
121
122
123
124
125
126
127
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
module.exports = {
extends: [
'eslint:recommended',
'plugin:prettier/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/eslint-recommended',
'prettier/@typescript-eslint',
'plugin:@bfc/bfcomposer/recommended',
],
plugins: ['import', 'notice', 'security', 'lodash'],
env: {
browser: true,
es6: true,
node: true,
},
rules: {
'notice/notice': [
'error',
{
mustMatch: 'Copyright \\(c\\) Microsoft Corporation',
templateFile: require.resolve('./license.js'),
},
],
// typescript
'@typescript-eslint/ban-ts-ignore': 'warn',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-unnecessary-type-assertion': 'off',
'@typescript-eslint/no-use-before-define': 'warn',
'@typescript-eslint/prefer-optional-chain': 'error',
// eslint rules
'no-dupe-class-members': 'off',
'prefer-const': 'error',
'no-var': 'error',
'no-console': 'warn',
'dot-notation': 'error',
yoda: 'error',
'no-bitwise': 'error',
// eqeqeq: 'error',
'no-underscore-dangle': [
'error',
{
// add special window.__foo__ names as exceptions here
allow: ['__nonce__', '__IS_ELECTRON__'],
// allow this._name so custom getters and setters can be written gracefully
allowAfterThis: true,
enforceInMethodNames: true,
},
],
'prefer-arrow-callback': 'error',
// plugin: import
'import/first': 'error',
'import/order': ['error', { 'newlines-between': 'always' }],
// security
'security/detect-buffer-noassert': 'error',
'security/detect-child-process': 'error',
'security/detect-disable-mustache-escape': 'error',
'security/detect-eval-with-expression': 'error',
'security/detect-new-buffer': 'error',
'security/detect-no-csrf-before-method-override': 'error',
'security/detect-non-literal-fs-filename': 'error',
'security/detect-non-literal-regexp': 'error',
'security/detect-non-literal-require': 'error',
'security/detect-object-injection': 'off',
'security/detect-possible-timing-attacks': 'error',
'security/detect-pseudoRandomBytes': 'error',
'security/detect-unsafe-regex': 'error',
// lodash
'lodash/callback-binding': 'error',
'lodash/collection-method-value': 'error',
'lodash/collection-return': 'error',
'lodash/no-double-unwrap': 'error',
'lodash/no-extra-args': 'error',
'lodash/no-unbound-this': 'error',
'lodash/unwrap': 'error',
'lodash/identity-shorthand': 'error',
'lodash/import-scope': ['error', 'method'],
'lodash/matches-prop-shorthand': 'error',
'lodash/matches-shorthand': 'error',
'lodash/path-style': 'error',
'lodash/prefer-compact': 'error',
'lodash/prefer-flat-map': 'error',
'lodash/prefer-immutable-method': 'error',
'lodash/prefer-map': 'error',
'lodash/prefer-reject': 'error',
'lodash/preferred-alias': 'error',
'lodash/prop-shorthand': 'error',
},
overrides: [
{
files: ['**/*.+(test|spec).+(js|jsx|ts|tsx)'],
env: {
jest: true,
},
rules: {
'@typescript-eslint/ban-ts-ignore': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-object-literal-type-assertion': 'off',
'@typescript-eslint/unbound-method': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'security/detect-buffer-noassert': 'off',
'security/detect-child-process': 'off',
'security/detect-disable-mustache-escape': 'off',
'security/detect-eval-with-expression': 'off',
'security/detect-new-buffer': 'off',
'security/detect-no-csrf-before-method-override': 'off',
'security/detect-non-literal-fs-filename': 'off',
'security/detect-non-literal-regexp': 'off',
'security/detect-non-literal-require': 'off',
'security/detect-object-injection': 'off',
'security/detect-possible-timing-attacks': 'off',
'security/detect-pseudoRandomBytes': 'off',
'security/detect-unsafe-regex': 'off',
},
},
],
};