0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-04-01 02:41:39 -05:00

Added /frontend folder to default lint command

no issue

- The folder was overseen to be added to lint rules after it has been extracted out of /server
This commit is contained in:
Nazar Gargol 2019-08-08 10:47:13 +02:00
parent 3e0ddb2b87
commit e10e71cc26
10 changed files with 18 additions and 18 deletions

View file

@ -45,7 +45,7 @@ function errorHandler(error, req, res, next) {
}
function honeyPot(req, res, next) {
if (!req.body.hasOwnProperty('confirm') || req.body.confirm !== '') {
if (!Object.prototype.hasOwnProperty.call(req.body, 'confirm') || req.body.confirm !== '') {
return next(new Error('Oops, something went wrong!'));
}

View file

@ -15,7 +15,7 @@ module.exports = function content(options = {}) {
let runTruncate = false;
for (const key of ['words', 'characters']) {
if (hash.hasOwnProperty(key)) {
if (Object.prototype.hasOwnProperty.call(hash, key)) {
runTruncate = true;
truncateOptions[key] = parseInt(hash[key], 10);
}

View file

@ -9,7 +9,7 @@ const moment = require('moment-timezone');
module.exports = function (date, options) {
let timezone;
if (!options && date.hasOwnProperty('hash')) {
if (!options && Object.prototype.hasOwnProperty.call(date, 'hash')) {
options = date;
date = undefined;
timezone = options.data.blog.timezone;

View file

@ -17,7 +17,7 @@ module.exports = function t(text, options) {
var bindings = {},
prop;
for (prop in options.hash) {
if (options.hash.hasOwnProperty(prop)) {
if (Object.prototype.hasOwnProperty.call(options.hash, prop)) {
bindings[prop] = options.hash[prop];
}
}

View file

@ -90,11 +90,11 @@ function fetchData(pathOptions, routerOptions, locals) {
postQuery.options.order = routerOptions.order;
}
if (pathOptions.hasOwnProperty('page')) {
if (Object.prototype.hasOwnProperty.call(pathOptions, 'page')) {
postQuery.options.page = pathOptions.page;
}
if (pathOptions.hasOwnProperty('limit')) {
if (Object.prototype.hasOwnProperty.call(pathOptions, 'limit')) {
postQuery.options.limit = pathOptions.limit;
}

View file

@ -13,7 +13,7 @@ _private.validateTemplate = function validateTemplate(object) {
};
}
if (!object.hasOwnProperty('template')) {
if (!Object.prototype.hasOwnProperty.call(object, 'template')) {
object.templates = [];
return object;
}
@ -29,7 +29,7 @@ _private.validateTemplate = function validateTemplate(object) {
};
_private.validateData = function validateData(object) {
if (!object.hasOwnProperty('data')) {
if (!Object.prototype.hasOwnProperty.call(object, 'data')) {
return object;
}
@ -51,7 +51,7 @@ _private.validateData = function validateData(object) {
let [resourceKey, slug] = shortForm.split('.');
if (!RESOURCE_CONFIG.QUERY[resourceKey] ||
(RESOURCE_CONFIG.QUERY[resourceKey].hasOwnProperty('internal') && RESOURCE_CONFIG.QUERY[resourceKey].internal === true)) {
(Object.prototype.hasOwnProperty.call(RESOURCE_CONFIG.QUERY[resourceKey], 'internal') && RESOURCE_CONFIG.QUERY[resourceKey].internal === true)) {
throw new common.errors.ValidationError({
message: `Resource key not supported. ${resourceKey}`,
help: 'Please use: tag, user, post or page.'
@ -130,7 +130,7 @@ _private.validateData = function validateData(object) {
};
_.each(requiredQueryFields, (option) => {
if (!object.data[key].hasOwnProperty(option)) {
if (!Object.prototype.hasOwnProperty.call(object.data[key], option)) {
throw new common.errors.ValidationError({
message: common.i18n.t('errors.services.settings.yaml.validate', {
at: JSON.stringify(object.data[key]),
@ -162,7 +162,7 @@ _private.validateData = function validateData(object) {
data.query[key].options = _.defaults(data.query[key].options, DEFAULT_RESOURCE.options);
}
if (!data.router.hasOwnProperty(DEFAULT_RESOURCE.resourceAlias || DEFAULT_RESOURCE.resource)) {
if (!Object.prototype.hasOwnProperty.call(data.router, DEFAULT_RESOURCE.resourceAlias || DEFAULT_RESOURCE.resource)) {
data.router[DEFAULT_RESOURCE.resourceAlias || DEFAULT_RESOURCE.resource] = [];
}
@ -244,7 +244,7 @@ _private.validateCollections = function validateCollections(collections) {
});
}
if (!routingTypeObject.hasOwnProperty('permalink')) {
if (!Object.prototype.hasOwnProperty.call(routingTypeObject, 'permalink')) {
throw new common.errors.ValidationError({
message: common.i18n.t('errors.services.settings.yaml.validate', {
at: routingTypeObjectKey,

View file

@ -5,7 +5,7 @@ const config = require('../../../server/config'),
// Responsible for handling requests for sitemap files
module.exports = function handler(siteApp) {
const verifyResourceType = function verifyResourceType(req, res, next) {
if (!manager.hasOwnProperty(req.params.resource)) {
if (!Object.prototype.hasOwnProperty.call(manager, req.params.resource)) {
return res.sendStatus(404);
}

View file

@ -5,7 +5,7 @@ var _ = require('lodash'),
module.exports.create = function configLoader(packageJson) {
var config = _.cloneDeep(defaultConfig);
if (packageJson && packageJson.hasOwnProperty('config')) {
if (packageJson && Object.prototype.hasOwnProperty.call(packageJson, 'config')) {
config = _.assign(config, _.pick(packageJson.config, allowedKeys));
}

View file

@ -23,7 +23,7 @@ const allowedKeys = ['ghost-api'];
module.exports = (packageJson) => {
let themeEngines = _.cloneDeep(DEFAULTS);
if (packageJson && packageJson.hasOwnProperty('engines')) {
if (packageJson && Object.prototype.hasOwnProperty.call(packageJson, 'engines')) {
// CASE: validate
if (packageJson.engines['ghost-api']) {
const availableApiVersions = {};

View file

@ -79,12 +79,12 @@ class Queue extends EventEmitter {
* @param {function} fn
*/
register(options, fn) {
if (!options.hasOwnProperty('tolerance')) {
if (!Object.prototype.hasOwnProperty.call(options, 'tolerance')) {
options.tolerance = 0;
}
// CASE: nobody has initialised the queue event yet
if (!this.queue.hasOwnProperty(options.event)) {
if (!Object.prototype.hasOwnProperty.call(this.queue, options.event)) {
this.queue[options.event] = {
tolerance: options.tolerance,
requiredSubscriberCount: options.requiredSubscriberCount || 0,
@ -178,7 +178,7 @@ class Queue extends EventEmitter {
// CASE: nobody is in the event queue waiting yet
// e.g. all resources are fetched already, but no subscribers (bootstrap)
// happens only for high tolerant events
if (!this.queue.hasOwnProperty(options.event)) {
if (!Object.prototype.hasOwnProperty.call(this.queue, options.event)) {
this.queue[options.event] = {
tolerance: options.tolerance || 0,
requiredSubscriberCount: options.requiredSubscriberCount || 0,