mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-23 19:02:29 +03:00
Switched to eslint-plugin-ghost (#9835)
refs #9834 - @TODO: the test env eslint needs to use the plugin, not part of this PR
This commit is contained in:
parent
d0d3eed13c
commit
efd1587ee9
303
.eslintrc.json
303
.eslintrc.json
@ -3,301 +3,10 @@
|
|||||||
"es6": true,
|
"es6": true,
|
||||||
"node": true
|
"node": true
|
||||||
},
|
},
|
||||||
"extends": "eslint:recommended",
|
"plugins": [
|
||||||
"rules": {
|
"ghost"
|
||||||
"accessor-pairs": "error",
|
],
|
||||||
"array-bracket-newline": "off",
|
"extends": [
|
||||||
"array-bracket-spacing": [
|
"plugin:ghost/node"
|
||||||
"error",
|
]
|
||||||
"never"
|
|
||||||
],
|
|
||||||
"array-callback-return": "off",
|
|
||||||
"array-element-newline": "off",
|
|
||||||
"arrow-body-style": [
|
|
||||||
"error",
|
|
||||||
"always"
|
|
||||||
],
|
|
||||||
"arrow-parens": [
|
|
||||||
"error",
|
|
||||||
"always"
|
|
||||||
],
|
|
||||||
"arrow-spacing": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
"after": true,
|
|
||||||
"before": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"block-scoped-var": "error",
|
|
||||||
"brace-style": [
|
|
||||||
"error",
|
|
||||||
"1tbs",
|
|
||||||
{
|
|
||||||
"allowSingleLine": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"callback-return": "error",
|
|
||||||
"camelcase": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
"properties": "never"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"capitalized-comments": "off",
|
|
||||||
"class-methods-use-this": "off",
|
|
||||||
"comma-dangle": "error",
|
|
||||||
"comma-spacing": "error",
|
|
||||||
"comma-style": [
|
|
||||||
"error",
|
|
||||||
"last"
|
|
||||||
],
|
|
||||||
"complexity": "off",
|
|
||||||
"computed-property-spacing": [
|
|
||||||
"error",
|
|
||||||
"never"
|
|
||||||
],
|
|
||||||
"consistent-return": "off",
|
|
||||||
"consistent-this": "off",
|
|
||||||
"curly": "error",
|
|
||||||
"default-case": "error",
|
|
||||||
"dot-location": [
|
|
||||||
"error",
|
|
||||||
"property"
|
|
||||||
],
|
|
||||||
"dot-notation": "error",
|
|
||||||
"eol-last": "error",
|
|
||||||
"eqeqeq": "error",
|
|
||||||
"for-direction": "error",
|
|
||||||
"func-call-spacing": "error",
|
|
||||||
"func-name-matching": "off",
|
|
||||||
"func-names": "off",
|
|
||||||
"func-style": "off",
|
|
||||||
"function-paren-newline": "off",
|
|
||||||
"generator-star-spacing": "error",
|
|
||||||
"getter-return": "error",
|
|
||||||
"global-require": "off",
|
|
||||||
"guard-for-in": "error",
|
|
||||||
"handle-callback-err": "error",
|
|
||||||
"id-blacklist": "error",
|
|
||||||
"id-length": "off",
|
|
||||||
"id-match": "error",
|
|
||||||
"indent": [
|
|
||||||
"error",
|
|
||||||
4,
|
|
||||||
{
|
|
||||||
"SwitchCase": 1
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"indent-legacy": "off",
|
|
||||||
"init-declarations": "off",
|
|
||||||
"jsx-quotes": "error",
|
|
||||||
"key-spacing": "error",
|
|
||||||
"keyword-spacing": "error",
|
|
||||||
"line-comment-position": "off",
|
|
||||||
"linebreak-style": [
|
|
||||||
"error",
|
|
||||||
"unix"
|
|
||||||
],
|
|
||||||
"lines-around-comment": "off",
|
|
||||||
"lines-around-directive": "off",
|
|
||||||
"lines-between-class-members": [
|
|
||||||
"error",
|
|
||||||
"always"
|
|
||||||
],
|
|
||||||
"max-depth": "error",
|
|
||||||
"max-len": "off",
|
|
||||||
"max-lines": "off",
|
|
||||||
"max-nested-callbacks": "error",
|
|
||||||
"max-params": "off",
|
|
||||||
"max-statements": "off",
|
|
||||||
"max-statements-per-line": "off",
|
|
||||||
"multiline-comment-style": "off",
|
|
||||||
"multiline-ternary": "off",
|
|
||||||
"new-parens": "error",
|
|
||||||
"newline-after-var": "off",
|
|
||||||
"newline-before-return": "off",
|
|
||||||
"newline-per-chained-call": "off",
|
|
||||||
"no-alert": "error",
|
|
||||||
"no-array-constructor": "error",
|
|
||||||
"no-await-in-loop": "error",
|
|
||||||
"no-bitwise": "off",
|
|
||||||
"no-buffer-constructor": "off",
|
|
||||||
"no-caller": "error",
|
|
||||||
"no-catch-shadow": "error",
|
|
||||||
"no-confusing-arrow": "error",
|
|
||||||
"no-continue": "error",
|
|
||||||
"no-div-regex": "off",
|
|
||||||
"no-duplicate-imports": "error",
|
|
||||||
"no-else-return": "off",
|
|
||||||
"no-empty-function": "off",
|
|
||||||
"no-eq-null": "error",
|
|
||||||
"no-eval": "error",
|
|
||||||
"no-extend-native": "error",
|
|
||||||
"no-extra-bind": "error",
|
|
||||||
"no-extra-label": "error",
|
|
||||||
"no-extra-parens": "off",
|
|
||||||
"no-floating-decimal": "error",
|
|
||||||
"no-implicit-globals": "error",
|
|
||||||
"no-implied-eval": "error",
|
|
||||||
"no-inline-comments": "off",
|
|
||||||
"no-inner-declarations": [
|
|
||||||
"error",
|
|
||||||
"functions"
|
|
||||||
],
|
|
||||||
"no-invalid-this": "error",
|
|
||||||
"no-iterator": "error",
|
|
||||||
"no-label-var": "error",
|
|
||||||
"no-labels": "error",
|
|
||||||
"no-lone-blocks": "error",
|
|
||||||
"no-lonely-if": "off",
|
|
||||||
"no-loop-func": "error",
|
|
||||||
"no-magic-numbers": "off",
|
|
||||||
"no-mixed-operators": "off",
|
|
||||||
"no-mixed-requires": "off",
|
|
||||||
"no-multi-assign": "off",
|
|
||||||
"no-multi-spaces": "off",
|
|
||||||
"no-multi-str": "error",
|
|
||||||
"no-multiple-empty-lines": ["error", {"max": 1}],
|
|
||||||
"no-native-reassign": "error",
|
|
||||||
"no-negated-condition": "off",
|
|
||||||
"no-negated-in-lhs": "error",
|
|
||||||
"no-nested-ternary": "off",
|
|
||||||
"no-new": "error",
|
|
||||||
"no-new-func": "error",
|
|
||||||
"no-new-object": "error",
|
|
||||||
"no-new-require": "error",
|
|
||||||
"no-new-wrappers": "error",
|
|
||||||
"no-octal-escape": "error",
|
|
||||||
"no-param-reassign": "off",
|
|
||||||
"no-path-concat": "off",
|
|
||||||
"no-plusplus": "error",
|
|
||||||
"no-process-env": "off",
|
|
||||||
"no-process-exit": "off",
|
|
||||||
"no-proto": "error",
|
|
||||||
"no-prototype-builtins": "off",
|
|
||||||
"no-restricted-globals": "error",
|
|
||||||
"no-restricted-imports": "error",
|
|
||||||
"no-restricted-modules": "error",
|
|
||||||
"no-restricted-properties": "error",
|
|
||||||
"no-restricted-syntax": "error",
|
|
||||||
"no-return-assign": "error",
|
|
||||||
"no-return-await": "error",
|
|
||||||
"no-script-url": "error",
|
|
||||||
"no-self-compare": "error",
|
|
||||||
"no-sequences": "error",
|
|
||||||
"no-shadow": "off",
|
|
||||||
"no-shadow-restricted-names": "error",
|
|
||||||
"no-spaced-func": "error",
|
|
||||||
"no-sync": "off",
|
|
||||||
"no-tabs": "error",
|
|
||||||
"no-template-curly-in-string": "error",
|
|
||||||
"no-ternary": "off",
|
|
||||||
"no-throw-literal": "error",
|
|
||||||
"no-trailing-spaces": "error",
|
|
||||||
"no-undef-init": "error",
|
|
||||||
"no-undefined": "off",
|
|
||||||
"no-underscore-dangle": "off",
|
|
||||||
"no-unmodified-loop-condition": "error",
|
|
||||||
"no-unneeded-ternary": "off",
|
|
||||||
"no-use-before-define": "off",
|
|
||||||
"no-useless-call": "error",
|
|
||||||
"no-useless-computed-key": "error",
|
|
||||||
"no-useless-concat": "off",
|
|
||||||
"no-useless-constructor": "error",
|
|
||||||
"no-useless-escape": "off",
|
|
||||||
"no-useless-rename": "error",
|
|
||||||
"no-useless-return": "error",
|
|
||||||
"no-var": "off",
|
|
||||||
"no-void": "error",
|
|
||||||
"no-warning-comments": "off",
|
|
||||||
"no-whitespace-before-property": "error",
|
|
||||||
"no-with": "error",
|
|
||||||
"nonblock-statement-body-position": "error",
|
|
||||||
"object-curly-newline": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
"consistent": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"object-curly-spacing": [
|
|
||||||
"error",
|
|
||||||
"never"
|
|
||||||
],
|
|
||||||
"object-property-newline": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
"allowMultiplePropertiesPerLine": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"object-shorthand": "off",
|
|
||||||
"one-var": "off",
|
|
||||||
"one-var-declaration-per-line": "off",
|
|
||||||
"operator-assignment": "off",
|
|
||||||
"operator-linebreak": "off",
|
|
||||||
"padded-blocks": [
|
|
||||||
"error",
|
|
||||||
"never"
|
|
||||||
],
|
|
||||||
"padding-line-between-statements": "error",
|
|
||||||
"prefer-arrow-callback": "off",
|
|
||||||
"prefer-const": "off",
|
|
||||||
"prefer-destructuring": "off",
|
|
||||||
"prefer-numeric-literals": "error",
|
|
||||||
"prefer-promise-reject-errors": "off",
|
|
||||||
"prefer-reflect": "off",
|
|
||||||
"prefer-rest-params": "off",
|
|
||||||
"prefer-spread": "off",
|
|
||||||
"prefer-template": "off",
|
|
||||||
"quote-props": [
|
|
||||||
"error",
|
|
||||||
"as-needed"
|
|
||||||
],
|
|
||||||
"quotes": ["error", "single"],
|
|
||||||
"radix": "off",
|
|
||||||
"require-await": "error",
|
|
||||||
"require-jsdoc": "off",
|
|
||||||
"rest-spread-spacing": "error",
|
|
||||||
"semi": ["error", "always"],
|
|
||||||
"semi-spacing": "error",
|
|
||||||
"semi-style": [
|
|
||||||
"error",
|
|
||||||
"last"
|
|
||||||
],
|
|
||||||
"sort-imports": "error",
|
|
||||||
"sort-keys": "off",
|
|
||||||
"sort-vars": "off",
|
|
||||||
"space-before-blocks": "error",
|
|
||||||
"space-before-function-paren": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
"anonymous": "always",
|
|
||||||
"named": "never"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"space-in-parens": [
|
|
||||||
"error",
|
|
||||||
"never"
|
|
||||||
],
|
|
||||||
"space-infix-ops": "error",
|
|
||||||
"space-unary-ops": "error",
|
|
||||||
"spaced-comment": "error",
|
|
||||||
"strict": "off",
|
|
||||||
"switch-colon-spacing": "error",
|
|
||||||
"symbol-description": "error",
|
|
||||||
"template-curly-spacing": [
|
|
||||||
"error",
|
|
||||||
"never"
|
|
||||||
],
|
|
||||||
"template-tag-spacing": "error",
|
|
||||||
"unicode-bom": [
|
|
||||||
"error",
|
|
||||||
"never"
|
|
||||||
],
|
|
||||||
"valid-jsdoc": "off",
|
|
||||||
"vars-on-top": "off",
|
|
||||||
"wrap-iife": "off",
|
|
||||||
"wrap-regex": "off",
|
|
||||||
"yield-star-spacing": "error",
|
|
||||||
"yoda": "error"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -326,7 +326,9 @@ authentication = {
|
|||||||
updatedUser.set('status', 'active');
|
updatedUser.set('status', 'active');
|
||||||
return updatedUser.save(options);
|
return updatedUser.save(options);
|
||||||
})
|
})
|
||||||
.catch(common.errors.ValidationError, (err) => { return Promise.reject(err); })
|
.catch(common.errors.ValidationError, (err) => {
|
||||||
|
return Promise.reject(err);
|
||||||
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
if (common.errors.utils.isIgnitionError(err)) {
|
if (common.errors.utils.isIgnitionError(err)) {
|
||||||
return Promise.reject(err);
|
return Promise.reject(err);
|
||||||
@ -411,7 +413,9 @@ authentication = {
|
|||||||
roles: [invite.toJSON().role_id]
|
roles: [invite.toJSON().role_id]
|
||||||
}, options);
|
}, options);
|
||||||
})
|
})
|
||||||
.then(() => { return invite.destroy(options); });
|
.then(() => {
|
||||||
|
return invite.destroy(options);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatResponse() {
|
function formatResponse() {
|
||||||
|
@ -162,7 +162,9 @@ const invites = {
|
|||||||
|
|
||||||
return invite.destroy(options);
|
return invite.destroy(options);
|
||||||
})
|
})
|
||||||
.then(() => { return options; });
|
.then(() => {
|
||||||
|
return options;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function validation(options) {
|
function validation(options) {
|
||||||
@ -202,7 +204,9 @@ const invites = {
|
|||||||
message: common.i18n.t('errors.api.invites.notAllowedToInvite')
|
message: common.i18n.t('errors.api.invites.notAllowedToInvite')
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}).then(() => { return options; });
|
}).then(() => {
|
||||||
|
return options;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkIfUserExists(options) {
|
function checkIfUserExists(options) {
|
||||||
|
@ -167,7 +167,9 @@ notifications = {
|
|||||||
|
|
||||||
// CASE: remove any existing release notifications if a new release notification comes in
|
// CASE: remove any existing release notifications if a new release notification comes in
|
||||||
if (hasReleaseNotification) {
|
if (hasReleaseNotification) {
|
||||||
remove(allNotifications, (el) => { return !el.custom; });
|
remove(allNotifications, (el) => {
|
||||||
|
return !el.custom;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// CASE: nothing to add, skip
|
// CASE: nothing to add, skip
|
||||||
@ -194,7 +196,9 @@ notifications = {
|
|||||||
}]
|
}]
|
||||||
}, internalContext);
|
}, internalContext);
|
||||||
})
|
})
|
||||||
.then(() => { return _private.publicResponse(addedNotifications); });
|
.then(() => {
|
||||||
|
return _private.publicResponse(addedNotifications);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks = [
|
tasks = [
|
||||||
|
@ -115,7 +115,7 @@ utils = {
|
|||||||
from: {isDate: true},
|
from: {isDate: true},
|
||||||
to: {isDate: true},
|
to: {isDate: true},
|
||||||
fields: {matches: /^[\w, ]+$/},
|
fields: {matches: /^[\w, ]+$/},
|
||||||
order: {matches: /^[a-z0-9_,\. ]+$/i},
|
order: {matches: /^[a-z0-9_,. ]+$/i},
|
||||||
name: {},
|
name: {},
|
||||||
email: {isEmail: true}
|
email: {isEmail: true}
|
||||||
},
|
},
|
||||||
|
@ -134,7 +134,7 @@ function getAmperizeHTML(html, post) {
|
|||||||
if (err) {
|
if (err) {
|
||||||
if (err.src) {
|
if (err.src) {
|
||||||
logging.error(new errors.GhostError({
|
logging.error(new errors.GhostError({
|
||||||
message: `AMP HTML couldn\'t get parsed: ${err.src}`,
|
message: `AMP HTML couldn't get parsed: ${err.src}`,
|
||||||
err: err,
|
err: err,
|
||||||
context: post.url,
|
context: post.url,
|
||||||
help: i18n.t('errors.apps.appWillNotBeLoaded.help')
|
help: i18n.t('errors.apps.appWillNotBeLoaded.help')
|
||||||
|
@ -49,24 +49,24 @@ exports.makePathsAbsolute = function makePathsAbsolute(obj, parent) {
|
|||||||
*/
|
*/
|
||||||
exports.getContentPath = function getContentPath(type) {
|
exports.getContentPath = function getContentPath(type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'images':
|
case 'images':
|
||||||
return path.join(this.get('paths:contentPath'), 'images/');
|
return path.join(this.get('paths:contentPath'), 'images/');
|
||||||
case 'apps':
|
case 'apps':
|
||||||
return path.join(this.get('paths:contentPath'), 'apps/');
|
return path.join(this.get('paths:contentPath'), 'apps/');
|
||||||
case 'themes':
|
case 'themes':
|
||||||
return path.join(this.get('paths:contentPath'), 'themes/');
|
return path.join(this.get('paths:contentPath'), 'themes/');
|
||||||
case 'storage':
|
case 'storage':
|
||||||
return path.join(this.get('paths:contentPath'), 'adapters', 'storage/');
|
return path.join(this.get('paths:contentPath'), 'adapters', 'storage/');
|
||||||
case 'scheduling':
|
case 'scheduling':
|
||||||
return path.join(this.get('paths:contentPath'), 'adapters', 'scheduling/');
|
return path.join(this.get('paths:contentPath'), 'adapters', 'scheduling/');
|
||||||
case 'logs':
|
case 'logs':
|
||||||
return path.join(this.get('paths:contentPath'), 'logs/');
|
return path.join(this.get('paths:contentPath'), 'logs/');
|
||||||
case 'data':
|
case 'data':
|
||||||
return path.join(this.get('paths:contentPath'), 'data/');
|
return path.join(this.get('paths:contentPath'), 'data/');
|
||||||
case 'settings':
|
case 'settings':
|
||||||
return path.join(this.get('paths:contentPath'), 'settings/');
|
return path.join(this.get('paths:contentPath'), 'settings/');
|
||||||
default:
|
default:
|
||||||
throw new Error('getContentPath was called with: ' + type);
|
throw new Error('getContentPath was called with: ' + type);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
var _ = require('lodash'),
|
var _ = require('lodash'),
|
||||||
Promise = require('bluebird'),
|
Promise = require('bluebird'),
|
||||||
storage = require('../../../adapters/storage'),
|
storage = require('../../../adapters/storage'),
|
||||||
replaceImage,
|
replaceImage,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
var urlService = require('../../services/url'),
|
var urlService = require('../../services/url'),
|
||||||
getUrl = require('./url'),
|
getUrl = require('./url'),
|
||||||
_ = require('lodash');
|
_ = require('lodash');
|
||||||
|
|
||||||
function getAmplUrl(data) {
|
function getAmplUrl(data) {
|
||||||
var context = data.context ? data.context : null;
|
var context = data.context ? data.context : null;
|
||||||
|
@ -30,7 +30,7 @@ function getAssetUrl(path, hasMinFile) {
|
|||||||
|
|
||||||
// replace ".foo" with ".min.foo" if configured
|
// replace ".foo" with ".min.foo" if configured
|
||||||
if (hasMinFile && config.get('useMinFiles') !== false) {
|
if (hasMinFile && config.get('useMinFiles') !== false) {
|
||||||
path = path.replace(/\.([^\.]*)$/, '.min.$1');
|
path = path.replace(/\.([^.]*)$/, '.min.$1');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the path for the requested asset
|
// Add the path for the requested asset
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
var getContextObject = require('./context_object.js'),
|
var getContextObject = require('./context_object.js'),
|
||||||
_ = require('lodash');
|
_ = require('lodash');
|
||||||
|
|
||||||
function getAuthorFacebookUrl(data) {
|
function getAuthorFacebookUrl(data) {
|
||||||
var context = data.context ? data.context : null,
|
var context = data.context ? data.context : null,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
var getContextObject = require('./context_object.js'),
|
var getContextObject = require('./context_object.js'),
|
||||||
_ = require('lodash');
|
_ = require('lodash');
|
||||||
|
|
||||||
function getCreatorTwitterUrl(data) {
|
function getCreatorTwitterUrl(data) {
|
||||||
var context = data.context ? data.context : null,
|
var context = data.context ? data.context : null,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
const config = require('../../../config'),
|
const config = require('../../../config'),
|
||||||
Manager = require('./manager'),
|
Manager = require('./manager'),
|
||||||
manager = new Manager();
|
manager = new Manager();
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ const common = require('../../../lib/common'),
|
|||||||
PagesMapGenerator = require('./page-generator'),
|
PagesMapGenerator = require('./page-generator'),
|
||||||
PostsMapGenerator = require('./post-generator'),
|
PostsMapGenerator = require('./post-generator'),
|
||||||
UsersMapGenerator = require('./user-generator'),
|
UsersMapGenerator = require('./user-generator'),
|
||||||
TagsMapGenerator = require('./tag-generator');
|
TagsMapGenerator = require('./tag-generator');
|
||||||
|
|
||||||
class SiteMapManager {
|
class SiteMapManager {
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
const _ = require('lodash'),
|
const _ = require('lodash'),
|
||||||
BaseMapGenerator = require('./base-generator');
|
BaseMapGenerator = require('./base-generator');
|
||||||
|
|
||||||
class PageMapGenerator extends BaseMapGenerator {
|
class PageMapGenerator extends BaseMapGenerator {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
const _ = require('lodash'),
|
const _ = require('lodash'),
|
||||||
BaseMapGenerator = require('./base-generator');
|
BaseMapGenerator = require('./base-generator');
|
||||||
|
|
||||||
class TagsMapGenerator extends BaseMapGenerator {
|
class TagsMapGenerator extends BaseMapGenerator {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
// # Filters
|
// # Filters
|
||||||
// Filters are not yet properly used, this system is intended to allow Apps to extend Ghost in various ways.
|
// Filters are not yet properly used, this system is intended to allow Apps to extend Ghost in various ways.
|
||||||
var Promise = require('bluebird'),
|
var Promise = require('bluebird'),
|
||||||
pipeline = require('./lib/promise/pipeline'),
|
pipeline = require('./lib/promise/pipeline'),
|
||||||
_ = require('lodash'),
|
_ = require('lodash'),
|
||||||
defaults;
|
defaults;
|
||||||
|
|
||||||
// ## Default values
|
// ## Default values
|
||||||
|
@ -281,7 +281,7 @@ const connectToBootstrapSocket = (message) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
client.on('error', (err) => {
|
client.on('error', (err) => {
|
||||||
common.logging.warn(`Can\'t connect to the bootstrap socket (${socketAddress.host} ${socketAddress.port}) ${err.code}`);
|
common.logging.warn(`Can't connect to the bootstrap socket (${socketAddress.host} ${socketAddress.port}) ${err.code}`);
|
||||||
|
|
||||||
client.removeAllListeners();
|
client.removeAllListeners();
|
||||||
|
|
||||||
|
@ -32,14 +32,18 @@ module.exports = function body_class(options) { // eslint-disable-line camelcase
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (tags) {
|
if (tags) {
|
||||||
classes = classes.concat(tags.map(function (tag) { return 'tag-' + tag.slug; }));
|
classes = classes.concat(tags.map(function (tag) {
|
||||||
|
return 'tag-' + tag.slug;
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_.includes(context, 'paged')) {
|
if (_.includes(context, 'paged')) {
|
||||||
classes.push('paged');
|
classes.push('paged');
|
||||||
}
|
}
|
||||||
|
|
||||||
classes = _.reduce(classes, function (memo, item) { return memo + ' ' + item; }, '');
|
classes = _.reduce(classes, function (memo, item) {
|
||||||
|
return memo + ' ' + item;
|
||||||
|
}, '');
|
||||||
return new SafeString(classes.trim());
|
return new SafeString(classes.trim());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ function evaluateTagList(expr, tags) {
|
|||||||
}).reduce(function (p, c) {
|
}).reduce(function (p, c) {
|
||||||
return p || (_.findIndex(tags, function (item) {
|
return p || (_.findIndex(tags, function (item) {
|
||||||
// Escape regex special characters
|
// Escape regex special characters
|
||||||
item = item.replace(/[\-\/\\\^$*+?.()|\[\]{}]/g, '\\$&');
|
item = item.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
|
||||||
item = new RegExp('^' + item + '$', 'i');
|
item = new RegExp('^' + item + '$', 'i');
|
||||||
return item.test(c);
|
return item.test(c);
|
||||||
}) !== -1);
|
}) !== -1);
|
||||||
|
@ -210,7 +210,7 @@ I18n = {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
themeStrings = undefined;
|
themeStrings = undefined;
|
||||||
if (err.code === 'ENOENT') {
|
if (err.code === 'ENOENT') {
|
||||||
logging.warn(`Theme\'s file locales/${currentLocale}.json not found.`);
|
logging.warn(`Theme's file locales/${currentLocale}.json not found.`);
|
||||||
} else {
|
} else {
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
|
@ -7,10 +7,10 @@ let _private = {};
|
|||||||
|
|
||||||
_private.compose = function compose(type) {
|
_private.compose = function compose(type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'pre':
|
case 'pre':
|
||||||
return plainVersion + '-' + semver.prerelease(version)[0] + (semver.prerelease(version)[1] ? '.' + semver.prerelease(version)[1] : '');
|
return plainVersion + '-' + semver.prerelease(version)[0] + (semver.prerelease(version)[1] ? '.' + semver.prerelease(version)[1] : '');
|
||||||
default:
|
default:
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -925,7 +925,7 @@ ghostBookshelf.Model = ghostBookshelf.Model.extend({
|
|||||||
_.each(rules, function (rule) {
|
_.each(rules, function (rule) {
|
||||||
var match, field, direction;
|
var match, field, direction;
|
||||||
|
|
||||||
match = /^([a-z0-9_\.]+)\s+(asc|desc)$/i.exec(rule.trim());
|
match = /^([a-z0-9_.]+)\s+(asc|desc)$/i.exec(rule.trim());
|
||||||
|
|
||||||
// invalid order syntax
|
// invalid order syntax
|
||||||
if (!match) {
|
if (!match) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
var crypto = require('crypto'),
|
var crypto = require('crypto'),
|
||||||
uuid = require('uuid'),
|
uuid = require('uuid'),
|
||||||
ghostBookshelf = require('./base'),
|
ghostBookshelf = require('./base'),
|
||||||
config = require('../config'),
|
config = require('../config'),
|
||||||
Client,
|
Client,
|
||||||
Clients;
|
Clients;
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
var ghostBookshelf = require('./base'),
|
var ghostBookshelf = require('./base'),
|
||||||
Basetoken = require('./base/token'),
|
Basetoken = require('./base/token'),
|
||||||
|
|
||||||
Refreshtoken,
|
Refreshtoken,
|
||||||
Refreshtokens;
|
Refreshtokens;
|
||||||
|
@ -66,7 +66,7 @@ class CollectionRouter extends ParentRouter {
|
|||||||
|
|
||||||
// REGISTER: is rss enabled?
|
// REGISTER: is rss enabled?
|
||||||
if (this.rss) {
|
if (this.rss) {
|
||||||
this.rssRouter = new RSSRouter();
|
this.rssRouter = new RSSRouter();
|
||||||
this.mountRouter(this.route.value, this.rssRouter.router());
|
this.mountRouter(this.route.value, this.rssRouter.router());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ _private.validateData = function validateData(object) {
|
|||||||
data.query[key][option] = object.data[key][option];
|
data.query[key][option] = object.data[key][option];
|
||||||
});
|
});
|
||||||
|
|
||||||
const DEFAULT_RESOURCE = _.find(RESOURCE_CONFIG.QUERY, {resource: data.query[key].resource});
|
const DEFAULT_RESOURCE = _.find(RESOURCE_CONFIG.QUERY, {resource: data.query[key].resource});
|
||||||
|
|
||||||
data.query[key].options = _.pick(object.data[key], allowedQueryOptions);
|
data.query[key].options = _.pick(object.data[key], allowedQueryOptions);
|
||||||
if (data.query[key].type === 'read') {
|
if (data.query[key].type === 'read') {
|
||||||
@ -279,7 +279,7 @@ _private.validateCollections = function validateCollections(collections) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CASE: notation /:slug/ or /:primary_author/ is not allowed. We only accept /{{...}}/.
|
// CASE: notation /:slug/ or /:primary_author/ is not allowed. We only accept /{{...}}/.
|
||||||
if (routingTypeObject.permalink && routingTypeObject.permalink.match(/\/\:\w+/)) {
|
if (routingTypeObject.permalink && routingTypeObject.permalink.match(/\/:\w+/)) {
|
||||||
throw new common.errors.ValidationError({
|
throw new common.errors.ValidationError({
|
||||||
message: common.i18n.t('errors.services.settings.yaml.validate', {
|
message: common.i18n.t('errors.services.settings.yaml.validate', {
|
||||||
at: routingTypeObject.permalink,
|
at: routingTypeObject.permalink,
|
||||||
@ -334,7 +334,7 @@ _private.validateTaxonomies = function validateTaxonomies(taxonomies) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CASE: notation /:slug/ or /:primary_author/ is not allowed. We only accept /{{...}}/.
|
// CASE: notation /:slug/ or /:primary_author/ is not allowed. We only accept /{{...}}/.
|
||||||
if (routingTypeObject && routingTypeObject.match(/\/\:\w+/)) {
|
if (routingTypeObject && routingTypeObject.match(/\/:\w+/)) {
|
||||||
throw new common.errors.ValidationError({
|
throw new common.errors.ValidationError({
|
||||||
message: common.i18n.t('errors.services.settings.yaml.validate', {
|
message: common.i18n.t('errors.services.settings.yaml.validate', {
|
||||||
at: routingTypeObject,
|
at: routingTypeObject,
|
||||||
|
@ -35,7 +35,7 @@ class ActiveTheme {
|
|||||||
|
|
||||||
// @TODO: get gscan to return validated, useful package.json fields for us!
|
// @TODO: get gscan to return validated, useful package.json fields for us!
|
||||||
this._packageInfo = loadedTheme['package.json'];
|
this._packageInfo = loadedTheme['package.json'];
|
||||||
this._partials = checkedTheme.partials;
|
this._partials = checkedTheme.partials;
|
||||||
|
|
||||||
// all custom .hbs templates (e.g. custom-about)
|
// all custom .hbs templates (e.g. custom-about)
|
||||||
this._customTemplates = checkedTheme.templates.custom;
|
this._customTemplates = checkedTheme.templates.custom;
|
||||||
|
@ -254,7 +254,9 @@ class Resources {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const targetTagKeys = Object.keys(obj[relation].find((item) => {return item.id === obj[primaryKey].id;}));
|
const targetTagKeys = Object.keys(obj[relation].find((item) => {
|
||||||
|
return item.id === obj[primaryKey].id;
|
||||||
|
}));
|
||||||
obj[primaryKey] = _.pick(obj[primaryKey], targetTagKeys);
|
obj[primaryKey] = _.pick(obj[primaryKey], targetTagKeys);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -325,7 +327,9 @@ class Resources {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const targetTagKeys = Object.keys(obj[relation].find((item) => {return item.id === obj[primaryKey].id;}));
|
const targetTagKeys = Object.keys(obj[relation].find((item) => {
|
||||||
|
return item.id === obj[primaryKey].id;
|
||||||
|
}));
|
||||||
obj[primaryKey] = _.pick(obj[primaryKey], targetTagKeys);
|
obj[primaryKey] = _.pick(obj[primaryKey], targetTagKeys);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ function deduplicateSubDir(url) {
|
|||||||
subDir = subDir.replace(/^\/|\/+$/, '');
|
subDir = subDir.replace(/^\/|\/+$/, '');
|
||||||
// we can have subdirs that match TLDs so we need to restrict matches to
|
// we can have subdirs that match TLDs so we need to restrict matches to
|
||||||
// duplicates that start with a / or the beginning of the url
|
// duplicates that start with a / or the beginning of the url
|
||||||
subDirRegex = new RegExp('(^|\/)' + subDir + '\/' + subDir + '\/');
|
subDirRegex = new RegExp('(^|/)' + subDir + '/' + subDir + '/');
|
||||||
|
|
||||||
return url.replace(subDirRegex, '$1' + subDir + '/');
|
return url.replace(subDirRegex, '$1' + subDir + '/');
|
||||||
}
|
}
|
||||||
@ -325,7 +325,7 @@ function urlFor(context, data, absolute) {
|
|||||||
|
|
||||||
// This url already has a protocol so is likely an external url to be returned
|
// This url already has a protocol so is likely an external url to be returned
|
||||||
// or it is an alternative scheme, protocol-less, or an anchor-only path
|
// or it is an alternative scheme, protocol-less, or an anchor-only path
|
||||||
if (urlPath && (urlPath.indexOf('://') !== -1 || urlPath.match(/^(\/\/|#|[a-zA-Z0-9\-]+:)/))) {
|
if (urlPath && (urlPath.indexOf('://') !== -1 || urlPath.match(/^(\/\/|#|[a-zA-Z0-9-]+:)/))) {
|
||||||
return urlPath;
|
return urlPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
//
|
//
|
||||||
// Allows each app to declare its own default caching rules
|
// Allows each app to declare its own default caching rules
|
||||||
|
|
||||||
const _ = require('lodash'),
|
const _ = require('lodash'),
|
||||||
config = require('../../config');
|
config = require('../../config');
|
||||||
|
|
||||||
const cacheControl = function cacheControl(options) {
|
const cacheControl = function cacheControl(options) {
|
||||||
|
@ -32,7 +32,7 @@ _private.registerRoutes = function registerRoutes() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (redirect.from[redirect.from.length - 1] !== '$') {
|
if (redirect.from[redirect.from.length - 1] !== '$') {
|
||||||
redirect.from += '\/?$';
|
redirect.from += '/?$';
|
||||||
}
|
}
|
||||||
|
|
||||||
debug('register', redirect.from);
|
debug('register', redirect.from);
|
||||||
|
@ -129,7 +129,7 @@ _private.ThemeErrorRenderer = function ThemeErrorRenderer(err, req, res, next) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
_private.HTMLErrorRenderer = function HTMLErrorRender(err, req, res, next) { // eslint-disable-line no-unused-vars
|
_private.HTMLErrorRenderer = function HTMLErrorRender(err, req, res, next) { // eslint-disable-line no-unused-vars
|
||||||
const data = {
|
const data = {
|
||||||
message: err.message,
|
message: err.message,
|
||||||
statusCode: err.statusCode,
|
statusCode: err.statusCode,
|
||||||
|
@ -22,7 +22,7 @@ const uncapitalise = function uncapitalise(req, res, next) {
|
|||||||
decodedURI;
|
decodedURI;
|
||||||
|
|
||||||
const isSignupOrReset = pathToTest.match(/^(.*\/ghost\/(signup|reset)\/)/i),
|
const isSignupOrReset = pathToTest.match(/^(.*\/ghost\/(signup|reset)\/)/i),
|
||||||
isAPI = pathToTest.match(/^(.*\/ghost\/api\/v[\d\.]+\/.*?\/)/i);
|
isAPI = pathToTest.match(/^(.*\/ghost\/api\/v[\d.]+\/.*?\/)/i);
|
||||||
|
|
||||||
if (isSignupOrReset) {
|
if (isSignupOrReset) {
|
||||||
pathToTest = isSignupOrReset[1];
|
pathToTest = isSignupOrReset[1];
|
||||||
|
@ -104,6 +104,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"eslint": "4.19.1",
|
"eslint": "4.19.1",
|
||||||
|
"eslint-plugin-ghost": "0.0.27",
|
||||||
"grunt": "1.0.3",
|
"grunt": "1.0.3",
|
||||||
"grunt-bg-shell": "2.3.3",
|
"grunt-bg-shell": "2.3.3",
|
||||||
"grunt-cli": "1.2.0",
|
"grunt-cli": "1.2.0",
|
||||||
|
42
yarn.lock
42
yarn.lock
@ -1532,6 +1532,10 @@ electron-to-chromium@^1.2.7:
|
|||||||
version "1.3.48"
|
version "1.3.48"
|
||||||
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.48.tgz#d3b0d8593814044e092ece2108fc3ac9aea4b900"
|
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.48.tgz#d3b0d8593814044e092ece2108fc3ac9aea4b900"
|
||||||
|
|
||||||
|
ember-rfc176-data@^0.3.3:
|
||||||
|
version "0.3.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/ember-rfc176-data/-/ember-rfc176-data-0.3.4.tgz#566fd3b7192d02a9a0bfe7e22bbaa4d3a1682e4a"
|
||||||
|
|
||||||
emits@^3.0.0:
|
emits@^3.0.0:
|
||||||
version "3.0.0"
|
version "3.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/emits/-/emits-3.0.0.tgz#32752bba95e1707b219562384ab9bb8b1fd62f70"
|
resolved "https://registry.yarnpkg.com/emits/-/emits-3.0.0.tgz#32752bba95e1707b219562384ab9bb8b1fd62f70"
|
||||||
@ -1608,6 +1612,26 @@ escodegen@^1.8.1:
|
|||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
source-map "~0.6.1"
|
source-map "~0.6.1"
|
||||||
|
|
||||||
|
eslint-plugin-ember@^5.0.3:
|
||||||
|
version "5.2.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/eslint-plugin-ember/-/eslint-plugin-ember-5.2.0.tgz#fa436e0497dfc01d1d38608229cd616e7c5b6067"
|
||||||
|
dependencies:
|
||||||
|
ember-rfc176-data "^0.3.3"
|
||||||
|
snake-case "^2.1.0"
|
||||||
|
|
||||||
|
eslint-plugin-ghost@0.0.27:
|
||||||
|
version "0.0.27"
|
||||||
|
resolved "https://registry.yarnpkg.com/eslint-plugin-ghost/-/eslint-plugin-ghost-0.0.27.tgz#f0a10d8ae8772f3c1ed0499603712cf7007aafb9"
|
||||||
|
dependencies:
|
||||||
|
eslint-plugin-ember "^5.0.3"
|
||||||
|
eslint-plugin-sort-imports-es6-autofix "0.2.2"
|
||||||
|
|
||||||
|
eslint-plugin-sort-imports-es6-autofix@0.2.2:
|
||||||
|
version "0.2.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/eslint-plugin-sort-imports-es6-autofix/-/eslint-plugin-sort-imports-es6-autofix-0.2.2.tgz#6d8512bde75142c188a0695db55d442d7f7e011d"
|
||||||
|
dependencies:
|
||||||
|
eslint "^4.15.0"
|
||||||
|
|
||||||
eslint-scope@^3.7.1:
|
eslint-scope@^3.7.1:
|
||||||
version "3.7.1"
|
version "3.7.1"
|
||||||
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-3.7.1.tgz#3d63c3edfda02e06e01a452ad88caacc7cdcb6e8"
|
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-3.7.1.tgz#3d63c3edfda02e06e01a452ad88caacc7cdcb6e8"
|
||||||
@ -1619,7 +1643,7 @@ eslint-visitor-keys@^1.0.0:
|
|||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d"
|
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d"
|
||||||
|
|
||||||
eslint@4.19.1, eslint@^4.0.0:
|
eslint@4.19.1, eslint@^4.0.0, eslint@^4.15.0:
|
||||||
version "4.19.1"
|
version "4.19.1"
|
||||||
resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.19.1.tgz#32d1d653e1d90408854bfb296f076ec7e186a300"
|
resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.19.1.tgz#32d1d653e1d90408854bfb296f076ec7e186a300"
|
||||||
dependencies:
|
dependencies:
|
||||||
@ -3640,6 +3664,10 @@ loud-rejection@^1.0.0:
|
|||||||
currently-unhandled "^0.4.1"
|
currently-unhandled "^0.4.1"
|
||||||
signal-exit "^3.0.0"
|
signal-exit "^3.0.0"
|
||||||
|
|
||||||
|
lower-case@^1.1.1:
|
||||||
|
version "1.1.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/lower-case/-/lower-case-1.1.4.tgz#9a2cabd1b9e8e0ae993a4bf7d5875c39c42e8eac"
|
||||||
|
|
||||||
lowercase-keys@^1.0.0:
|
lowercase-keys@^1.0.0:
|
||||||
version "1.0.1"
|
version "1.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-1.0.1.tgz#6f9e30b47084d971a7c820ff15a6c5167b74c26f"
|
resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-1.0.1.tgz#6f9e30b47084d971a7c820ff15a6c5167b74c26f"
|
||||||
@ -4092,6 +4120,12 @@ nise@^1.2.0:
|
|||||||
path-to-regexp "^1.7.0"
|
path-to-regexp "^1.7.0"
|
||||||
text-encoding "^0.6.4"
|
text-encoding "^0.6.4"
|
||||||
|
|
||||||
|
no-case@^2.2.0:
|
||||||
|
version "2.3.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/no-case/-/no-case-2.3.2.tgz#60b813396be39b3f1288a4c1ed5d1e7d28b464ac"
|
||||||
|
dependencies:
|
||||||
|
lower-case "^1.1.1"
|
||||||
|
|
||||||
nock@9.4.0:
|
nock@9.4.0:
|
||||||
version "9.4.0"
|
version "9.4.0"
|
||||||
resolved "https://registry.yarnpkg.com/nock/-/nock-9.4.0.tgz#d151c0020c9c10fe2f139c4bc7498457959eddc8"
|
resolved "https://registry.yarnpkg.com/nock/-/nock-9.4.0.tgz#d151c0020c9c10fe2f139c4bc7498457959eddc8"
|
||||||
@ -5539,6 +5573,12 @@ slice-ansi@1.0.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
is-fullwidth-code-point "^2.0.0"
|
is-fullwidth-code-point "^2.0.0"
|
||||||
|
|
||||||
|
snake-case@^2.1.0:
|
||||||
|
version "2.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/snake-case/-/snake-case-2.1.0.tgz#41bdb1b73f30ec66a04d4e2cad1b76387d4d6d9f"
|
||||||
|
dependencies:
|
||||||
|
no-case "^2.2.0"
|
||||||
|
|
||||||
snapdragon-node@^2.0.1:
|
snapdragon-node@^2.0.1:
|
||||||
version "2.1.1"
|
version "2.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/snapdragon-node/-/snapdragon-node-2.1.1.tgz#6c175f86ff14bdb0724563e8f3c1b021a286853b"
|
resolved "https://registry.yarnpkg.com/snapdragon-node/-/snapdragon-node-2.1.1.tgz#6c175f86ff14bdb0724563e8f3c1b021a286853b"
|
||||||
|
Loading…
Reference in New Issue
Block a user