Skip to content

Commit 7f9ba58

Browse files
authored
Upgrade eslint and ignore no-constructor-return rule for actual constructors (#1974)
* Upgrade eslint and ignore no-constructor-return rule for actual constructors * ignore eslint-next for now
1 parent 8c6ea52 commit 7f9ba58

File tree

14 files changed

+3555
-1729
lines changed

14 files changed

+3555
-1729
lines changed

package-lock.json

Lines changed: 3517 additions & 1720 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,15 @@
9292
"colors": "1.4.0",
9393
"cpy-cli": "3.1.1",
9494
"dtslint": "^4.2.1",
95-
"eslint": "7.29.0",
96-
"eslint-config-airbnb": "18.2.1",
97-
"eslint-config-next": "11.0.0",
98-
"eslint-config-prettier": "8.3.0",
99-
"eslint-plugin-import": "2.23.4",
100-
"eslint-plugin-jsx-a11y": "6.4.1",
101-
"eslint-plugin-prettier": "3.4.0",
102-
"eslint-plugin-react": "7.24.0",
103-
"eslint-plugin-react-hooks": "4.2.0",
95+
"eslint": "^8.56.0",
96+
"eslint-config-airbnb": "^19.0.4",
97+
"eslint-config-next": "^14.0.0",
98+
"eslint-config-prettier": "^9.1.0",
99+
"eslint-plugin-import": "^2.29.1",
100+
"eslint-plugin-jsx-a11y": "^6.8.0",
101+
"eslint-plugin-prettier": "^4.2.1",
102+
"eslint-plugin-react": "^7.33.2",
103+
"eslint-plugin-react-hooks": "^4.6.0",
104104
"flow-bin": "0.160.0",
105105
"jasmine-check": "1.0.0-rc.0",
106106
"jest": "27.2.0",

src/Collection.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,28 @@ import { isAssociative } from './predicates/isAssociative';
66

77
export class Collection {
88
constructor(value) {
9+
// eslint-disable-next-line no-constructor-return
910
return isCollection(value) ? value : Seq(value);
1011
}
1112
}
1213

1314
export class KeyedCollection extends Collection {
1415
constructor(value) {
16+
// eslint-disable-next-line no-constructor-return
1517
return isKeyed(value) ? value : KeyedSeq(value);
1618
}
1719
}
1820

1921
export class IndexedCollection extends Collection {
2022
constructor(value) {
23+
// eslint-disable-next-line no-constructor-return
2124
return isIndexed(value) ? value : IndexedSeq(value);
2225
}
2326
}
2427

2528
export class SetCollection extends Collection {
2629
constructor(value) {
30+
// eslint-disable-next-line no-constructor-return
2731
return isCollection(value) && !isAssociative(value) ? value : SetSeq(value);
2832
}
2933
}

src/List.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,25 @@ export class List extends IndexedCollection {
3232
constructor(value) {
3333
const empty = emptyList();
3434
if (value === undefined || value === null) {
35+
// eslint-disable-next-line no-constructor-return
3536
return empty;
3637
}
3738
if (isList(value)) {
39+
// eslint-disable-next-line no-constructor-return
3840
return value;
3941
}
4042
const iter = IndexedCollection(value);
4143
const size = iter.size;
4244
if (size === 0) {
45+
// eslint-disable-next-line no-constructor-return
4346
return empty;
4447
}
4548
assertNotInfinite(size);
4649
if (size > 0 && size < SIZE) {
50+
// eslint-disable-next-line no-constructor-return
4751
return makeList(0, size, SHIFT, null, new VNode(iter.toArray()));
4852
}
53+
// eslint-disable-next-line no-constructor-return
4954
return empty.withMutations(list => {
5055
list.setSize(size);
5156
iter.forEach((v, i) => list.set(i, v));

src/Map.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export class Map extends KeyedCollection {
3636
// @pragma Construction
3737

3838
constructor(value) {
39+
// eslint-disable-next-line no-constructor-return
3940
return value === undefined || value === null
4041
? emptyMap()
4142
: isMap(value) && !isOrdered(value)

src/OrderedMap.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export class OrderedMap extends Map {
1010
// @pragma Construction
1111

1212
constructor(value) {
13+
// eslint-disable-next-line no-constructor-return
1314
return value === undefined || value === null
1415
? emptyOrderedMap()
1516
: isOrderedMap(value)

src/OrderedSet.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export class OrderedSet extends Set {
1010
// @pragma Construction
1111

1212
constructor(value) {
13+
// eslint-disable-next-line no-constructor-return
1314
return value === undefined || value === null
1415
? emptyOrderedSet()
1516
: isOrderedSet(value)

src/Range.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import deepEqual from './utils/deepEqual';
1313
export class Range extends IndexedSeq {
1414
constructor(start, end, step) {
1515
if (!(this instanceof Range)) {
16+
// eslint-disable-next-line no-constructor-return
1617
return new Range(start, end, step);
1718
}
1819
invariant(step !== 0, 'Cannot step a Range by 0');
@@ -30,6 +31,7 @@ export class Range extends IndexedSeq {
3031
this.size = Math.max(0, Math.ceil((end - start) / step - 1) + 1);
3132
if (this.size === 0) {
3233
if (EMPTY_RANGE) {
34+
// eslint-disable-next-line no-constructor-return
3335
return EMPTY_RANGE;
3436
}
3537
EMPTY_RANGE = this;

src/Record.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ export class Record {
104104
RecordType.displayName = name;
105105
}
106106

107+
// eslint-disable-next-line no-constructor-return
107108
return RecordType;
108109
}
109110

src/Repeat.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@ import deepEqual from './utils/deepEqual';
1212
export class Repeat extends IndexedSeq {
1313
constructor(value, times) {
1414
if (!(this instanceof Repeat)) {
15+
// eslint-disable-next-line no-constructor-return
1516
return new Repeat(value, times);
1617
}
1718
this._value = value;
1819
this.size = times === undefined ? Infinity : Math.max(0, times);
1920
if (this.size === 0) {
2021
if (EMPTY_REPEAT) {
22+
// eslint-disable-next-line no-constructor-return
2123
return EMPTY_REPEAT;
2224
}
2325
EMPTY_REPEAT = this;

0 commit comments

Comments
 (0)