mirror of
https://github.com/nasa/openmct.git
synced 2025-06-14 21:28:12 +00:00
ESLint rules: array-callback-return, no-invalid-this, func-style (#3151)
* satisfied array-callback-return rule * satisfying no-invalid-this rule * fixed invalid-this issues * changed isNotEqual to arrow function * added rule func-style * added return false to satisfy array-callback-return rule Co-authored-by: Joel McKinnon <jmckinnon@apple.com> Co-authored-by: Joshi <simplyrender@gmail.com> Co-authored-by: Andrew Henry <akhenry@gmail.com>
This commit is contained in:
@ -38,11 +38,11 @@ define([
|
||||
}
|
||||
});
|
||||
|
||||
this.on('change:frozen', function (frozen, oldValue, model) {
|
||||
this.on('change:frozen', ((frozen, oldValue, model) => {
|
||||
if (!frozen) {
|
||||
model.set('range', this.get('range'));
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
if (this.get('range')) {
|
||||
this.set('range', this.get('range'));
|
||||
|
@ -60,14 +60,14 @@ define([
|
||||
},
|
||||
listenToSeriesCollection: function (seriesCollection) {
|
||||
this.seriesCollection = seriesCollection;
|
||||
this.listenTo(this.seriesCollection, 'add', function (series) {
|
||||
this.listenTo(this.seriesCollection, 'add', (series => {
|
||||
this.trackSeries(series);
|
||||
this.updateFromSeries(this.seriesCollection);
|
||||
}, this);
|
||||
this.listenTo(this.seriesCollection, 'remove', function (series) {
|
||||
}), this);
|
||||
this.listenTo(this.seriesCollection, 'remove', (series => {
|
||||
this.untrackSeries(series);
|
||||
this.updateFromSeries(this.seriesCollection);
|
||||
}, this);
|
||||
}), this);
|
||||
this.seriesCollection.forEach(this.trackSeries, this);
|
||||
this.updateFromSeries(this.seriesCollection);
|
||||
},
|
||||
@ -144,16 +144,16 @@ define([
|
||||
}, this);
|
||||
},
|
||||
trackSeries: function (series) {
|
||||
this.listenTo(series, 'change:stats', function (seriesStats) {
|
||||
this.listenTo(series, 'change:stats', seriesStats => {
|
||||
if (!seriesStats) {
|
||||
this.resetStats();
|
||||
} else {
|
||||
this.updateStats(seriesStats);
|
||||
}
|
||||
}, this);
|
||||
this.listenTo(series, 'change:yKey', function () {
|
||||
});
|
||||
this.listenTo(series, 'change:yKey', () => {
|
||||
this.updateFromSeries(this.seriesCollection);
|
||||
}, this);
|
||||
});
|
||||
},
|
||||
untrackSeries: function (series) {
|
||||
this.stopListening(series);
|
||||
|
@ -122,6 +122,8 @@ define([
|
||||
}
|
||||
|
||||
var formPath = 'form.' + formProp;
|
||||
let self = this;
|
||||
|
||||
if (!coerce) {
|
||||
coerce = function (v) {
|
||||
return v;
|
||||
@ -142,11 +144,11 @@ define([
|
||||
}
|
||||
|
||||
this.listenTo(this.model, 'change:' + prop, function (newVal, oldVal) {
|
||||
if (!_.isEqual(coerce(_.get(this.$scope, formPath)), coerce(newVal))) {
|
||||
_.set(this.$scope, formPath, coerce(newVal));
|
||||
if (!_.isEqual(coerce(_.get(self.$scope, formPath)), coerce(newVal))) {
|
||||
_.set(self.$scope, formPath, coerce(newVal));
|
||||
}
|
||||
}, this);
|
||||
this.model.listenTo(this.$scope, 'change:' + formPath, function (newVal, oldVal) {
|
||||
});
|
||||
this.model.listenTo(this.$scope, 'change:' + formPath, (newVal, oldVal) => {
|
||||
var validationResult = validate(newVal, this.model);
|
||||
if (validationResult === true) {
|
||||
delete this.$scope.validation[formProp];
|
||||
@ -170,7 +172,7 @@ define([
|
||||
);
|
||||
}
|
||||
}
|
||||
}, this);
|
||||
});
|
||||
_.set(this.$scope, formPath, coerce(this.model.get(prop)));
|
||||
};
|
||||
|
||||
|
@ -28,7 +28,7 @@ define([
|
||||
) {
|
||||
|
||||
function extend(props) {
|
||||
/*jshint validthis: true*/
|
||||
// eslint-disable-next-line no-invalid-this
|
||||
var parent = this,
|
||||
child,
|
||||
Surrogate;
|
||||
@ -37,6 +37,7 @@ define([
|
||||
child = props.constructor;
|
||||
} else {
|
||||
child = function () {
|
||||
// eslint-disable-next-line no-invalid-this
|
||||
return parent.apply(this, arguments);
|
||||
};
|
||||
}
|
||||
|
@ -220,21 +220,18 @@ define([
|
||||
|
||||
if (!point) {
|
||||
this.$scope.highlights = [];
|
||||
this.$scope.series.map(function (series) {
|
||||
delete series.closest;
|
||||
});
|
||||
this.$scope.series.forEach(series => delete series.closest);
|
||||
} else {
|
||||
this.$scope.highlights = this.$scope.series
|
||||
.filter(function (series) {
|
||||
return series.data.length > 0;
|
||||
}).map(function (series) {
|
||||
.filter(series => series.data.length > 0)
|
||||
.map(series => {
|
||||
series.closest = series.nearestPoint(point);
|
||||
|
||||
return {
|
||||
series: series,
|
||||
point: series.closest
|
||||
};
|
||||
}, this);
|
||||
});
|
||||
}
|
||||
|
||||
this.$scope.$digest();
|
||||
|
@ -134,11 +134,11 @@ define([
|
||||
};
|
||||
|
||||
PlotController.prototype.addSeries = function (series) {
|
||||
this.listenTo(series, 'change:yKey', function () {
|
||||
this.listenTo(series, 'change:yKey', () => {
|
||||
this.loadSeriesData(series);
|
||||
}, this);
|
||||
|
||||
this.listenTo(series, 'change:interpolate', function () {
|
||||
this.listenTo(series, 'change:interpolate', () => {
|
||||
this.loadSeriesData(series);
|
||||
}, this);
|
||||
|
||||
@ -184,18 +184,18 @@ define([
|
||||
};
|
||||
|
||||
PlotController.prototype.loadMoreData = function (range, purge) {
|
||||
this.config.series.map(function (plotSeries) {
|
||||
this.config.series.forEach(plotSeries => {
|
||||
this.startLoading();
|
||||
plotSeries.load({
|
||||
size: this.$element[0].offsetWidth,
|
||||
start: range.min,
|
||||
end: range.max
|
||||
})
|
||||
.then(this.stopLoading.bind(this));
|
||||
.then(this.stopLoading());
|
||||
if (purge) {
|
||||
plotSeries.purgeRecordsOutsideRange(range);
|
||||
}
|
||||
}, this);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user