Skip to content

Commit

Permalink
style: eslint-config-hexo@4 (#156)
Browse files Browse the repository at this point in the history
  • Loading branch information
curbengh authored and SukkaW committed Dec 14, 2019
1 parent 0d2b0e8 commit 621c9e3
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 12 deletions.
4 changes: 3 additions & 1 deletion lib/color.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,9 @@ class Color {
this.a = match[4] ? +match[4] : 1;

if (!s) {
this.r = this.g = this.b = l * 255;
this.r = l * 255;
this.g = this.r;
this.b = this.r;
}

const q = l < 0.5 ? l * (1 + s) : l + s - (l * s);
Expand Down
4 changes: 2 additions & 2 deletions lib/decode_url.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
const { parse, URL } = require('url');
const { toUnicode } = require('punycode.js');

const safeDecodeURI = (str) => {
const safeDecodeURI = str => {
try {
return decodeURI(str);
} catch (err) {
return str;
}
};

const decodeURL = (str) => {
const decodeURL = str => {
if (parse(str).protocol) {
const parsed = new URL(str);

Expand Down
4 changes: 2 additions & 2 deletions lib/encode_url.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
const { toUnicode } = require('punycode.js');
const { parse, URL } = require('url');

const safeDecodeURI = (str) => {
const safeDecodeURI = str => {
try {
return decodeURI(str);
} catch (err) {
return str;
}
};

const encodeURL = (str) => {
const encodeURL = str => {
if (parse(str).protocol) {
const parsed = new URL(str);

Expand Down
2 changes: 1 addition & 1 deletion lib/unescape_html.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const htmlEntityMap = {

const regexHtml = new RegExp(Object.keys(htmlEntityMap).join('|'), 'g');

const unescapeHTML = (str) => {
const unescapeHTML = str => {
if (typeof str !== 'string') throw new TypeError('str must be a string!');

return str.replace(regexHtml, a => htmlEntityMap[a]);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"chai": "^4.2.0",
"chai-as-promised": "^7.1.1",
"eslint": "^6.0.1",
"eslint-config-hexo": "^3.0.0",
"eslint-config-hexo": "^4.0.0",
"html-entities": "^1.2.1",
"html-tag-validator": "^1.5.0",
"mocha": "^6.0.1",
Expand Down
10 changes: 5 additions & 5 deletions test/highlight.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,9 @@ describe('highlight', () => {
validateHtmlAsync(result, done);
});

it('highlight sublanguages', function(done) {
var str = '<node><?php echo "foo"; ?></node>';
var result = highlight(str, {lang: 'xml'});
it('highlight sublanguages', done => {
const str = '<node><?php echo "foo"; ?></node>';
const result = highlight(str, {lang: 'xml'});
result.should.eql([
'<figure class="highlight xml"><table><tr>',
gutter(1, 1),
Expand Down Expand Up @@ -305,7 +305,7 @@ describe('highlight', () => {
validateHtmlAsync(result, done);
});

it('hljs compatibility - with lines', (done) => {
it('hljs compatibility - with lines', done => {
const str = [
'function (a) {',
' if (a > 3)',
Expand All @@ -322,7 +322,7 @@ describe('highlight', () => {
validateHtmlAsync(result, done);
});

it('hljs compatibility - no lines', (done) => {
it('hljs compatibility - no lines', done => {
const str = [
'function (a) {',
' if (a > 3)',
Expand Down

0 comments on commit 621c9e3

Please sign in to comment.