Skip to content

Commit

Permalink
fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ntraut committed Oct 19, 2023
1 parent 59d5b78 commit a746c46
Show file tree
Hide file tree
Showing 5 changed files with 190 additions and 180 deletions.
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"[javascript]": {
"editor.formatOnSave": false,
"editor.codeActionsOnSave": [
"source.formatDocument", // used by rohit-gohri.format-code-action
"source.fixAll.eslint" // used by dbaeumer.vscode-eslint
// "source.formatDocument", // problem with switch case multi lines comment indents
"source.fixAll.eslint"
]
},
"[vue]": {
Expand Down
24 changes: 15 additions & 9 deletions controller/atlasmakerServer/atlasmakerServer.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
/* eslint-disable max-lines */
const fs = require('fs');
const os = require('os');
const path = require('path');
const zlib = require('zlib');
const tracer = require('tracer').console({ format: '[{{file}}:{{line}}] {{message}}' });

const AsyncLock = require('async-lock');
const createDOMPurify = require('dompurify');
const jsonpatch = require('fast-json-patch');
const jpeg = require('jpeg-js'); // jpeg-js library: https://github.com/eugeneware/jpeg-js
const merge = require('merge');
const path = require('path');
const { JSDOM } = require('jsdom');
const keypress = require('keypress');
const merge = require('merge');
const tracer = require('tracer').console({ format: '[{{file}}:{{line}}] {{message}}' });
const WebSocket = require('ws');

const notifier = require('../../notifier');

const amri = require('./atlasmaker-mri');
const AsyncLock = require('async-lock');

const lock = new AsyncLock();

// Get whitelist and blacklist
Expand All @@ -19,12 +27,9 @@ const whitelist = JSON.parse(fs.readFileSync(path.join(__dirname, 'whitelist.jso
const blacklist = JSON.parse(fs.readFileSync(path.join(__dirname, 'blacklist.json')));

// var http = require('http');
const WebSocket = require('ws');
const WebSocketServer = WebSocket.Server;
let websocketserver;

const createDOMPurify = require('dompurify');
const { JSDOM } = require('jsdom');
const { window } = (new JSDOM('', {
features: {
FetchExternalResources: false, // disables resource loading over HTTP / filesystem
Expand All @@ -33,7 +38,6 @@ const { window } = (new JSDOM('', {
}));
const DOMPurify = createDOMPurify(window);

const jsonpatch = require('fast-json-patch');

const bufferTag = function (str, sz) {
const buf = Buffer.alloc(sz).fill(32);
Expand Down Expand Up @@ -322,11 +326,13 @@ data.vox_offset: ${me.Brains[i].data.vox_offset}
try {
await me._saveAtlasVoxelData(atlas);
} catch (err) {
// can crash brainbox, second argument is not used
throw new Error('Can\'t save atlas voxel data', err);
}
try {
await me._saveAtlasVectorialData(atlas);
} catch (err) {
// can crash brainbox, second argument is not used
throw new Error('Can\'t save atlas vectorial data', err);
}
},
Expand Down Expand Up @@ -1126,6 +1132,7 @@ data.vox_offset: ${me.Brains[i].data.vox_offset}
const sourceUS = me.getUserFromUserId(data.uid);

// get brainPath from User object
// can crash brainbox in case of sourceUS.User object still not created
const brainPath = sourceUS.User.dirname + sourceUS.User.mri;

// update User object
Expand Down Expand Up @@ -2108,7 +2115,6 @@ free memory: ${os.freemem()}
};

// Notifications
const notifier = require('../../notifier');
notifier.on('saveAllAtlases', () => {
atlasmakerServer.saveAllAtlases();
});
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"css-loader": "^5.2.7",
"del": "^3.0.0",
"eslint": "^8.8.0",
"eslint-config-naat": "git+https://github.com/neuroanatomy/eslint-config-naat.git",
"eslint-config-naat": "github:neuroanatomy/eslint-config-naat",
"eslint-plugin-vue": "^9.17.0",
"file-loader": "^2.0.0",
"html-loader": "^0.5.5",
Expand Down
Loading

0 comments on commit a746c46

Please sign in to comment.