diff --git a/.travis.yml b/.travis.yml index 52672917..bbabbb5c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,13 +8,11 @@ cache: - node_modules node_js: - - "6" + - "8" + - "10" - "node" script: - # For older versions of npm (ie. the one bundled with Node 6), we need to manually run `prepare` - # to build the project. You can still install and consume the package without any issue. - - if [[ "$TRAVIS_NODE_VERSION" == "6" ]]; then npm run prepare; fi - npm run eslint - npm run test-cov diff --git a/lib/highlight.js b/lib/highlight.js index 42fa2aa9..298b405a 100644 --- a/lib/highlight.js +++ b/lib/highlight.js @@ -8,7 +8,7 @@ const alias = require('../highlight_alias.json'); function highlightUtil(str, options = {}) { if (typeof str !== 'string') throw new TypeError('str must be a string!'); - const useHljs = options.hasOwnProperty('hljs') ? options.hljs : false; + const useHljs = Object.prototype.hasOwnProperty.call(options, 'hljs') ? options.hljs : false; const { gutter = true, firstLine = 1, diff --git a/lib/permalink.js b/lib/permalink.js index d574866e..4e31353e 100644 --- a/lib/permalink.js +++ b/lib/permalink.js @@ -15,7 +15,7 @@ function Permalink(rule, options) { .replace(rParam, (match, name) => { params.push(name); - if (segments.hasOwnProperty(name)) { + if (Object.prototype.hasOwnProperty.call(segments, name)) { const segment = segments[name]; if (segment instanceof RegExp) { diff --git a/package.json b/package.json index 12a4c108..941091aa 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "license": "MIT", "devDependencies": { "chai": "^4.2.0", - "eslint": "^5.9.0", + "eslint": "^6.0.1", "eslint-config-hexo": "^3.0.0", "html-tag-validator": "^1.5.0", "istanbul": "^0.4.3", @@ -43,6 +43,6 @@ "striptags": "^3.1.1" }, "engines": { - "node": ">=6.9.0" + "node": ">=8.6.0" } } diff --git a/test/scripts/spawn.js b/test/scripts/spawn.js index 23fe3c64..f215c3db 100644 --- a/test/scripts/spawn.js +++ b/test/scripts/spawn.js @@ -44,7 +44,10 @@ describe('spawn', () => { spawn.__set__('process', { stdout: stdoutCache, - stderr: stderrCache + stderr: stderrCache, + removeListener: () => {}, + on: () => {}, + exit: () => {} }); return spawn('echo', [content], { @@ -61,7 +64,10 @@ describe('spawn', () => { spawn.__set__('process', { stdout: stdoutCache, - stderr: stderrCache + stderr: stderrCache, + removeListener: () => {}, + on: () => {}, + exit: () => {} }); return spawn('cat', ['nothing'], {