Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps-dev): update eslint requirement from ^5.9.0 to ^6.0.1 #3606

Merged
merged 2 commits into from
Jul 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/hexo/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ Render.prototype.renderSync = function(data, options) {
};

function toString(result, options) {
if (!options.hasOwnProperty('toString') || typeof result === 'string') return result;
if (!Object.prototype.hasOwnProperty.call(options, 'toString') || typeof result === 'string') return result;

if (typeof options.toString === 'function') {
return options.toString(result);
Expand Down
2 changes: 1 addition & 1 deletion lib/plugins/filter/post_permalink.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function postPermalinkFilter(data) {

for (let i = 0, len = keys.length; i < len; i++) {
const key = keys[i];
if (meta.hasOwnProperty(key)) continue;
if (Object.prototype.hasOwnProperty.call(meta, key)) continue;

// Use Object.getOwnPropertyDescriptor to copy getters to avoid "Maximum call
// stack size exceeded" error
Expand Down
2 changes: 1 addition & 1 deletion lib/plugins/helper/list_archives.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function listArchivesHelper(options = {}) {
let { format } = options;
const type = options.type || 'monthly';
const { style = 'list', transform, separator = ', ' } = options;
const showCount = options.hasOwnProperty('show_count') ? options.show_count : true;
const showCount = Object.prototype.hasOwnProperty.call(options, 'show_count') ? options.show_count : true;
const className = options.class || 'archive';
const order = options.order || -1;
let result = '';
Expand Down
6 changes: 3 additions & 3 deletions lib/plugins/helper/list_categories.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

function listCategoriesHelper(categories, options) {
if (!options && (!categories || !categories.hasOwnProperty('length'))) {
if (!options && (!categories || !Object.prototype.hasOwnProperty.call(categories, 'length'))) {
options = categories;
categories = this.site.categories;
}
Expand All @@ -10,13 +10,13 @@ function listCategoriesHelper(categories, options) {
options = options || {};

const { style = 'list', transform, separator = ', ', suffix = '' } = options;
const showCount = options.hasOwnProperty('show_count') ? options.show_count : true;
const showCount = Object.prototype.hasOwnProperty.call(options, 'show_count') ? options.show_count : true;
const className = options.class || 'category';
const depth = options.depth ? parseInt(options.depth, 10) : 0;
const orderby = options.orderby || 'name';
const order = options.order || 1;
const showCurrent = options.show_current || false;
const childrenIndicator = options.hasOwnProperty('children_indicator') ? options.children_indicator : false;
const childrenIndicator = Object.prototype.hasOwnProperty.call(options, 'children_indicator') ? options.children_indicator : false;

const prepareQuery = parent => {
const query = {};
Expand Down
2 changes: 1 addition & 1 deletion lib/plugins/helper/list_posts.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

function listPostsHelper(posts, options) {
if (!options && (!posts || !posts.hasOwnProperty('length'))) {
if (!options && (!posts || !Object.prototype.hasOwnProperty.call(posts, 'length'))) {
options = posts;
posts = this.site.posts;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/plugins/helper/list_tags.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

function listTagsHelper(tags, options) {
if (!options && (!tags || !tags.hasOwnProperty('length'))) {
if (!options && (!tags || !Object.prototype.hasOwnProperty.call(tags, 'length'))) {
options = tags;
tags = this.site.tags;
}
Expand All @@ -10,7 +10,7 @@ function listTagsHelper(tags, options) {
options = options || {};

const { style = 'list', transform, separator = ', ', suffix = '' } = options;
const showCount = options.hasOwnProperty('show_count') ? options.show_count : true;
const showCount = Object.prototype.hasOwnProperty.call(options, 'show_count') ? options.show_count : true;
const className = options.class || 'tag';
const orderby = options.orderby || 'name';
const order = options.order || 1;
Expand Down
6 changes: 3 additions & 3 deletions lib/plugins/helper/paginator.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
function paginatorHelper(options = {}) {
const current = options.current || this.page.current || 0;
const total = options.total || this.page.total || 1;
const endSize = options.hasOwnProperty('end_size') ? +options.end_size : 1;
const midSize = options.hasOwnProperty('mid_size') ? +options.mid_size : 2;
const endSize = Object.prototype.hasOwnProperty.call(options, 'end_size') ? +options.end_size : 1;
const midSize = Object.prototype.hasOwnProperty.call(options, 'mid_size') ? +options.mid_size : 2;
const { space = '&hellip;', transform } = options;
const base = options.base || this.page.base || '';
const format = options.format || `${this.config.pagination_dir}/%d/`;
const prevText = options.prev_text || 'Prev';
const nextText = options.next_text || 'Next';
const prevNext = options.hasOwnProperty('prev_next') ? options.prev_next : true;
const prevNext = Object.prototype.hasOwnProperty.call(options, 'prev_next') ? options.prev_next : true;

if (!current) return '';

Expand Down
4 changes: 2 additions & 2 deletions lib/plugins/helper/tagcloud.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ const colorNames = {
};

function tagcloudHelper(tags, options) {
if (!options && (!tags || !tags.hasOwnProperty('length'))) {
if (!options && (!tags || !Object.prototype.hasOwnProperty.call(tags, 'length'))) {
options = tags;
tags = this.site.tags;
}
Expand Down Expand Up @@ -251,7 +251,7 @@ function Color(color) {
Color.prototype.parse = function(color) {
color = color.toLowerCase();

if (colorNames.hasOwnProperty(color)) {
if (Object.prototype.hasOwnProperty.call(colorNames, color)) {
const obj = colorNames[color];

this.r = obj.r;
Expand Down
4 changes: 2 additions & 2 deletions lib/plugins/helper/toc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ function tocHelper(str, options = {}) {
if (!cheerio) cheerio = require('cheerio');

const $ = cheerio.load(str);
const headingsMaxDepth = options.hasOwnProperty('max_depth') ? options.max_depth : 6;
const headingsMaxDepth = Object.prototype.hasOwnProperty.call(options, 'max_depth') ? options.max_depth : 6;
const headingsSelector = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'].slice(0, headingsMaxDepth).join(',');
const headings = $(headingsSelector);

if (!headings.length) return '';

const className = options.class || 'toc';
const listNumber = options.hasOwnProperty('list_number') ? options.list_number : true;
const listNumber = Object.prototype.hasOwnProperty.call(options, 'list_number') ? options.list_number : true;
let result = `<ol class="${className}">`;
const lastNumber = [0, 0, 0, 0, 0, 0];
let firstLevel = 0;
Expand Down
2 changes: 1 addition & 1 deletion lib/plugins/processor/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ module.exports = ctx => {
data.slug = info.title;

if (file.params.published) {
if (!data.hasOwnProperty('published')) data.published = true;
if (!Object.prototype.hasOwnProperty.call(data, 'published')) data.published = true;
} else {
data.published = false;
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"@easyops/git-exec-and-restage": "^1.0.4",
"chai": "^4.1.2",
"chai-as-promised": "^7.1.1",
"eslint": "^5.9.0",
"eslint": "^6.0.1",
"eslint-ci": "^1.0.0",
"eslint-config-hexo": "^3.0.0",
"hexo-renderer-marked": "^1.0.1",
Expand Down
2 changes: 1 addition & 1 deletion test/scripts/helpers/paginator.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe('paginator', () => {
const total = data.total;
const pages = data.pages;
const space = data.space || '&hellip;';
const prevNext = data.hasOwnProperty('prev_next') ? data.prev_next : true;
const prevNext = Object.prototype.hasOwnProperty.call(data, 'prev_next') ? data.prev_next : true;
let num;

if (prevNext && current > 1) {
Expand Down