Skip to content

Commit a27de95

Browse files
authored
Merge pull request #334 from benjamine/ci-build-test-lint
Update devDependencies
2 parents 135085c + 2389bd0 commit a27de95

29 files changed

+6701
-9805
lines changed

.babelrc

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,6 @@
11
{
22
"presets": [
3-
"stage-0",
4-
"stage-1",
5-
"stage-2",
6-
[
7-
"env",
8-
{
9-
"modules": false,
10-
"targets": {
11-
"node": "4.8",
12-
"browsers": ["last 2 versions"],
13-
"ie": 8
14-
}
15-
}
16-
]
3+
["@babel/preset-env", { "targets": "defaults" }]
174
],
18-
"plugins": ["transform-object-rest-spread"]
5+
"plugins": ["@babel/plugin-proposal-export-default-from"]
196
}

.eslintrc.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
2-
"parser": "babel-eslint",
2+
"parser": "@babel/eslint-parser",
33
"extends": ["standard"],
4-
"plugins": ["standard"],
54
"rules": {
65
"semi": [2, "always"],
76
"space-before-function-paren": [2, "never"],

.github/workflows/CI.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,12 @@ jobs:
1313

1414
steps:
1515
- uses: actions/checkout@v3
16-
- name: Use Node.js 8.17.0
17-
uses: actions/setup-node@v3
16+
- uses: actions/setup-node@v3
1817
with:
19-
node-version: 8.17.0
18+
node-version: 'lts/*'
2019
cache: 'npm'
2120
- run: npm ci
21+
- run: npm run build
22+
- run: npm run build-dist
23+
- run: npm run test
24+
- run: npm run lint

.mocharc.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
spec: ['build/jsondiffpatch.cjs.test.js']
3+
};

docs/demo/consoledemo.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ const data = {
132132
],
133133
};
134134

135-
let left = JSON.parse(JSON.stringify(data), jsondiffpatch.dateReviver);
135+
const left = JSON.parse(JSON.stringify(data), jsondiffpatch.dateReviver);
136136

137137
data.summary = data.summary
138138
.replace('Brazil', 'Brasil')
@@ -156,6 +156,6 @@ delete data.surface;
156156
data.spanishName = 'Sudamérica';
157157
data.demographics.population += 2342;
158158

159-
let right = data;
160-
let delta = instance.diff(left, right);
159+
const right = data;
160+
const delta = instance.diff(left, right);
161161
jsondiffpatch.console.log(delta);

docs/demo/demo.js

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
],
130130
};
131131

132-
let json = [JSON.stringify(data, null, 2)];
132+
const json = [JSON.stringify(data, null, 2)];
133133

134134
data.summary = data.summary
135135
.replace('Brazil', 'Brasil')
@@ -189,9 +189,9 @@
189189
el.className = el.className.replace(
190190
new RegExp(
191191
'(^|\\b)' + className.split(' ').join('|') + '(\\b|$)',
192-
'gi'
192+
'gi',
193193
),
194-
' '
194+
' ',
195195
);
196196
}
197197
},
@@ -236,7 +236,7 @@
236236
try {
237237
data = JSON.parse(this.responseText, jsondiffpatch.dateReviver);
238238
} catch (parseError) {
239-
// eslint-disable-next-line standard/no-callback-literal
239+
// eslint-disable-next-line n/no-callback-literal
240240
return callback('parse error: ' + parseError);
241241
}
242242
if (this.status >= 200 && this.status < 400) {
@@ -250,9 +250,9 @@
250250
request = null;
251251
},
252252
runScriptTags: function(el) {
253-
let scripts = el.querySelectorAll('script');
253+
const scripts = el.querySelectorAll('script');
254254
for (let i = 0; i < scripts.length; i++) {
255-
let s = scripts[i];
255+
const s = scripts[i];
256256
// eslint-disable-next-line no-eval
257257
eval(s.innerHTML);
258258
}
@@ -335,7 +335,7 @@
335335
this.editor = CodeMirror.fromTextArea(this.element, {
336336
mode: 'javascript',
337337
json: true,
338-
readOnly: readOnly,
338+
readOnly,
339339
});
340340
if (!readOnly) {
341341
this.editor.on('change', compare);
@@ -391,7 +391,7 @@
391391
case 'visual':
392392
visualdiff.innerHTML = jsondiffpatch.formatters.html.format(
393393
delta,
394-
left
394+
left,
395395
);
396396
if (!document.getElementById('showunchanged').checked) {
397397
jsondiffpatch.formatters.html.hideUnchanged();
@@ -400,7 +400,7 @@
400400
break;
401401
case 'annotated':
402402
annotateddiff.innerHTML = jsondiffpatch.formatters.annotated.format(
403-
delta
403+
delta,
404404
);
405405
break;
406406
case 'json':
@@ -458,21 +458,21 @@
458458
dom.on(
459459
document.getElementById('show-delta-type-visual'),
460460
'click',
461-
showSelectedDeltaType
461+
showSelectedDeltaType,
462462
);
463463
dom.on(
464464
document.getElementById('show-delta-type-annotated'),
465465
'click',
466-
showSelectedDeltaType
466+
showSelectedDeltaType,
467467
);
468468
dom.on(
469469
document.getElementById('show-delta-type-json'),
470470
'click',
471-
showSelectedDeltaType
471+
showSelectedDeltaType,
472472
);
473473

474474
dom.on(document.getElementById('swap'), 'click', function() {
475-
let leftValue = areas.left.getValue();
475+
const leftValue = areas.left.getValue();
476476
areas.left.setValue(areas.right.getValue());
477477
areas.right.setValue(leftValue);
478478
compare();
@@ -488,7 +488,7 @@
488488
jsondiffpatch.formatters.html.showUnchanged(
489489
document.getElementById('showunchanged').checked,
490490
null,
491-
800
491+
800,
492492
);
493493
});
494494

@@ -514,11 +514,11 @@
514514

515515
dom.text(
516516
document.getElementById('json-panel-left').querySelector('h2'),
517-
(data.left && data.left.name) || 'left.json'
517+
(data.left && data.left.name) || 'left.json',
518518
);
519519
dom.text(
520520
document.getElementById('json-panel-right').querySelector('h2'),
521-
(data.right && data.right.name) || 'right.json'
521+
(data.right && data.right.name) || 'right.json',
522522
);
523523

524524
document
@@ -539,21 +539,21 @@
539539
load.gist = function(id) {
540540
dom.getJson('https://api.github.com/gists/' + id, function(error, data) {
541541
if (error) {
542-
let message = error + (data && data.message ? data.message : '');
542+
const message = error + (data && data.message ? data.message : '');
543543
load.data({
544544
error: message,
545545
});
546546
return;
547547
}
548-
let filenames = [];
549-
for (let filename in data.files) {
550-
let file = data.files[filename];
548+
const filenames = [];
549+
for (const filename in data.files) {
550+
const file = data.files[filename];
551551
if (file.language === 'JSON') {
552552
filenames.push(filename);
553553
}
554554
}
555555
filenames.sort();
556-
let files = [data.files[filenames[0]], data.files[filenames[1]]];
556+
const files = [data.files[filenames[0]], data.files[filenames[1]]];
557557
/* jshint camelcase: false */
558558
load.data({
559559
url: data.html_url,
@@ -577,7 +577,7 @@
577577
const rightValue = decodeURIComponent(rightValueArg);
578578
const urlmatch = /https?:\/\/.*\/([^/]+\.json)(?:[?#].*)?/;
579579
const dataLoaded = {
580-
description: description,
580+
description,
581581
left: {},
582582
right: {},
583583
};
@@ -633,7 +633,7 @@
633633
gist: /^(?:https?:\/\/)?(?:gist\.github\.com\/)?(?:[\w0-9\-a-f]+\/)?([0-9a-f]+)$/i,
634634
leftright: /^(?:desc=(.*)?&)?left=(.*)&right=(.*)&?$/i,
635635
};
636-
for (let loader in matchers) {
636+
for (const loader in matchers) {
637637
const match = matchers[loader].exec(key);
638638
if (match) {
639639
return load[loader].apply(load, match.slice(1));
@@ -658,7 +658,7 @@
658658
dom.on(document.getElementById('examples'), 'change', function() {
659659
const example = trim(this.value);
660660
switch (example) {
661-
case 'text':
661+
case 'text': {
662662
const exampleJson = getExampleJson();
663663
load.data({
664664
left: {
@@ -671,18 +671,19 @@
671671
},
672672
});
673673
break;
674+
}
674675
case 'gist':
675676
document.location = '?benjamine/9188826';
676677
break;
677678
case 'moving':
678679
document.location =
679680
'?desc=moving%20around&left=' +
680681
encodeURIComponent(
681-
JSON.stringify([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
682+
JSON.stringify([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]),
682683
) +
683684
'&right=' +
684685
encodeURIComponent(
685-
JSON.stringify([10, 0, 1, 7, 2, 4, 5, 6, 88, 9, 3])
686+
JSON.stringify([10, 0, 1, 7, 2, 4, 5, 6, 88, 9, 3]),
686687
);
687688
break;
688689
case 'query':
@@ -693,26 +694,26 @@
693694
JSON.stringify({
694695
"don't": 'abuse',
695696
with: ['large', 'urls'],
696-
})
697+
}),
697698
) +
698699
'&right=' +
699700
encodeURIComponent(
700701
JSON.stringify({
701702
"don't": 'use',
702703
with: ['>', 2, 'KB urls'],
703-
})
704+
}),
704705
);
705706
break;
706707
case 'urls':
707708
document.location =
708709
'?desc=http%20raw%20file%20urls&left=' +
709710
encodeURIComponent(
710711
'https://rawi.8713187.xyz/benjamine/JsonDiffPatch/' +
711-
'c83e942971c627f61ef874df3cfdd50a95f1c5a2/package.json'
712+
'c83e942971c627f61ef874df3cfdd50a95f1c5a2/package.json',
712713
) +
713714
'&right=' +
714715
encodeURIComponent(
715-
'https://rawi.8713187.xyz/benjamine/JsonDiffPatch/master/package.json'
716+
'https://rawi.8713187.xyz/benjamine/JsonDiffPatch/master/package.json',
716717
);
717718
break;
718719
default:

docs/demo/numeric-plugin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Plugin a new diff filter
3939
},
4040
{
4141
population: 403,
42-
}
42+
},
4343
);
4444
assertSame(delta, [0, 3, NUMERIC_DIFFERENCE]);
4545

@@ -64,7 +64,7 @@ Plugin a new diff filter
6464
{
6565
population: 400,
6666
},
67-
delta
67+
delta,
6868
);
6969
assertSame(right, {
7070
population: 403,

0 commit comments

Comments
 (0)