-
Notifications
You must be signed in to change notification settings - Fork 2
/
.eslintrc
214 lines (203 loc) · 7.34 KB
/
.eslintrc
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
{
// ╔═╗╔═╗╦ ╦╔╗╔╔╦╗┬─┐┌─┐
// ║╣ ╚═╗║ ║║║║ ║ ├┬┘│
// o╚═╝╚═╝╩═╝╩╝╚╝ ╩ ┴└─└─┘
// A set of basic code conventions designed to encourage quality and consistency
// across your Sails app's code base. These rules are checked against
// automatically any time you run `npm test`.
//
// > An additional eslintrc override file is included in the `assets/` folder
// > right out of the box. This is specifically to allow for variations in acceptable
// > global variables between front-end JavaScript code designed to run in the browser
// > vs. backend code designed to run in a Node.js/Sails process.
//
// > Note: If you're using mocha, you'll want to add an extra override file to your
// > `test/` folder so that eslint will tolerate mocha-specific globals like `before`
// > and `describe`.
// Designed for ESLint v4.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// For more information about any of the rules below, check out the relevant
// reference page on eslint.org. For example, to get details on "no-sequences",
// you would visit `http://eslint.org/docs/rules/no-sequences`. If you're unsure
// or could use some advice, come by https://sailsjs.com/support.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"env": {
"node": true
},
"plugins": [
"lodash",
"security"
],
"parserOptions": {
"ecmaVersion": 8,
"ecmaFeatures": {
"experimentalObjectRestSpread": true
}
},
"globals": {
// If "no-undef" is enabled below, be sure to list all global variables that
// are used in this app's backend code (including the globalIds of models):
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"Promise": true,
"sails": true,
"_": true,
"async": true,
"before": true,
"beforeEach": true,
"after": true,
"afterEach": true,
"describe": true,
"it": true,
"app": true,
"expect": true,
// models
"Health": true,
"Schedule": true,
"Runhistory": true,
// services
"UtilService": true,
"CronService": true
},
"rules": {
"block-scoped-var": ["error"],
"callback-return": ["error", ["done", "proceed", "next", "onwards", "callback", "cb"]],
"camelcase": ["warn", {"properties":"always"}],
"comma-style": ["warn", "last"],
"curly": ["warn"],
"eqeqeq": ["error", "always"],
"eol-last": ["warn"],
"handle-callback-err": ["error"],
"indent": ["warn", 2, {
"SwitchCase": 1,
"MemberExpression": "off",
"FunctionDeclaration": {"body":1, "parameters":"off"},
"FunctionExpression": {"body":1, "parameters":"off"},
"CallExpression": {"arguments":"off"},
"ArrayExpression": 1,
"ObjectExpression": 1,
"ignoredNodes": ["ConditionalExpression"]
}],
"linebreak-style": ["error", "unix"],
"no-dupe-keys": ["error"],
"no-duplicate-case": ["error"],
"no-extra-semi": ["warn"],
"no-labels": ["error"],
"no-mixed-spaces-and-tabs": [2, "smart-tabs"],
"no-redeclare": ["warn"],
"no-return-assign": ["error", "always"],
"no-sequences": ["error"],
"no-trailing-spaces": ["warn"],
"no-undef": ["error"],
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// ^^Note: If this "no-undef" rule is enabled (set to `["error"]`), then all model globals
// (e.g. `"Organization": true`) should be included above under "globals".
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"no-unexpected-multiline": ["warn"],
"no-unreachable": ["warn"],
"no-unused-vars": ["warn", {"caughtErrors":"all", "caughtErrorsIgnorePattern": "^unused($|[A-Z].*$)", "argsIgnorePattern": "^unused($|[A-Z].*$)", "varsIgnorePattern": "^unused($|[A-Z].*$)" }],
"no-use-before-define": ["error", {"functions":false}],
"prefer-arrow-callback": ["warn", {"allowNamedFunctions":true}],
"quotes": ["warn", "single", {"avoidEscape":false, "allowTemplateLiterals":true}],
"semi": ["warn", "always"],
"semi-spacing": ["warn", {"before":false, "after":true}],
"semi-style": ["warn", "last"],
// Lodash
"lodash/callback-binding": "error",
"lodash/collection-method-value": "warn",
"lodash/collection-return": "error",
"lodash/no-double-unwrap": "error",
"lodash/no-extra-args": "error",
"lodash/no-unbound-this": "error",
"lodash/unwrap": "error",
"lodash/chain-style": [
"error",
"as-needed"
],
"lodash/chaining": [
"error",
"always",
3
],
"lodash/consistent-compose": [
"error",
"flow"
],
"lodash/identity-shorthand": [
"error",
"always"
],
"lodash/import-scope": "off",
"lodash/matches-prop-shorthand": [
"error",
"always"
],
"lodash/matches-shorthand": [
"error",
"always",
3
],
"lodash/no-commit": "error",
"lodash/path-style": [
"error",
"as-needed"
],
"lodash/prefer-compact": "error",
"lodash/prefer-filter": [
"off",
3
],
"lodash/prefer-find": "error",
"lodash/prefer-flat-map": "error",
"lodash/prefer-immutable-method": "error",
"lodash/prefer-invoke-map": "error",
"lodash/prefer-map": "error",
"lodash/prefer-reject": [
"error",
3
],
"lodash/prefer-thru": "error",
"lodash/prefer-wrapper-method": "error",
"lodash/preferred-alias": "error",
"lodash/prop-shorthand": [
"error",
"always"
],
"lodash/prefer-constant": "off",
"lodash/prefer-get": [
"warn",
4
],
"lodash/prefer-includes": [
"error",
{
"includeNative": true
}
],
"lodash/prefer-is-nil": "error",
"lodash/prefer-lodash-chain": "off",
"lodash/prefer-lodash-method": "off",
"lodash/prefer-lodash-typecheck": "off",
"lodash/prefer-matches": [
"off",
3
],
"lodash/prefer-noop": "off",
"lodash/prefer-over-quantifier": "warn",
"lodash/prefer-some": "off",
"lodash/prefer-startswith": "off",
"lodash/prefer-times": "off",
// Security
"security/detect-unsafe-regex": "error",
"security/detect-buffer-noassert": "error",
"security/detect-child-process": "error",
"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": "off",
"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"
}
}