Skip to content
This repository was archived by the owner on Apr 2, 2024. It is now read-only.

Commit 40abc17

Browse files
author
Alec Gibson
committed
Review markups
This change makes some linting review markups: - pre-comupte long, concatenated strings - only allow one statement per line
1 parent df5a466 commit 40abc17

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

.eslintrc.js

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ const SHAREDB_RULES = {
2626
],
2727
// Google overrides the default ESLint behaviour here, which is slightly better for catching erroneously unused variables
2828
'no-unused-vars': ['error', {vars: 'all', args: 'after-used'}],
29+
// It's more readable to ensure we only have one statement per line
30+
'max-statements-per-line': ['error', {max: 1}],
2931
// as-needed quote props are easier to write
3032
'quote-props': ['error', 'as-needed'],
3133
'require-jsdoc': 'off',

lib/agent.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,9 @@ Agent.prototype._handleMessage = function(request, callback) {
332332
};
333333
function getQueryOptions(request) {
334334
var results = request.r;
335-
var ids; var fetch; var fetchOps;
335+
var ids;
336+
var fetch;
337+
var fetchOps;
336338
if (results) {
337339
ids = [];
338340
for (var i = 0; i < results.length; i++) {

lib/backend.js

+9-8
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ var SubmitRequest = require('./submit-request');
1515
var warnDeprecatedDoc = true;
1616
var warnDeprecatedAfterSubmit = true;
1717

18+
var DOC_ACTION_DEPRECATION_WARNING = 'DEPRECATED: "doc" middleware action. Use "readSnapshots" instead. ' +
19+
'Pass `disableDocAction: true` option to ShareDB to disable the "doc" action and this warning.';
20+
21+
var AFFTER_SUBMIT_ACTION_DEPRECATION_WARNING = 'DEPRECATED: "after submit" middleware action. ' +
22+
'Use "afterSubmit" instead. Pass `disableSpaceDelimitedActions: true` option to ShareDB to ' +
23+
'disable the "after submit" action and this warning.';
24+
1825
function Backend(options) {
1926
if (!(this instanceof Backend)) return new Backend(options);
2027
emitter.EventEmitter.call(this);
@@ -94,10 +101,7 @@ Backend.prototype.SNAPSHOT_TYPES = {
94101
Backend.prototype._shimDocAction = function() {
95102
if (warnDeprecatedDoc) {
96103
warnDeprecatedDoc = false;
97-
console.warn([
98-
'DEPRECATED: "doc" middleware action. Use "readSnapshots" instead.',
99-
'Pass `disableDocAction: true` option to ShareDB to disable the "doc" action and this warning.'
100-
].join(' '));
104+
console.warn(DOC_ACTION_DEPRECATION_WARNING);
101105
}
102106

103107
var backend = this;
@@ -114,10 +118,7 @@ Backend.prototype._shimDocAction = function() {
114118
Backend.prototype._shimAfterSubmit = function() {
115119
if (warnDeprecatedAfterSubmit) {
116120
warnDeprecatedAfterSubmit = false;
117-
console.warn([
118-
'DEPRECATED: "after submit" middleware action. Use "afterSubmit" instead. Pass',
119-
'`disableSpaceDelimitedActions: true` option to ShareDB to disable the "after submit" action and this warning.'
120-
].join(' '));
121+
console.warn(AFFTER_SUBMIT_ACTION_DEPRECATION_WARNING);
121122
}
122123

123124
var backend = this;

0 commit comments

Comments
 (0)