Skip to content

chore: fix JavaScript lint errors #6383 #6431

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

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
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: 3 additions & 0 deletions lib/node_modules/@stdlib/plot/base/ctor/lib/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
// Data line width(s):
o.lineWidth = 2; // px

// FIXME: padding props depend on orientation (may require using `null` to flag)

Check warning on line 68 in lib/node_modules/@stdlib/plot/base/ctor/lib/defaults.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unexpected 'fixme' comment: 'FIXME: padding props depend on...'

// Bottom padding:
o.paddingBottom = 80; // px
Expand Down Expand Up @@ -109,6 +109,9 @@
// Number of x-axis tick marks:
o.xNumTicks = 5;

// x-axis scale:
o.xScale = 'linear';

// x-axis tick format:
o.xTickFormat = null;

Expand Down
41 changes: 38 additions & 3 deletions lib/node_modules/@stdlib/plot/base/ctor/lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@
var getPaddingRight = require( './props/padding-right/get.js' );
var setPaddingTop = require( './props/padding-top/set.js' );
var getPaddingTop = require( './props/padding-top/get.js' );
var setXScale = require( './props/x-scale/set.js' );
var getXScale = require( './props/x-scale/get.js' );
var render = require( './render' );
var stub = require( './render/stub.js' );
var setRenderFormat = require( './props/render-format/set.js' );
Expand Down Expand Up @@ -174,6 +176,7 @@
* @param {(Date|FiniteNumber|null)} [options.xMax=null] - maximum value of x-axis domain
* @param {(Date|FiniteNumber|null)} [options.xMin=null] - minimum value of x-axis domain
* @param {(NonNegativeInteger|null)} [options.xNumTicks=5] - number of x-axis tick marks
* @param {string} [options.xScale='time'] - x-axis scale
* @param {(string|null)} [options.xTickFormat=null] - x-axis tick format
* @param {string} [options.yAxisOrient='left'] - y-axis orientation
* @param {string} [options.yLabel='y'] - y-axis label
Expand Down Expand Up @@ -220,12 +223,17 @@
throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
}
} else if ( nargs === 2 ) {
options = {};
options = {
'x': arguments[ 0 ],
'y': arguments[ 1 ]
};
} else if ( nargs > 2 ) {
if ( !isObject( arguments[ 2 ] ) ) {
if ( !isObject( arguments[2] ) ) {
throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', arguments[2] ) );
}
options = copy( arguments[ 2 ] ); // avoid mutation
options = copy( arguments[2] ); // avoid mutation
options.x = arguments[ 0 ];
options.y = arguments[ 1 ];
}
opts = merge( opts, options );

Expand All @@ -245,7 +253,7 @@
'configurable': false,
'enumerable': false,
'writable': false,
'value': minstd().toString() // TODO: uuid

Check warning on line 256 in lib/node_modules/@stdlib/plot/base/ctor/lib/main.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unexpected 'todo' comment: 'TODO: uuid'
});

// Initialize an internal cache for renderers...
Expand Down Expand Up @@ -755,7 +763,7 @@
* var plot = new Plot();
* var out = plot.render( 'html' );
*/
setReadOnly( Plot.prototype, 'render', render );

Check warning on line 766 in lib/node_modules/@stdlib/plot/base/ctor/lib/main.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

File has too many lines (412). Maximum allowed is 300

/**
* Renders a plot.
Expand Down Expand Up @@ -1023,6 +1031,33 @@
'get': getXRange
});

/**
* Scale function for mapping values to a coordinate along the x-axis. When retrieved, the returned value is a scale function.
*
* @name xScale
* @memberof Plot.prototype
* @type {string}
* @throws {TypeError} must be a string
* @default 'linear'
*
* @example
* var plot = new Plot();
* plot.xScale = 'time';
*
* @example
* var plot = new Plot({
* 'xScale': 'time'
* });
* var scale = plot.xScale;
* // returns <Function>
*/
defineProperty( Plot.prototype, 'xScale', {
'configurable': false,
'enumerable': true,
'set': setXScale,
'get': getXScale
});

/**
* x-axis tick format.
*
Expand Down
54 changes: 54 additions & 0 deletions lib/node_modules/@stdlib/plot/base/ctor/lib/props/x-scale/get.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

// MODULES //

var linear = require( 'd3-scale' ).scaleLinear; // TODO: remove

Check warning on line 23 in lib/node_modules/@stdlib/plot/base/ctor/lib/props/x-scale/get.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unexpected 'todo' comment: 'TODO: remove'
var time = require( 'd3-scale' ).scaleTime; // TODO: remove

Check warning on line 24 in lib/node_modules/@stdlib/plot/base/ctor/lib/props/x-scale/get.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unexpected 'todo' comment: 'TODO: remove'


// MAIN //

/**
* Returns a scale function for mapping values to a coordinate along the x-axis.
*
* @private
* @returns {Function} scale function
*/
function get() {
/* eslint-disable no-invalid-this */
var scale;
if ( this._xScale === 'time' ) {
scale = time()
.domain( this.xDomain )
.range( this.xRange );
} else if ( this._xScale === 'linear' ) {
scale = linear()
.domain( this.xDomain )
.range( this.xRange );
}
// TODO: other scales

Check warning on line 47 in lib/node_modules/@stdlib/plot/base/ctor/lib/props/x-scale/get.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unexpected 'todo' comment: 'TODO: other scales'
return scale;
}


// EXPORTS //

module.exports = get;
63 changes: 63 additions & 0 deletions lib/node_modules/@stdlib/plot/base/ctor/lib/props/x-scale/set.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

// MODULES //

var logger = require( 'debug' );
var isString = require( '@stdlib/assert/is-string' ).isPrimitive;
var format = require( '@stdlib/string/format' );


// VARIABLES //

var debug = logger( 'plot:base:set:x-scale' );


// MAIN //

/**
* Sets the x-axis scale.
*
* @private
* @param {string} scale - axis scale
* @throws {TypeError} must be a string
* @returns {void}
*/
function set( scale ) {
/* eslint-disable no-invalid-this */
if ( !isString( scale ) ) {
throw new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', 'xScale', scale ) );
}
// TODO: test for valid scale

Check warning on line 48 in lib/node_modules/@stdlib/plot/base/ctor/lib/props/x-scale/set.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unexpected 'todo' comment: 'TODO: test for valid scale'

if ( scale !== this._xScale ) {
debug( 'Current value: %s.', this._xScale );

this._xScale = scale;
debug( 'New value: %s.', this._xScale );

this.emit( 'change' );
}
}


// EXPORTS //

module.exports = set;
Loading