Skip to content

Dm 7508 eslint rules #166

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 4 commits into from
Sep 8, 2016
Merged
Show file tree
Hide file tree
Changes from 2 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
32 changes: 28 additions & 4 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
{
"plugins": [
"react"
"react",
"jsdoc"

],
"settings": {
"jsdoc": {
"tagNamePreference": {
"param": "param",
"returns": "returns"
}
}
},

"env": {
"es6": true,
"browser": true
},
"parserOptions": {
"ecmaVersion": 7,
"ecmaFeatures": {
"ecmaVersion": 7,
"ecmaFeatures": {
"arrowFunctions" : true,
"binaryLiterals" : true,
"blockBindings": true,
Expand Down Expand Up @@ -64,7 +75,20 @@
"react/wrap-multilines": 1,
"semi": [2, "always"],
"space-infix-ops": 0,
"quotes": [2, "single", "avoid-escape"]
"quotes": [2, "single", "avoid-escape"],
"eqeqeq": 1,
//jsdoc rules
"jsdoc/check-param-names": 1,
"jsdoc/check-tag-names": 1,
"jsdoc/check-types": 1,
"jsdoc/newline-after-description": 1,
"jsdoc/require-description-complete-sentence": 1,
"jsdoc/require-hyphen-before-param-description": 1,
"jsdoc/require-param": 2,
"jsdoc/require-param-description": 1,
"jsdoc/require-param-type": 1,
"jsdoc/require-returns-description": 1,
"jsdoc/require-returns-type": 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might want to relax the rules a bit, otherwise we'll have too many warnings, and people will not pay attention to real problems.

I suggest the following defaults:
"jsdoc/check-param-names": 2,
"jsdoc/check-tag-names": 1,
"jsdoc/check-types": 1,
"jsdoc/newline-after-description": 0,
"jsdoc/require-description-complete-sentence": 0,
"jsdoc/require-hyphen-before-param-description": 0,
"jsdoc/require-param": 2,
"jsdoc/require-param-description": 0,
"jsdoc/require-param-type": 0,
"jsdoc/require-returns-description": 0,
"jsdoc/require-returns-type": 1

We would still want to preserve those rules in the file, so that people who work on API documentation can turn them on to make docs consistent.

Reference link: https://github.com/gajus/eslint-plugin-jsdoc


// "react/display-name": 1,
// "react/forbid-prop-types": 1,
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
"webpack": "^1.13.2",
"eslint-plugin-jsx-a11y": "^0.6.2",
"jsdoc-jsx": "^0.1.0",
"ink-docstrap" :"^1.2.1"
"ink-docstrap" :"^1.2.1",
"eslint-plugin-jsdoc":"^2.3.1"
}
}
84 changes: 42 additions & 42 deletions src/firefly/js/visualize/CsysConverter.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ const MAX_CACHE_ENTRIES = 38000; // set to never allows the cache array over 480
export class CysConverter {

/**
*
* @param {object} plot
*/
constructor(plot) {
Expand All @@ -57,8 +56,8 @@ export class CysConverter {

/**
*
* @param wp world point
* @param imp Image Point
* @param {WorldPt} wp world point
* @param {ImagePt} imp Image Point
*/
putInConversionCache(wp, imp) {
if (SimpleMemCache.size(this.plotImageId)<MAX_CACHE_ENTRIES) {
Expand All @@ -72,8 +71,8 @@ export class CysConverter {

/**
* Determine if a world point is in data Area of the plot and is not null
* @param iwPt the point to test.
* @return {boolean} true if it is in the data boundaries, false if not.
* @param {WorldPt} iwPt the point to test.
* @returns {boolean} true if it is in the data boundaries, false if not.
*/
imagePointInData(iwPt) {
var retval= false;
Expand All @@ -89,8 +88,8 @@ export class CysConverter {

/**
* Determine if a image point is in the plot boundaries and is not null.
* @param pt the point to test.
* @return {boolean} true if it is in the boundaries, false if not.
* @param {Point} pt the point to test.
* @returns {boolean} true if it is in the boundaries, false if not.
*/
pointInData(pt) {
if (!isValidPoint(pt)) return false;
Expand All @@ -101,6 +100,7 @@ export class CysConverter {
/**
* This method returns false it the point is definitely not in plot. It returns true if the point might be in the plot.
* Used for tossing out points that we know that are not in plot without having to do all the math. It is much faster.
* @param {WorldPt} wp
* @return {boolean} true in we guess it might be in the bounds, false if we know that it is not in the bounds
*/
pointInPlotRoughGuess(wp) {
Expand All @@ -117,8 +117,8 @@ export class CysConverter {

/**
* Determine if a image point is in the plot boundaries and is not null.
* @param ipt the point to test.
* @return boolean true if it is in the boundaries, false if not.
* @param {ImagePt} ipt the point to test.
* @returns boolean true if it is in the boundaries, false if not.
*/
imageWorkSpacePtInPlot(ipt) {
if (!ipt) return false;
Expand All @@ -128,7 +128,7 @@ export class CysConverter {

/**
* Determine if a image point is in the plot boundaries and is not null
* @param pt the point to test.
* @param {Point} pt the point to test.
* @return {boolean} true if it is in the boundaries, false if not.
*/
pointInPlot(pt) {
Expand All @@ -149,9 +149,9 @@ export class CysConverter {
}

/**
* test to see if the input is in the view port and is not null
* @param vpt
* @return {boolean}
* @desc Test to see if the input is in the view port and is not null.
* @param {Object} vpt
* @returns {boolean}
*/
viewPortPointInViewPort(vpt) {
if (!vpt || !vpt.type || vpt.type!==Point.VP_PT) return false;
Expand All @@ -162,9 +162,9 @@ export class CysConverter {


/**
* Determine if a point is in the view port boundaries and is not null.
* @param pt the point to test.
* @return {boolean} true if it is in the boundaries, false if not.
* @desc Determine if a point is in the view port boundaries and is not null.
* @param {Point} pt the point to test.
* @returns {boolean} true if it is in the boundaries, false if not.
*/
pointInViewPort(pt) {
if (!isValidPoint(pt)) return false;
Expand Down Expand Up @@ -219,8 +219,8 @@ export class CysConverter {
}

/**
* return a ImageWorkspacePt from the screen point
* @param screenPt
* @description Return a ImageWorkspacePt from the screen point.
* @param {ScreenPt} screenPt
* @param {number} [altZoomLevel]
*/
makeIWPtFromSPt(screenPt, altZoomLevel) {
Expand All @@ -235,7 +235,6 @@ export class CysConverter {


/**
* Return the ImagePt coordinates given Pt
* @param {object} pt the point to translate
* @return ImagePt the image coordinates
*/
Expand Down Expand Up @@ -266,7 +265,8 @@ export class CysConverter {

/**
* return a ImagePoint from a ImageWorkspace point
* @param iwPt
* @param {ImageWpt} iwPt
* returns ImagePt
*/
static makeIPtFromIWPt(iwPt) {
if (!iwPt) return null;
Expand All @@ -275,9 +275,9 @@ export class CysConverter {


/**
* Return the image coordinates given a WorldPt class
* @param wpt the class containing the point in sky coordinates
* @return ImagePt the translated coordinates
* @desc Return the image coordinates given a WorldPt class.
* @param {WorldPt} wpt the class containing the point in sky coordinates
* @returns ImagePt the translated coordinates
*/
getImageCoordsFromWorldPt(wpt) {
if (!wpt) return null;
Expand Down Expand Up @@ -308,11 +308,11 @@ export class CysConverter {


/**
* Return the ViewPortCoords coordinates given for Pt
* @param pt the point to translate
* @desc Return the ViewPortCoords coordinates given for Pt.
* @param {Point} pt the point to translate
* @param {number} [altZoomLevel], only use this parameter it you want to compute the point for a zoom level that
* if different than what the plotted zoom level
* @return WorldPt the world coordinates
* @returns WorldPt the world coordinates
*/
getViewPortCoords(pt, altZoomLevel) {
if (!isValidPoint(pt)) return null;
Expand Down Expand Up @@ -341,8 +341,8 @@ export class CysConverter {


/**
* return a ViewPort Point from a ScreenPt
* @param pt
* @desc Return a ViewPort Point from a ScreenPt.
* @param {PointPt} pt
*/
makeVPtFromSPt(pt) {
if (!pt) return null;
Expand All @@ -352,9 +352,9 @@ export class CysConverter {


/**
* An optimized conversion of WorldPt to viewport point.
* @param {object} wpt a world pt
* @param {object} retPt mutable returned ViewPort Point, this object will be written to
* @desc An optimized conversion of WorldPt to viewport point.
* @param {Object} wpt a world pt
* @param {Object} retPt mutable returned ViewPort Point, this object will be written to
* @return {boolean} success or failure
*/
getViewPortCoordsOptimize(wpt, retPt) {
Expand Down Expand Up @@ -425,7 +425,7 @@ export class CysConverter {

/**
* Return the screen coordinates given Pt
* @param pt the point to translate
* @param {PointPt} pt the point to translate
* @param {number} [altZoomLevel], only use this parameter it you want to compute the point for a zoom level that
* if different than what the plotted zoom level
* @return ScreenPt the screen coordinates
Expand Down Expand Up @@ -466,7 +466,7 @@ export class CysConverter {

/**
*
* @param {object} iwpt ImageWorkspacePt
* @param {Object} iwpt ImageWorkspacePt
* @param {number} [altZoomLevel]
*/
makeSPtFromIWPt(iwpt, altZoomLevel) {
Expand All @@ -482,13 +482,11 @@ export class CysConverter {
//========================================================================================



/**
* Return the sky coordinates given a image x (fsamp) and y (fline)
* package in a ImageWorkSpacePt class
* @param pt the point to convert
* @param outputCoordSys (optional) The coordinate system to return, default to coordinate system of image
* @return WorldPt the translated coordinates
* @desc Return the sky coordinates given a image x (fsamp) and y (fline)
* @param {PointPt} pt the point to convert
* @param {CoordinateSys} outputCoordSys (optional) The coordinate system to return, default to coordinate system of image
* @returns WorldPt the translated coordinates
*/
getWorldCoords(pt, outputCoordSys) {
if (!isValidPoint(pt)) return null;
Expand Down Expand Up @@ -560,8 +558,8 @@ export class CysConverter {

/**
*
* @param {object} plot - the image
* @return {CysConverter}
* @param {Object} plot - the image
* @returns {CysConverter}
*/
static make(plot) {
return plot ? new CysConverter(plot) : null;
Expand All @@ -572,9 +570,11 @@ export class CysConverter {

/**
*
* @param pt
* @param {PointPt} pt
* @return {*}
* @public
* @memberof firefly.util.image.CCUtil
*
*/
function getWorldPtRepresentation(pt) {
if (!isValidPoint(pt)) return null;
Expand Down