Skip to content

New lint rule to disallow named function expressions #3792

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 5 commits into from
Apr 22, 2019
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
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
"no-loop-func": [2],
"no-console": [0],
"no-unused-labels": [2],
"no-useless-escape": [0]
"no-useless-escape": [0],
"func-name-matching": ["error", "always"]
}
}
2 changes: 1 addition & 1 deletion src/components/dragelement/unhover.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ unhover.wrapped = function(gd, evt, subplot) {


// remove hover effects on mouse out, and emit unhover event
unhover.raw = function unhoverRaw(gd, evt) {
unhover.raw = function raw(gd, evt) {
var fullLayout = gd._fullLayout;
var oldhoverdata = gd._hoverdata;

Expand Down
2 changes: 1 addition & 1 deletion src/components/fx/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ exports.getSubplot = function getSubplot(trace) {

// is trace in given list of subplots?
// does handle splom case
exports.isTraceInSubplots = function isTraceInSubplot(trace, subplots) {
exports.isTraceInSubplots = function isTraceInSubplots(trace, subplots) {
if(trace.type === 'splom') {
var xaxes = trace.xaxes || [];
var yaxes = trace.yaxes || [];
Expand Down
6 changes: 3 additions & 3 deletions src/components/updatemenus/scrollbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ ScrollBox.prototype.disable = function disable() {
*
* @method
*/
ScrollBox.prototype._onBoxDrag = function onBarDrag() {
ScrollBox.prototype._onBoxDrag = function _onBoxDrag() {
var translateX = this.translateX;
var translateY = this.translateY;

Expand All @@ -367,7 +367,7 @@ ScrollBox.prototype._onBoxDrag = function onBarDrag() {
*
* @method
*/
ScrollBox.prototype._onBoxWheel = function onBarWheel() {
ScrollBox.prototype._onBoxWheel = function _onBoxWheel() {
var translateX = this.translateX;
var translateY = this.translateY;

Expand All @@ -387,7 +387,7 @@ ScrollBox.prototype._onBoxWheel = function onBarWheel() {
*
* @method
*/
ScrollBox.prototype._onBarDrag = function onBarDrag() {
ScrollBox.prototype._onBarDrag = function _onBarDrag() {
var translateX = this.translateX;
var translateY = this.translateY;

Expand Down
2 changes: 1 addition & 1 deletion src/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ lib.pushUnique = require('./push_unique');

lib.cleanNumber = require('./clean_number');

lib.ensureNumber = function num(v) {
lib.ensureNumber = function ensureNumber(v) {
if(!isNumeric(v)) return BADNUM;
v = Number(v);
if(v < -FP_SAFE || v > FP_SAFE) return BADNUM;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/polygon.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ polygon.tester = function tester(ptsIn) {
* before the line counts as bent
* @returns boolean: true means this segment is bent, false means straight
*/
var isBent = polygon.isSegmentBent = function isBent(pts, start, end, tolerance) {
polygon.isSegmentBent = function isSegmentBent(pts, start, end, tolerance) {
var startPt = pts[start];
var segment = [pts[end][0] - startPt[0], pts[end][1] - startPt[1]];
var segmentSquared = dot(segment, segment);
Expand Down Expand Up @@ -226,7 +226,7 @@ polygon.filter = function filter(pts, tolerance) {
ptsFiltered.splice(doneFilteredIndex + 1);

for(var i = iLast + 1; i < pts.length; i++) {
if(i === pts.length - 1 || isBent(pts, iLast, i + 1, tolerance)) {
if(i === pts.length - 1 || polygon.isSegmentBent(pts, iLast, i + 1, tolerance)) {
ptsFiltered.push(pts[i]);
if(ptsFiltered.length < prevFilterLen - 2) {
doneRawIndex = i;
Expand Down
4 changes: 2 additions & 2 deletions src/plots/cartesian/constraints.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ function updateConstraintGroups(constraintGroups, thisGroup, thisID, scaleanchor
thisGroup[scaleanchor] = 1;
}

exports.enforce = function enforceAxisConstraints(gd) {
exports.enforce = function enforce(gd) {
var fullLayout = gd._fullLayout;
var constraintGroups = fullLayout._axisConstraintGroups || [];

Expand Down Expand Up @@ -346,7 +346,7 @@ exports.enforce = function enforceAxisConstraints(gd) {

// For use before autoranging, check if this axis was previously constrained
// by domain but no longer is
exports.clean = function cleanConstraints(gd, ax) {
exports.clean = function clean(gd, ax) {
if(ax._inputDomain) {
var isConstrained = false;
var axId = ax._id;
Expand Down
2 changes: 1 addition & 1 deletion src/plots/gl2d/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ exports.baseLayoutAttrOverrides = overrideAll({
// dragmode: fxAttrs.dragmode
}, 'plot', 'nested');

exports.plot = function plotGl2d(gd) {
exports.plot = function plot(gd) {
var fullLayout = gd._fullLayout;
var fullData = gd._fullData;
var subplotIds = fullLayout._subplots.gl2d;
Expand Down
2 changes: 1 addition & 1 deletion src/plots/gl3d/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ exports.baseLayoutAttrOverrides = overrideAll({

exports.supplyLayoutDefaults = require('./layout/defaults');

exports.plot = function plotGl3d(gd) {
exports.plot = function plot(gd) {
var fullLayout = gd._fullLayout;
var fullData = gd._fullData;
var sceneIds = fullLayout._subplots[GL3D];
Expand Down
2 changes: 1 addition & 1 deletion src/plots/mapbox/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ exports.layoutAttributes = require('./layout_attributes');

exports.supplyLayoutDefaults = require('./layout_defaults');

exports.plot = function plotMapbox(gd) {
exports.plot = function plot(gd) {
var fullLayout = gd._fullLayout;
var calcData = gd.calcdata;
var mapboxIds = fullLayout._subplots[MAPBOX];
Expand Down
2 changes: 1 addition & 1 deletion src/plots/ternary/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ exports.layoutAttributes = require('./layout_attributes');

exports.supplyLayoutDefaults = require('./layout_defaults');

exports.plot = function plotTernary(gd) {
exports.plot = function plot(gd) {
var fullLayout = gd._fullLayout;
var calcData = gd.calcdata;
var ternaryIds = fullLayout._subplots[TERNARY];
Expand Down
2 changes: 1 addition & 1 deletion src/traces/bar/sieve.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Sieve.prototype.put = function put(position, value) {
* (required if this.sepNegVal is true)
* @returns {number} Current bin value
*/
Sieve.prototype.get = function put(position, value) {
Sieve.prototype.get = function get(position, value) {
var label = this.getLabel(position, value);
return this.bins[label] || 0;
};
Expand Down
4 changes: 2 additions & 2 deletions test/jasmine/assets/unpolyfill.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
configurable: true,
enumerable: true,
writable: true,
value: function remove() {
value: function() {
throw Error([
'test/jasmine/assets/unpolyfill.js error: calling ChildNode.remove()',
'which is not available in IE.'
Expand All @@ -23,7 +23,7 @@
configurable: true,
enumerable: true,
writable: true,
value: function remove() {
value: function() {
throw Error([
'test/jasmine/assets/unpolyfill.js error: calling ChildNode.prepend()',
'which is not available in IE.'
Expand Down