Skip to content

Commit b3df079

Browse files
Merge commit 'f50689da650c8218301819c4f31703d9a658033b'
* commit 'f50689da650c8218301819c4f31703d9a658033b': 3.0.1 Update eslint 3.0.0 Follow-up to d9d31aa Update machine runner to v15. (refs balderdashy/sails#4264) # Conflicts: # package.json
2 parents bad26ad + f50689d commit b3df079

16 files changed

+107
-71
lines changed

.eslintrc

Lines changed: 60 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,70 @@
22
// ╔═╗╔═╗╦ ╦╔╗╔╔╦╗┬─┐┌─┐
33
// ║╣ ╚═╗║ ║║║║ ║ ├┬┘│
44
// o╚═╝╚═╝╩═╝╩╝╚╝ ╩ ┴└─└─┘
5-
// A set of basic conventions designed to complement the .jshintrc file.
5+
// A set of basic conventions (similar to .jshintrc) for use within any
6+
// arbitrary JavaScript / Node.js package -- inside or outside Sails.js.
67
// For the master copy of this file, see the `.eslintrc` template file in
78
// the `sails-generate` package (https://www.npmjs.com/package/sails-generate.)
9+
// Designed for ESLint v4.
10+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
11+
// For more information about any of the rules below, check out the relevant
12+
// reference page on eslint.org. For example, to get details on "no-sequences",
13+
// you would visit `http://eslint.org/docs/rules/no-sequences`. If you're unsure
14+
// or could use some advice, come by https://sailsjs.com/support.
15+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
16+
817
"env": {
9-
"node": true,
10-
"mocha": true
18+
"node": true
1119
},
20+
21+
"parserOptions": {
22+
"ecmaVersion": 5
23+
// ^^This can be changed to `8` if this package doesn't need to support <= Node v6.
24+
},
25+
26+
"globals": {
27+
"Promise": true
28+
// ^^Available since Node v4
29+
},
30+
1231
"rules": {
13-
"callback-return": [2, ["callback", "cb", "next", "done", "proceed"]],
14-
"camelcase": [2, {"properties": "always"}],
15-
"comma-style": [2, "last"],
16-
"curly": [2],
17-
"eqeqeq": [1, "smart"],
18-
"eol-last": [2],
19-
"handle-callback-err": [2],
20-
"indent": [2, 2, {"SwitchCase": 1}],
21-
"linebreak-style": [2, "unix"],
22-
"no-mixed-spaces-and-tabs": [2, "smart-tabs"],
23-
"no-return-assign": [2, "always"],
24-
"no-sequences": [2],
25-
"no-trailing-spaces": [2],
26-
"no-undef": [2],
27-
"no-unexpected-multiline": [1],
28-
"no-unused-vars": [2],
29-
"one-var": [2, "never"],
30-
"semi": [1, "always"]
32+
"callback-return": ["error", ["done", "proceed", "next", "onwards", "callback", "cb"]],
33+
"camelcase": ["warn", {"properties": "always"}],
34+
"comma-style": ["warn", "last"],
35+
"curly": ["error"],
36+
"eqeqeq": ["error", "always"],
37+
"eol-last": ["warn"],
38+
"handle-callback-err": ["error"],
39+
"indent": ["warn", 2, {
40+
"SwitchCase": 1,
41+
"MemberExpression": "off",
42+
"FunctionDeclaration": {"body":1, "parameters": "off"},
43+
"FunctionExpression": {"body":1, "parameters": "off"},
44+
"CallExpression": {"arguments":"off"},
45+
"ArrayExpression": 1,
46+
"ObjectExpression": 1,
47+
"ignoredNodes": ["ConditionalExpression"]
48+
}],
49+
"linebreak-style": ["error", "unix"],
50+
"no-dupe-keys": ["error"],
51+
"no-duplicate-case": ["error"],
52+
"no-extra-semi": ["warn"],
53+
"no-labels": ["error"],
54+
"no-mixed-spaces-and-tabs": ["error", "smart-tabs"],
55+
"no-redeclare": ["warn"],
56+
"no-return-assign": ["error", "always"],
57+
"no-sequences": ["error"],
58+
"no-trailing-spaces": ["warn"],
59+
"no-undef": ["error"],
60+
"no-unexpected-multiline": ["warn"],
61+
"no-unreachable": ["warn"],
62+
"no-unused-vars": ["warn", {"caughtErrors":"all", "caughtErrorsIgnorePattern": "^unused($|[A-Z].*$)"}],
63+
"no-use-before-define": ["error", {"functions":false}],
64+
"one-var": ["warn", "never"],
65+
"quotes": ["warn", "single", {"avoidEscape":false, "allowTemplateLiterals":true}],
66+
"semi": ["error", "always"],
67+
"semi-spacing": ["warn", {"before":false, "after":true}],
68+
"semi-style": ["warn", "last"]
3169
}
70+
3271
}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
node_modules
1818
npm-debug.log
1919
.node_history
20+
package-lock.json
2021

2122
############################
2223
# editor & OS files

helpers/validate-connection.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module.exports = require('machine').build({
77
description: 'Check if this looks like a valid MySQL connection instance.',
88

99

10-
cacheable: true,
10+
sideEffects: 'cacheable',
1111

1212

1313
sync: true,

machines/.gitkeep

Lines changed: 0 additions & 1 deletion
This file was deleted.

machines/begin-transaction.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ module.exports = {
3737
extendedDescription: 'Until it is committed, rolled back, or times out, subsequent queries run on this connection will be transactional. They will not have any true effect on the database until the transaction is committed, and will not affect queries made on other connections.',
3838
outputVariableName: 'report',
3939
outputDescription: 'The `meta` property is reserved for custom driver-specific extensions.',
40-
example: '==='
41-
// example: {
40+
outputExample: '==='
41+
// outputExample: {
4242
// meta: '==='
4343
// }
4444
},
@@ -49,8 +49,8 @@ module.exports = {
4949
extendedDescription: 'Usually, this means the connection to the database was lost due to a logic error or timing issue in userland code. In production, this can mean that the database became overwhelemed or was shut off while some business logic was in progress.',
5050
outputVariableName: 'report',
5151
outputDescription: 'The `meta` property is reserved for custom driver-specific extensions.',
52-
example: '==='
53-
// example: {
52+
outputExample: '==='
53+
// outputExample: {
5454
// meta: '==='
5555
// }
5656
}
@@ -66,7 +66,7 @@ module.exports = {
6666
Pack.sendNativeQuery({
6767
connection: inputs.connection,
6868
nativeQuery: 'BEGIN'
69-
}).exec({
69+
}).switch({
7070
error: function error(err) {
7171
return exits.error(err);
7272
},

machines/commit-transaction.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ module.exports = {
4040
extendedDescription: 'Subsequent queries on this connection will no longer be transactional unless a new transaction is begun.',
4141
outputVariableName: 'report',
4242
outputDescription: 'The `meta` property is reserved for custom driver-specific extensions.',
43-
example: '==='
44-
// example: {
43+
outputExample: '==='
44+
// outputExample: {
4545
// meta: '==='
4646
// }
4747
},
@@ -52,8 +52,8 @@ module.exports = {
5252
extendedDescription: 'Usually, this means the connection to the database was lost due to a logic error or timing issue in userland code. In production, this can mean that the database became overwhelemed or was shut off while some business logic was in progress.',
5353
outputVariableName: 'report',
5454
outputDescription: 'The `meta` property is reserved for custom driver-specific extensions.',
55-
example: '==='
56-
// example: {
55+
outputExample: '==='
56+
// outputExample: {
5757
// meta: '==='
5858
// }
5959
}
@@ -69,7 +69,7 @@ module.exports = {
6969
Pack.sendNativeQuery({
7070
connection: inputs.connection,
7171
nativeQuery: 'COMMIT'
72-
}).exec({
72+
}).switch({
7373
error: function error(err) {
7474
return exits.error(err);
7575
},

machines/compile-statement.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module.exports = {
1313
description: 'Compile a Waterline statement to a native query for MySQL.',
1414

1515

16-
cacheable: true,
16+
sideEffects: 'cacheable',
1717

1818

1919
sync: true,
@@ -46,7 +46,7 @@ module.exports = {
4646
description: 'The provided Waterline statement was compiled successfully.',
4747
outputVariableName: 'report',
4848
outputDescription: 'The `nativeQuery` property is the compiled native query for the database. The `meta` property is reserved for custom driver-specific extensions.',
49-
example: '==='
49+
outputExample: '==='
5050
// example: {
5151
// nativeQuery: 'SELECT * FROM foo',
5252
// valuesToEscape: ['foo']
@@ -58,7 +58,7 @@ module.exports = {
5858
description: 'The provided Waterline statement could not be compiled due to malformed syntax.',
5959
outputVariableName: 'report',
6060
outputDescription: 'The `error` property is a JavaScript error instance explaining that (or preferably even _why_) the Waterline syntax is not valid. The `meta` property is reserved for custom driver-specific extensions.',
61-
example: '==='
61+
outputExample: '==='
6262
// example: {
6363
// error: '===',
6464
// meta: '==='
@@ -70,7 +70,7 @@ module.exports = {
7070
extendedDescription: 'If even one clause of the Waterline statement is not supported by the MySQL driver, the compilation of the entire statement _always fails_.',
7171
outputVariableName: 'report',
7272
outputDescription: 'The `error` property is a JavaScript error instance explaining that (or preferably even _why_) the Waterline statement is not supported. The `meta` property is reserved for custom driver-specific extensions.',
73-
example: '==='
73+
outputExample: '==='
7474
// example: {
7575
// error: '===',
7676
// meta: '==='

machines/create-manager.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ module.exports = {
2424
'(e.g. a PoolCluster from felixge\'s `mysql` package).',
2525

2626

27-
cacheable: false,
28-
29-
3027
sync: true,
3128

3229

@@ -82,7 +79,7 @@ module.exports = {
8279
'basis; and it may also vary based on the configuration passed into the `meta` input.',
8380
outputVariableName: 'report',
8481
outputDescription: 'The `manager` property is a manager instance that will be passed into `getConnection()`. The `meta` property is reserved for custom driver-specific extensions.',
85-
example: '==='
82+
outputExample: '==='
8683
// example: {
8784
// manager: '===',
8885
// meta: '==='
@@ -93,7 +90,7 @@ module.exports = {
9390
description: 'The provided connection string is not valid for MySQL.',
9491
outputVariableName: 'report',
9592
outputDescription: 'The `error` property is a JavaScript Error instance explaining that (and preferably "why") the provided connection string is invalid. The `meta` property is reserved for custom driver-specific extensions.',
96-
example: '==='
93+
outputExample: '==='
9794
// example: {
9895
// error: '===',
9996
// meta: '==='
@@ -119,8 +116,8 @@ module.exports = {
119116
'any errors related to bad credentials, connectivity, etc. will not be caught until `getConnection()` is called.',
120117
outputVariableName: 'report',
121118
outputDescription: 'The `error` property is a JavaScript Error instance with more information and a stack trace. The `meta` property is reserved for custom driver-specific extensions.',
122-
example: '==='
123-
// example: {
119+
outputExample: '==='
120+
// outputExample: {
124121
// error: '===',
125122
// meta: '==='
126123
// }

machines/destroy-manager.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ module.exports = {
3333
description: 'The specified manager and all of its active connections were successfully destroyed.',
3434
outputVariableName: 'report',
3535
outputDescription: 'The `meta` property is reserved for custom driver-specific extensions.',
36-
example: '==='
36+
outputExample: '==='
3737
// example: {
3838
// meta: '==='
3939
// }
@@ -48,7 +48,7 @@ module.exports = {
4848
'server(s) became overwhelemed or were shut off while some business logic was in progress.',
4949
outputVariableName: 'report',
5050
outputDescription: 'The `error` property is a JavaScript Error instance with more information and a stack trace. The `meta` property is reserved for custom driver-specific extensions.',
51-
example: '==='
51+
outputExample: '==='
5252
// example: {
5353
// error: '===',
5454
// meta: '==='

machines/get-connection.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ module.exports = {
3939
extendedDescription: 'This connection should be eventually released. Otherwise, it may time out. It is not a good idea to rely on database connections timing out-- be sure to release this connection when finished with it!',
4040
outputVariableName: 'report',
4141
outputDescription: 'The `connection` property is an active connection to the database. The `meta` property is reserved for custom driver-specific extensions.',
42-
example: '==='
42+
outputExample: '==='
4343
// example: {
4444
// connection: '===',
4545
// meta: '==='
@@ -57,7 +57,7 @@ module.exports = {
5757
' + any other miscellaneous connection error',
5858
outputVariableName: 'report',
5959
outputDescription: 'The `error` property is a JavaScript Error instance explaining that a connection could not be made. The `meta` property is reserved for custom driver-specific extensions.',
60-
example: '==='
60+
outputExample: '==='
6161
// example: {
6262
// error: '===',
6363
// meta: '==='

0 commit comments

Comments
 (0)