From f5cce4eac6703201810fcbdc42c07fa4fa7973a1 Mon Sep 17 00:00:00 2001 From: Aetf Date: Mon, 12 Apr 2021 23:02:15 -0400 Subject: [PATCH] Fix eslint --- .eslintignore | 3 ++- lib/dom-filter.js | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.eslintignore b/.eslintignore index 642271f..92872bb 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,2 +1,3 @@ node_modules/ -coverage/ \ No newline at end of file +coverage/ +.nyc_output diff --git a/lib/dom-filter.js b/lib/dom-filter.js index 2d23cb3..85fd9a3 100644 --- a/lib/dom-filter.js +++ b/lib/dom-filter.js @@ -6,10 +6,10 @@ const CSSselect = require('css-select'); class Filter { constructor(hexo, excludes) { this.hexo = hexo; - this.selectors = excludes.map(this._compile); + this.selectors = excludes.map(this._compile.bind(this)); } - _compile = selector => { + _compile(selector) { try { return CSSselect.compile(selector); } catch (err) { @@ -18,18 +18,18 @@ class Filter { } } - match = node => { + match(node) { // not match any return !this.selectors.some(s => s(node)); } - filter = nodes => { + filter(nodes) { // remove inner nodes that doesn't match domutils.filter(n => !this.match(n), nodes) .forEach(node => domutils.removeElement(node)); // only keep top level nodes that match - return nodes.filter(this.match); + return nodes.filter(this.match.bind(this)); } }