Skip to content

Commit f78c18c

Browse files
authored
Update devDependencies to latest versions, fix new lint issues (immutable-js#1346)
1 parent a86ee13 commit f78c18c

38 files changed

+1632
-1544
lines changed

__tests__/ArraySeq.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,38 +26,38 @@ describe('ArraySequence', () => {
2626
});
2727

2828
it('maps', () => {
29-
let i = Seq([1, 2, 3]);
30-
let m = i.map(x => x + x).toArray();
29+
const i = Seq([1, 2, 3]);
30+
const m = i.map(x => x + x).toArray();
3131
expect(m).toEqual([2, 4, 6]);
3232
});
3333

3434
it('reduces', () => {
35-
let i = Seq([1, 2, 3]);
36-
let r = i.reduce<number>((acc, x) => acc + x);
35+
const i = Seq([1, 2, 3]);
36+
const r = i.reduce<number>((acc, x) => acc + x);
3737
expect(r).toEqual(6);
3838
});
3939

4040
it('efficiently chains iteration methods', () => {
41-
let i = Seq('abcdefghijklmnopqrstuvwxyz'.split(''));
41+
const i = Seq('abcdefghijklmnopqrstuvwxyz'.split(''));
4242
function studly(letter, index) {
4343
return index % 2 === 0 ? letter : letter.toUpperCase();
4444
}
45-
let result = i.reverse().take(10).reverse().take(5).map(studly).toArray().join('');
45+
const result = i.reverse().take(10).reverse().take(5).map(studly).toArray().join('');
4646
expect(result).toBe('qRsTu');
4747
});
4848

4949
it('counts from the end of the sequence on negative index', () => {
50-
let i = Seq([1, 2, 3, 4, 5, 6, 7]);
50+
const i = Seq([1, 2, 3, 4, 5, 6, 7]);
5151
expect(i.get(-1)).toBe(7);
5252
expect(i.get(-5)).toBe(3);
5353
expect(i.get(-9)).toBe(undefined);
5454
expect(i.get(-999, 1000)).toBe(1000);
5555
});
5656

5757
it('handles trailing holes', () => {
58-
let a = [1, 2, 3];
58+
const a = [1, 2, 3];
5959
a.length = 10;
60-
let seq = Seq(a);
60+
const seq = Seq(a);
6161
expect(seq.size).toBe(10);
6262
expect(seq.toArray().length).toBe(10);
6363
expect(seq.map(x => x * x).size).toBe(10);
@@ -72,20 +72,20 @@ describe('ArraySequence', () => {
7272
});
7373

7474
it('can be iterated', () => {
75-
let a = [1, 2, 3];
76-
let seq = Seq(a);
77-
let entries = seq.entries();
75+
const a = [1, 2, 3];
76+
const seq = Seq(a);
77+
const entries = seq.entries();
7878
expect(entries.next()).toEqual({ value: [0, 1], done: false });
7979
expect(entries.next()).toEqual({ value: [1, 2], done: false });
8080
expect(entries.next()).toEqual({ value: [2, 3], done: false });
8181
expect(entries.next()).toEqual({ value: undefined, done: true });
8282
});
8383

8484
it('cannot be mutated after calling toArray', () => {
85-
let seq = Seq(['A', 'B', 'C']);
85+
const seq = Seq(['A', 'B', 'C']);
8686

87-
let firstReverse = Seq(seq.toArray().reverse());
88-
let secondReverse = Seq(seq.toArray().reverse());
87+
const firstReverse = Seq(seq.toArray().reverse());
88+
const secondReverse = Seq(seq.toArray().reverse());
8989

9090
expect(firstReverse.get(0)).toEqual('C');
9191
expect(secondReverse.get(0)).toEqual('C');

__tests__/Conversion.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ import {fromJS, is, List, Map, OrderedMap, Record} from "../";
1212
jasmineCheck.install();
1313

1414
// Symbols
15-
declare function Symbol(name: string): Object;
15+
declare function Symbol(name: string): any;
1616

1717
describe('Conversion', () => {
1818
// Note: order of keys based on Map's hashing order
19-
let js = {
19+
const js = {
2020
deepList: [
2121
{
2222
position: "first",
@@ -38,9 +38,9 @@ describe('Conversion', () => {
3838
list: [1, 2, 3],
3939
};
4040

41-
let Point = Record({x: 0, y: 0}, 'Point');
41+
const Point = Record({x: 0, y: 0}, 'Point');
4242

43-
let immutableData = Map({
43+
const immutableData = Map({
4444
deepList: List.of(
4545
Map({
4646
position: "first",
@@ -62,7 +62,7 @@ describe('Conversion', () => {
6262
list: List.of(1, 2, 3),
6363
});
6464

65-
let immutableOrderedData = OrderedMap({
65+
const immutableOrderedData = OrderedMap({
6666
deepList: List.of(
6767
OrderedMap({
6868
position: "first",
@@ -84,7 +84,7 @@ describe('Conversion', () => {
8484
list: List.of(1, 2, 3),
8585
});
8686

87-
let immutableOrderedDataString = 'OrderedMap { ' +
87+
const immutableOrderedDataString = 'OrderedMap { ' +
8888
'"deepList": List [ ' +
8989
'OrderedMap { ' +
9090
'"position": "first"' +
@@ -106,23 +106,23 @@ describe('Conversion', () => {
106106
'"list": List [ 1, 2, 3 ]' +
107107
' }';
108108

109-
let nonStringKeyMap = OrderedMap().set(1, true).set(false, "foo");
110-
let nonStringKeyMapString = 'OrderedMap { 1: true, false: "foo" }';
109+
const nonStringKeyMap = OrderedMap().set(1, true).set(false, "foo");
110+
const nonStringKeyMapString = 'OrderedMap { 1: true, false: "foo" }';
111111

112112
it('Converts deep JS to deep immutable sequences', () => {
113113
expect(fromJS(js)).toEqual(immutableData);
114114
});
115115

116116
it('Throws when provided circular reference', () => {
117-
let o = {a: {b: {c: null as any}}};
117+
const o = {a: {b: {c: null as any}}};
118118
o.a.b.c = o;
119119
expect(() => fromJS(o)).toThrow(
120120
'Cannot convert circular structure to Immutable',
121121
);
122122
});
123123

124124
it('Converts deep JSON with custom conversion', () => {
125-
let seq = fromJS(js, function (key, sequence) {
125+
const seq = fromJS(js, function(key, sequence) {
126126
if (key === 'point') {
127127
return new Point(sequence);
128128
}
@@ -133,8 +133,8 @@ describe('Conversion', () => {
133133
});
134134

135135
it('Converts deep JSON with custom conversion including keypath if requested', () => {
136-
let paths: Array<any> = [];
137-
let seq1 = fromJS(js, function (key, sequence, keypath) {
136+
const paths: Array<any> = [];
137+
const seq1 = fromJS(js, function(key, sequence, keypath) {
138138
expect(arguments.length).toBe(3);
139139
paths.push(keypath);
140140
return Array.isArray(this[key]) ? sequence.toList() : sequence.toOrderedMap();
@@ -150,7 +150,7 @@ describe('Conversion', () => {
150150
['point'],
151151
['list'],
152152
]);
153-
let seq2 = fromJS(js, function (key, sequence) {
153+
const seq2 = fromJS(js, function(key, sequence) {
154154
expect(arguments[2]).toBe(undefined);
155155
});
156156

@@ -161,13 +161,13 @@ describe('Conversion', () => {
161161
});
162162

163163
it('Converts deep sequences to JS', () => {
164-
let js2 = immutableData.toJS();
164+
const js2 = immutableData.toJS();
165165
expect(is(js2, js)).toBe(false); // raw JS is not immutable.
166166
expect(js2).toEqual(js); // but should be deep equal.
167167
});
168168

169169
it('Converts shallowly to JS', () => {
170-
let js2 = immutableData.toJSON();
170+
const js2 = immutableData.toJSON();
171171
expect(js2).not.toEqual(js);
172172
expect(js2.deepList).toBe(immutableData.get('deepList'));
173173
});
@@ -177,8 +177,8 @@ describe('Conversion', () => {
177177
});
178178

179179
it('JSON.stringify() respects toJSON methods on values', () => {
180-
let Model = Record({});
181-
Model.prototype.toJSON = function () {
180+
const Model = Record({});
181+
Model.prototype.toJSON = function() {
182182
return 'model';
183183
};
184184
expect(
@@ -197,7 +197,7 @@ describe('Conversion', () => {
197197
});
198198

199199
check.it('toJS isomorphic value', {maxSize: 30}, [gen.JSONValue], v => {
200-
let imm = fromJS(v);
200+
const imm = fromJS(v);
201201
expect(imm && imm.toJS ? imm.toJS() : imm).toEqual(v);
202202
});
203203

@@ -208,8 +208,8 @@ describe('Conversion', () => {
208208
});
209209

210210
it('Converts an immutable value of an entry correctly', () => {
211-
let arr = [{key: "a"}];
212-
let result = fromJS(arr).entrySeq().toJS();
211+
const arr = [{key: "a"}];
212+
const result = fromJS(arr).entrySeq().toJS();
213213
expect(result).toEqual([[0, {key: "a"}]]);
214214
});
215215

__tests__/Equality.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@ import { is, List, Map, Seq, Set } from '../';
1515
describe('Equality', () => {
1616

1717
function expectIs(left, right) {
18-
let comparison = is(left, right);
18+
const comparison = is(left, right);
1919
expect(comparison).toBe(true);
20-
let commutative = is(right, left);
20+
const commutative = is(right, left);
2121
expect(commutative).toBe(true);
2222
}
2323

2424
function expectIsNot(left, right) {
25-
let comparison = is(left, right);
25+
const comparison = is(left, right);
2626
expect(comparison).toBe(false);
27-
let commutative = is(right, left);
27+
const commutative = is(right, left);
2828
expect(commutative).toBe(false);
2929
}
3030

@@ -47,29 +47,29 @@ describe('Equality', () => {
4747
expectIs(0, -0);
4848
expectIs(NaN, 0 / 0);
4949

50-
let str = "hello";
50+
const str = "hello";
5151
expectIs(str, str);
5252
expectIs(str, "hello");
5353
expectIsNot("hello", "HELLO");
5454
expectIsNot("hello", "goodbye");
5555

56-
let array = [1, 2, 3];
56+
const array = [1, 2, 3];
5757
expectIs(array, array);
5858
expectIsNot(array, [1, 2, 3]);
5959

60-
let object = {key: 'value'};
60+
const object = {key: 'value'};
6161
expectIs(object, object);
6262
expectIsNot(object, {key: 'value'});
6363
});
6464

6565
it('dereferences things', () => {
66-
let ptrA = {foo: 1}, ptrB = {foo: 2};
66+
const ptrA = {foo: 1}, ptrB = {foo: 2};
6767
expectIsNot(ptrA, ptrB);
6868
ptrA.valueOf = ptrB.valueOf = function() {
6969
return 5;
7070
};
7171
expectIs(ptrA, ptrB);
72-
let object = {key: 'value'};
72+
const object = {key: 'value'};
7373
ptrA.valueOf = ptrB.valueOf = function() {
7474
return object;
7575
};
@@ -92,8 +92,8 @@ describe('Equality', () => {
9292
});
9393

9494
it('compares sequences', () => {
95-
let arraySeq = Seq([1, 2, 3]);
96-
let arraySeq2 = Seq([1, 2, 3]);
95+
const arraySeq = Seq([1, 2, 3]);
96+
const arraySeq2 = Seq([1, 2, 3]);
9797
expectIs(arraySeq, arraySeq);
9898
expectIs(arraySeq, Seq([1, 2, 3]));
9999
expectIs(arraySeq2, arraySeq2);
@@ -106,23 +106,23 @@ describe('Equality', () => {
106106
});
107107

108108
it('compares lists', () => {
109-
let list = List([1, 2, 3]);
109+
const list = List([1, 2, 3]);
110110
expectIs(list, list);
111111
expectIsNot(list, [1, 2, 3]);
112112

113113
expectIs(list, Seq([1, 2, 3]));
114114
expectIs(list, List([1, 2, 3]));
115115

116-
let listLonger = list.push(4);
116+
const listLonger = list.push(4);
117117
expectIsNot(list, listLonger);
118-
let listShorter = listLonger.pop();
118+
const listShorter = listLonger.pop();
119119
expect(list === listShorter).toBe(false);
120120
expectIs(list, listShorter);
121121
});
122122

123-
let genSimpleVal = gen.returnOneOf(['A', 1]);
123+
const genSimpleVal = gen.returnOneOf(['A', 1]);
124124

125-
let genVal = gen.oneOf([
125+
const genVal = gen.oneOf([
126126
gen.map(List, gen.array(genSimpleVal, 0, 4)),
127127
gen.map(Set, gen.array(genSimpleVal, 0, 4)),
128128
gen.map(Map, gen.array(gen.array(genSimpleVal, 2), 0, 4)),

__tests__/IndexedSeq.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ import { Seq } from '../';
1515
describe('IndexedSequence', () => {
1616

1717
it('maintains skipped offset', () => {
18-
let seq = Seq(['A', 'B', 'C', 'D', 'E']);
18+
const seq = Seq(['A', 'B', 'C', 'D', 'E']);
1919

2020
// This is what we expect for IndexedSequences
21-
let operated = seq.skip(1);
21+
const operated = seq.skip(1);
2222
expect(operated.entrySeq().toArray()).toEqual([
2323
[0, 'B'],
2424
[1, 'C'],
@@ -30,10 +30,10 @@ describe('IndexedSequence', () => {
3030
});
3131

3232
it('reverses correctly', () => {
33-
let seq = Seq(['A', 'B', 'C', 'D', 'E']);
33+
const seq = Seq(['A', 'B', 'C', 'D', 'E']);
3434

3535
// This is what we expect for IndexedSequences
36-
let operated = seq.reverse();
36+
const operated = seq.reverse();
3737
expect(operated.get(0)).toEqual('E');
3838
expect(operated.get(1)).toEqual('D');
3939
expect(operated.get(4)).toEqual('A');
@@ -43,15 +43,15 @@ describe('IndexedSequence', () => {
4343
});
4444

4545
it('negative indexes correctly', () => {
46-
let seq = Seq(['A', 'B', 'C', 'D', 'E']);
46+
const seq = Seq(['A', 'B', 'C', 'D', 'E']);
4747

4848
expect(seq.first()).toEqual('A');
4949
expect(seq.last()).toEqual('E');
5050
expect(seq.get(-0)).toEqual('A');
5151
expect(seq.get(2)).toEqual('C');
5252
expect(seq.get(-2)).toEqual('D');
5353

54-
let indexes = seq.keySeq();
54+
const indexes = seq.keySeq();
5555
expect(indexes.first()).toEqual(0);
5656
expect(indexes.last()).toEqual(4);
5757
expect(indexes.get(-0)).toEqual(0);

0 commit comments

Comments
 (0)