Skip to content
Closed
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
1 change: 0 additions & 1 deletion buildScript/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-env node */
/* global process */

import webpack from 'webpack';
import TerserPlugin from 'terser-webpack-plugin';
Expand Down
22 changes: 19 additions & 3 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import js from "@eslint/js";
import react from "eslint-plugin-react";
import jsdoc from "eslint-plugin-jsdoc";
import reactHooks from "eslint-plugin-react-hooks";
Expand All @@ -19,6 +20,16 @@ const gitIgnorePath = path.resolve(__dirname, ".gitignore")

export default [
includeIgnoreFile(gitIgnorePath), //ignore git-ignored dirs/files

// vendored third-party source
{ignores: [
"src/firefly/html/gpu-browser.min-*.js",
"src/firefly/js/externalSource/**",
]},

// eslint's recommended rules; the block below layers over these
{files: ["**/*.js", "**/*.jsx"], ...js.configs.recommended},

{
files: ["**/*.js", "**/*.jsx"],

Expand Down Expand Up @@ -66,14 +77,19 @@ export default [
"prefer-const": 1,
"prefer-spread": 1,
"prefer-template": 0,

// recommended rules with existing violations: warn until the sites are addressed
"no-case-declarations": 1,
"no-async-promise-executor": 1,

"@stylistic/js/arrow-parens": [2, "always"],
"@stylistic/js/comma-spacing": 0,
"@stylistic/js/jsx-quotes": [1, "prefer-single"],
"@stylistic/js/key-spacing": 0,
"@stylistic/js/no-multi-spaces": 0,
"@stylistic/js/semi": [2, "always"],
"@stylistic/js/space-infix-ops": 0,
"@stylistic/js/quotes": [2, "single", "avoid-escape"],
"@stylistic/js/quotes": [2, "single", {avoidEscape: true, allowTemplateLiterals: "avoidEscape"}],
"react/jsx-boolean-value": [1, "always"],
"react/jsx-no-duplicate-props": 1,
"react/jsx-no-undef": 1,
Expand Down Expand Up @@ -108,13 +124,13 @@ export default [
'react-hooks/unsupported-syntax': 'warn',
'react-hooks/use-memo': 'warn',
'react-hooks/incompatible-library': 'warn',
"jsdoc/check-param-names": 2,
"jsdoc/check-param-names": 1,
"jsdoc/check-tag-names": 0,
"jsdoc/check-types": 0,
"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": 1,
"jsdoc/require-param-description": 0,
"jsdoc/require-param-type": 0,
"jsdoc/require-returns-description": 0,
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
"@babel/preset-react": "^7.24.7",
"@babel/register": "^7.24.6",
"@eslint/compat": "^1.1.0",
"@eslint/js": "~9.38",
"@stylistic/eslint-plugin-js": "~4.4",
"@svgr/webpack": "^8.1.0",
"@testing-library/dom": "^10",
Expand Down
3 changes: 3 additions & 0 deletions src/firefly/html/demo/non-ascii-text.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
object,line,wavelength
Réseau,Hα,6563
Ångström,[O III],5007
2 changes: 1 addition & 1 deletion src/firefly/js/api/webApiCommands/SiaCommands.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const siaPanelOverview= {
obsCoreWavelengthRangeType : 'Type of Wavelength search for Observations. `contains` or `overlaps`',
obsCoreWavelengthContains : `Wavelength value (in ${wvlUnit}) when selecting \`obsCoreWavelengthRangeType=contains\``,
obsCoreWavelengthMinRange : `Upper limit of an observation's wavelength coverage (in ${wvlUnit}). Requires \`obsCoreWavelengthRangeType=overlaps\``,
obsCoreWavelengthMaxRange : `Lower limit of an observation\'s wavelength coverage (in ${wvlUnit}). Requires \`obsCoreWavelengthRangeType=overlaps\``,
obsCoreWavelengthMaxRange : `Lower limit of an observation's wavelength coverage (in ${wvlUnit}). Requires \`obsCoreWavelengthRangeType=overlaps\``,

[ReservedParams.POSITION.name]: ['coordinates of the search',...ReservedParams.POSITION.desc],
[ReservedParams.SR.name]: ['radius of search (optional)',...ReservedParams.SR.desc],
Expand Down
6 changes: 3 additions & 3 deletions src/firefly/js/api/webApiCommands/TapCommands.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const tapPanelOverview= {
obsCoreWavelengthRangeType : 'Type of Wavelength search for Observations. `contains` or `overlaps`',
obsCoreWavelengthContains : `Wavelength value (in ${wvlUnit}) when selecting \`obsCoreWavelengthRangeType=contains\``,
obsCoreWavelengthMinRange : `Upper limit of an observation's wavelength coverage (in ${wvlUnit}). Requires \`obsCoreWavelengthRangeType=overlaps\``,
obsCoreWavelengthMaxRange : `Lower limit of an observation\'s wavelength coverage (in ${wvlUnit}). Requires \`obsCoreWavelengthRangeType=overlaps\``,
obsCoreWavelengthMaxRange : `Lower limit of an observation's wavelength coverage (in ${wvlUnit}). Requires \`obsCoreWavelengthRangeType=overlaps\``,
[ReservedParams.POSITION.name]: ['coordinates of the search',...ReservedParams.POSITION.desc],
[ReservedParams.SR.name]: ['radius of search (optional)',...ReservedParams.SR.desc],
polygon: 'polygon as a list of ra dec strings, example: 269.3 68.2, 272.85 68.2, 272.7 66.7, 269.3 66.7',
Expand Down Expand Up @@ -134,7 +134,7 @@ WHERE CONTAINS(POINT('ICRS', ra, dec),CIRCLE('ICRS', 83.63321237, 22.01446012, 0
service: 'https://irsa.ipac.caltech.edu/TAP',
adql:
`SELECT ra,dec,sigra,sigdec,sigradec,w1mpro,w1sigmpro,w1snr,w1rchi2,w1mpro_allwise,w1sigmpro_allwise,w4mpro_allwise,w4sigmpro_allwise \
FROM neowiser_p1bs_psd WHERE CONTAINS(POINT('ICRS', ra, dec), CIRCLE(\'ICRS\', 10.68479, 41.26906, 0.013))=1`,
FROM neowiser_p1bs_psd WHERE CONTAINS(POINT('ICRS', ra, dec), CIRCLE('ICRS', 10.68479, 41.26906, 0.013))=1`,
}
},
{
Expand All @@ -143,7 +143,7 @@ FROM neowiser_p1bs_psd WHERE CONTAINS(POINT('ICRS', ra, dec), CIRCLE(\'ICRS\', 1
service: 'https://irsa.ipac.caltech.edu/TAP',
adql:
`SELECT ra,dec,sigra,sigdec,sigradec,w2mpro,w2sigmpro,w2snr,w2rchi2,w2mpro_allwise,w2sigmpro_allwise,w3mpro_allwise,w3sigmpro_allwise \
FROM neowiser_p1bs_psd WHERE CONTAINS(POINT('ICRS', ra, dec), CIRCLE(\'ICRS\', 10.68479, 41.26906, 0.013))=1`,
FROM neowiser_p1bs_psd WHERE CONTAINS(POINT('ICRS', ra, dec), CIRCLE('ICRS', 10.68479, 41.26906, 0.013))=1`,
execute: 'true',
}
}
Expand Down
50 changes: 23 additions & 27 deletions src/firefly/js/astro/conv/__tests__/CoordConv-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -412,16 +412,16 @@ describe('A test suite for CoordConv.js', function () {
179.69493905911276
];
const expectedLats =[
-89.72157064600971
-89.72157064600971
-89.72157064600971
-89.72157064600971
-89.72157064600971
-89.72157064600971
-89.72157064600971
-89.72157064600971
-89.72157064600971
-89.72157064600968
-89.72157064600971,
-89.72157064600971,
-89.72157064600971,
-89.72157064600971,
-89.72157064600971,
-89.72157064600971,
-89.72157064600971,
-89.72157064600971,
-89.72157064600971,
-89.72157064600968,
-89.7215706460096,
-89.7215706460096,
-89.7215706460096,
Expand Down Expand Up @@ -456,7 +456,6 @@ describe('A test suite for CoordConv.js', function () {

const inLat = -90;//-35.955853;

var lons = [];
var lats = [];
var ret;
const tobs=1983.5;
Expand Down Expand Up @@ -558,7 +557,6 @@ describe('A test suite for CoordConv.js', function () {

const inLat = 0.0;

var lons = [];
var lats = [];
var ret;
const tobs=1983.5;
Expand All @@ -581,7 +579,7 @@ describe('A test suite for CoordConv.js', function () {
});


test('should be equal when convert from inCoord = EQUATORIAL_J,inEquirox=20000 , to outCoord=ECLIPTIC_B outEquinox=1950 lat=-90.0', function () {
test('should be equal when convert from inCoord = EQUATORIAL_J,inEquirox=20000 , to outCoord=EQUATORIAL_B outEquinox=1950 lat=90.0', function () {

const expectedLons = [
359.68340855555186,
Expand Down Expand Up @@ -661,7 +659,6 @@ describe('A test suite for CoordConv.js', function () {

const inLat =90.0;

var lons = [];
var lats = [];
var ret;
const tobs=1983.5;
Expand All @@ -684,19 +681,19 @@ describe('A test suite for CoordConv.js', function () {
});


test('should be equal when convert from inCoord = EQUATORIAL_J,inEquirox=20000 , to outCoord=EQUATORIAL_B outEquinox=1950 lat=90.0', function () {
test('should be equal when convert from inCoord = EQUATORIAL_J,inEquirox=20000 , to outCoord=ECLIPTIC_B outEquinox=1950 lat=-90.0', function () {

const expectedLons = [
69.3002173418388,
69.3002173418388,
69.3002173418388,
69.3002173418388,
69.3002173418388,
69.3002173418388,
69.3002173418388,
69.3002173418388,
69.3002173418388,
69.3002173418387,
269.3002173418388,
269.3002173418388,
269.3002173418388,
269.3002173418388,
269.3002173418388,
269.3002173418388,
269.3002173418388,
269.3002173418388,
269.3002173418388,
269.3002173418387,
269.3002173418387,
269.3002173418387,
269.3002173418387,
Expand Down Expand Up @@ -762,9 +759,8 @@ describe('A test suite for CoordConv.js', function () {
lons[i] = deltaLon*i;
}

const inLat =90.0;
const inLat = -90.0;

var lons = []; // TODO: this line causes test to skip over all of the assert below.. no test were performed
var lats = [];
var ret;
const tobs=1983.5;
Expand Down
2 changes: 1 addition & 1 deletion src/firefly/js/astro/net/Resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export var parseResolver= function(resolveStr) {
if (!resolveStr) return undefined;
var retval= null;
for( var resolveType in Resolver) {
if( Resolver.hasOwnProperty( resolveType ) ) {
if( Object.prototype.hasOwnProperty.call( Resolver, resolveType ) ) {
if (resolveStr.toLowerCase()===Resolver[resolveType].key) {
retval= Resolver[resolveType];
break;
Expand Down
2 changes: 1 addition & 1 deletion src/firefly/js/charts/ChartUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ export function getDataChangesForMappings({tableModel, mappings, traceNum}) {

let getDataVal;
const changes = {};
changes[`fireflyData.${traceNum}.isLoading`] = !Boolean(tableModel);
changes[`fireflyData.${traceNum}.isLoading`] = !tableModel;
if (tableModel) {
const cols = tableModel.tableData.columns.map((c) => c.name);
const transposed = tableModel.tableData.columns.map(() => []);
Expand Down
2 changes: 1 addition & 1 deletion src/firefly/js/charts/ChartsCntlr.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ function chartUpdate(action) {
return (dispatch) => {
const {chartId, changes, replaceTableSources=false} = action.payload;
// when selection is undefined, selections layer must be removed
if (changes.hasOwnProperty('selection') && !changes.selection) changes['layout.selections'] = [];
if (Object.prototype.hasOwnProperty.call(changes, 'selection') && !changes.selection) changes['layout.selections'] = [];
// remove any table's mappings from changes because it will be applied by the connectors.
const changesWithoutTblMappings = omitBy(changes, (v) => isString(v) && v.match(TBL_SRC_PATTERN));
set(action, 'payload.changes', changesWithoutTblMappings);
Expand Down
2 changes: 1 addition & 1 deletion src/firefly/js/charts/ui/ChartsContainer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ export const ActiveChartsPanel = (props) => {
chartId,
tbl_group,
toolbarVariant,
showToolbar: !Boolean(noChartToolbar),
showToolbar: !noChartToolbar,
}}/>
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/firefly/js/charts/ui/MultiChartViewer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export class MultiChartViewer extends PureComponent {
//console.log('Active chart ID: '+activeItemId);

const ToolBar = expandedMode ? MultiChartToolbarExpanded : MultiChartToolbarStandard;
const showChartToolbar = !Boolean(noChartToolbar);
const showChartToolbar = !noChartToolbar;

const borderSettings= useBorder ?
{border: '1px solid', borderColor: 'divider', borderRadius: '5px'} : {};
Expand Down
2 changes: 1 addition & 1 deletion src/firefly/js/charts/ui/PlotlyWrapper.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function deltas(a, b, wrapArray=true) {
const doDiff = (a2, b2, r, wrapArray) => {
forEach(a2, function(v, k) {
// already checked this or equal or original has no value...
if (b2 && (r.hasOwnProperty(k) || shallowequal(b2[k], v))) return;
if (b2 && (Object.prototype.hasOwnProperty.call(r, k) || shallowequal(b2[k], v))) return;
// but what if it returns an empty object? still attach?
r[k] = b2 && isPlainObject(v) ? diff(v, b2[k], wrapArray) : v;
if (wrapArray && Array.isArray(r[k])) {
Expand Down
2 changes: 1 addition & 1 deletion src/firefly/js/core/AppDataCntlr.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export function dispatchConnectionStatus({lost, reason}) {
export function dispatchNotifyRemoteAppReady() {
const channel= getWsChannel();
if (!channel) return;
const [, sourceChannel, app] = channel.match(channel_matcher) || [,channel];
const [, sourceChannel, app] = channel.match(channel_matcher) || [undefined, channel];
dispatchRemoteAction(sourceChannel,{ type : NOTIFY_REMOTE_APP_READY, payload: {ready:true, viewerChannel:channel}});
}

Expand Down
3 changes: 0 additions & 3 deletions src/firefly/js/core/background/BackgroundCntlr.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,6 @@ function reducer(state={}, action={}) {
nstate = TblUtil.smartMerge(nstate, updates);
}
return nstate;
break;
case BG_LOAD_JOBS: {
const {jobs, overflow} = action.payload;
let nstate = state;
Expand All @@ -256,14 +255,12 @@ function reducer(state={}, action={}) {
nstate = updateObject(nstate, updates);
}
return nstate;
break;
}
case BG_SET_INFO : {
const {email, notifEnabled} = action.payload;
let nstate = updateSet(state, 'email', email);
nstate = updateSet(nstate, 'notifEnabled', notifEnabled);
return nstate;
break;
}
default:
return state;
Expand Down
1 change: 0 additions & 1 deletion src/firefly/js/drawingLayers/Artifact.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ function getLayerChanges(drawLayer, action) {
const {tableModel}= action.payload.changes;
return tableModel ? Object.assign({tableModel}, createDrawData(drawLayer, tableModel)) :
{tableModel:null, drawData: null};
break;

case ATTACH_LAYER_TO_PLOT:
case CHANGE_VISIBILITY:
Expand Down
14 changes: 7 additions & 7 deletions src/firefly/js/drawingLayers/ComputeWebGridData.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,28 +133,28 @@ function getRangeFromFourSides(plot, csys, cc){
var wLen, hLen;
wLen = width/det;
hLen = height/det;
for (var i=0; i<wLen; i++){
for (let i=0; i<wLen; i++){
x=i*det;
y=0;
points1[i]= cc.getWorldCoords(makeDevicePt(x, y), csys);
}
//from 0,0 to 0, height: (0, 0) - (0, height)
for (var i=0; i<hLen; i++){
for (let i=0; i<hLen; i++){
x=0;
y=i*det;
points2[i]= cc.getWorldCoords(makeDevicePt(x, y), csys);
}

//from (0, height) - (width, height)
for (var i=0; i<wLen; i++){
for (let i=0; i<wLen; i++){
x=i*det;
y=height;
points3[i]= cc.getWorldCoords(makeDevicePt(x, y), csys);
}

//from (width, 0) - (width, height)
//from 0,0 to 0, height: (0, 0) - (0, height)
for (var i=0; i<hLen; i++){
for (let i=0; i<hLen; i++){
x=width;
y=i*det;
points4[i]= cc.getWorldCoords(makeDevicePt(x, y), csys);
Expand Down Expand Up @@ -753,7 +753,7 @@ function findPoints(cc,csys, intervals, x0, y0,dx, dy, opoints){
if (opoints) {
i0 = 1;
di = 2;
for (var i=0; i <= intervals; i += 2) {
for (let i=0; i <= intervals; i += 2) {
xpoints[0][i] = opoints[0][Math.trunc(i/2)];
xpoints[1][i] = opoints[1][Math.trunc(i/2)];
}
Expand All @@ -764,7 +764,7 @@ function findPoints(cc,csys, intervals, x0, y0,dx, dy, opoints){
}

var sharedLon, wpt, ip, xy,sharedLat,tx, ty;
for (var i=i0; i <= intervals; i += di) {
for (let i=i0; i <= intervals; i += di) {
tx= x0+i*dx;
tx = tx > 360?tx-360:tx;
tx=tx<0?tx+360:tx;
Expand Down Expand Up @@ -1367,7 +1367,7 @@ function getLevels(ranges,factor, maxLines){
levels[i]=[];
}
else if ( Math.abs(min - (-90.0)) < 0.1 && Math.abs(max - 90.0) <0.1){ //include both poles
levels[i]= [-75.,-60., -45., -30., -15., 0.,
15., 30., 45., 60., 75.];
levels[i]= [-75.,-60., -45., -30., -15., 0., 15., 30., 45., 60., 75.];
}
else {
/* LZ DM-10491: introduced this simple algorithm to calculate the intervals. The previous one
Expand Down
2 changes: 1 addition & 1 deletion src/firefly/js/drawingLayers/FootprintTool.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
} from './MarkerTool.js';
import {getFootprintToolUIComponent} from './FootprintToolUI.jsx';
import ShapeDataObj from '../visualize/draw/ShapeDataObj.js';
import {clone} from '../util/WebUtil.js'
import {clone} from '../util/WebUtil.js';
import {getDS9Region} from '../rpc/PlotServicesJson.js';
import {FootprintFactory} from '../visualize/draw/FootprintFactory.js';
import {makeImagePt} from '../visualize/Point.js';
Expand Down
2 changes: 1 addition & 1 deletion src/firefly/js/drawingLayers/SearchTarget.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function creator(initPayload, presetDefaults) {
destroyWhenAllDetached: true,
canUserChangeColor: ColorChangeType.DYNAMIC,
canUserDelete,
allocatedColor: !Boolean(color),
allocatedColor: !color,
};
return DrawLayer.makeDrawLayer(drawLayerId || `${ID}-${idCnt}`,TYPE_ID, {}, options, drawingDef, [RECENTER, UPDATE_SEARCH_TARGET]);
}
Expand Down
2 changes: 1 addition & 1 deletion src/firefly/js/fieldGroup/FieldGroupUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function validateSingle(groupKey, includeUnmounted) {
const newValue= fields[key].value();
if (typeof newValue=== 'object' && // check to see if return is an object that includes {value: any} and not a promise
!newValue.then &&
newValue.hasOwnProperty('value') ) {
Object.prototype.hasOwnProperty.call(newValue, 'value') ) {
dispatchValueChange({valid:true,fieldKey:key,groupKey,...newValue});
}
else {
Expand Down
Loading
Loading