Skip to content

Call super()" before this in constructors #2077

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,11 @@ export default tseslint.config(
{
rules: {
eqeqeq: 'error',
'constructor-super': 'off',
'no-constructor-return': 'error',
'no-else-return': 'error',
'no-lonely-if': 'error',
'no-object-constructor': 'error',
'no-prototype-builtins': 'off',
'no-this-before-super': 'off',
'no-useless-concat': 'error',
'no-var': 'error',
'operator-assignment': 'error',
Expand Down
5 changes: 4 additions & 1 deletion src/Iterator.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ export const ITERATOR_SYMBOL = REAL_ITERATOR_SYMBOL || FAUX_ITERATOR_SYMBOL;

export class Iterator {
constructor(next) {
this.next = next;
if (next) {
// Map extends Iterator and has a `next` method, do not erase it in that case. We could have checked `if (next && !this.next)` too.
this.next = next;
}
}

toString() {
Expand Down
2 changes: 2 additions & 0 deletions src/Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,8 @@ ValueNode.prototype.iterate = function (fn, reverse) {

class MapIterator extends Iterator {
constructor(map, type, reverse) {
super();

this._type = type;
this._reverse = reverse;
this._stack = map._root && mapIteratorFrame(map._root);
Expand Down
10 changes: 10 additions & 0 deletions src/Operations.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ import { OrderedMap } from './OrderedMap';

export class ToKeyedSequence extends KeyedSeqImpl {
constructor(indexed, useKeys) {
super();

this._iter = indexed;
this._useKeys = useKeys;
this.size = indexed.size;
Expand Down Expand Up @@ -89,6 +91,8 @@ ToKeyedSequence.prototype[IS_ORDERED_SYMBOL] = true;

export class ToIndexedSequence extends IndexedSeqImpl {
constructor(iter) {
super();

this._iter = iter;
this.size = iter.size;
}
Expand Down Expand Up @@ -128,6 +132,8 @@ export class ToIndexedSequence extends IndexedSeqImpl {

export class ToSetSequence extends SetSeqImpl {
constructor(iter) {
super();

this._iter = iter;
this.size = iter.size;
}
Expand All @@ -153,6 +159,8 @@ export class ToSetSequence extends SetSeqImpl {

export class FromEntriesSequence extends KeyedSeqImpl {
constructor(entries) {
super();

this._iter = entries;
this.size = entries.size;
}
Expand Down Expand Up @@ -597,6 +605,8 @@ export function skipWhileFactory(collection, predicate, context, useKeys) {

class ConcatSeq extends SeqImpl {
constructor(iterables) {
super();

this._wrappedIterables = iterables.flatMap((iterable) => {
if (iterable._wrappedIterables) {
return iterable._wrappedIterables;
Expand Down
2 changes: 2 additions & 0 deletions src/Range.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export const Range = (start, end, step = 1) => {
};
export class RangeImpl extends IndexedSeqImpl {
constructor(start, end, step, size) {
super();

this._start = start;
this._end = end;
this._step = step;
Expand Down
2 changes: 2 additions & 0 deletions src/Repeat.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export const Repeat = (value, times) => {

export class RepeatImpl extends IndexedSeqImpl {
constructor(value, size) {
super();

this._value = value;
this.size = size;
}
Expand Down