Skip to content

Commit

Permalink
Review markups
Browse files Browse the repository at this point in the history
This change makes some linting review markups:

  - pre-comupte long, concatenated strings
  - only allow one statement per line
  • Loading branch information
Alec Gibson committed Jul 15, 2019
1 parent df5a466 commit 40abc17
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ const SHAREDB_RULES = {
],
// Google overrides the default ESLint behaviour here, which is slightly better for catching erroneously unused variables
'no-unused-vars': ['error', {vars: 'all', args: 'after-used'}],
// It's more readable to ensure we only have one statement per line
'max-statements-per-line': ['error', {max: 1}],
// as-needed quote props are easier to write
'quote-props': ['error', 'as-needed'],
'require-jsdoc': 'off',
Expand Down
4 changes: 3 additions & 1 deletion lib/agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,9 @@ Agent.prototype._handleMessage = function(request, callback) {
};
function getQueryOptions(request) {
var results = request.r;
var ids; var fetch; var fetchOps;
var ids;
var fetch;
var fetchOps;
if (results) {
ids = [];
for (var i = 0; i < results.length; i++) {
Expand Down
17 changes: 9 additions & 8 deletions lib/backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ var SubmitRequest = require('./submit-request');
var warnDeprecatedDoc = true;
var warnDeprecatedAfterSubmit = true;

var DOC_ACTION_DEPRECATION_WARNING = 'DEPRECATED: "doc" middleware action. Use "readSnapshots" instead. ' +
'Pass `disableDocAction: true` option to ShareDB to disable the "doc" action and this warning.';

var AFFTER_SUBMIT_ACTION_DEPRECATION_WARNING = 'DEPRECATED: "after submit" middleware action. ' +
'Use "afterSubmit" instead. Pass `disableSpaceDelimitedActions: true` option to ShareDB to ' +
'disable the "after submit" action and this warning.';

function Backend(options) {
if (!(this instanceof Backend)) return new Backend(options);
emitter.EventEmitter.call(this);
Expand Down Expand Up @@ -94,10 +101,7 @@ Backend.prototype.SNAPSHOT_TYPES = {
Backend.prototype._shimDocAction = function() {
if (warnDeprecatedDoc) {
warnDeprecatedDoc = false;
console.warn([
'DEPRECATED: "doc" middleware action. Use "readSnapshots" instead.',
'Pass `disableDocAction: true` option to ShareDB to disable the "doc" action and this warning.'
].join(' '));
console.warn(DOC_ACTION_DEPRECATION_WARNING);
}

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

var backend = this;
Expand Down

0 comments on commit 40abc17

Please sign in to comment.