Skip to content

Commit 6fb140c

Browse files
committed
linting and prettier
1 parent 800e9cb commit 6fb140c

File tree

34 files changed

+213
-253
lines changed

34 files changed

+213
-253
lines changed

eslint.config.mjs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,21 @@ export default [
156156
},
157157
},
158158

159+
// --- Root-level Node.js scripts (e.g. keys.js) ---
160+
{
161+
files: ['*.js', '*.mjs'],
162+
languageOptions: {
163+
globals: {
164+
...globals.node,
165+
...globals.es2020,
166+
},
167+
},
168+
rules: {
169+
'no-console': 'off',
170+
'@typescript-eslint/no-require-imports': 'off',
171+
},
172+
},
173+
159174
// --- Internals scripts — Node.js, more relaxed ---
160175
{
161176
files: ['internals/**/*.{js,mjs,ts}'],

keys.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,4 @@ const CLIENT_ID = process.env.CLIENT_ID; // Created through Cortex Apps page on
55
const CLIENT_SECRET = process.env.CLIENT_SECRET; // Created through Cortex Apps page on Emotiv.com
66
const LICENSE_ID = process.env.LICENSE_ID; // Visible on My Account page of Emotiv.com
77

8-
const envVars = { CLIENT_ID, CLIENT_SECRET, LICENSE_ID };
9-
108
module.exports = { CLIENT_ID, CLIENT_SECRET, LICENSE_ID };

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,6 @@
136136
"homepage": "https://github.com/makebrainwaves/BrainWaves/",
137137
"jest": {
138138
"testEnvironment": "node",
139-
"testEnvironmentOptions": {
140-
"url": "http://localhost/"
141-
},
142139
"moduleNameMapper": {
143140
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/internals/mocks/fileMock.js",
144141
"\\.(css|less|sass|scss)$": "identity-obj-proxy"
@@ -243,29 +240,16 @@
243240
"ws": "^8.19.0"
244241
},
245242
"engines": {
246-
"node": ">=18.x",
243+
"node": "^20.19.0 || >=22.12.0",
247244
"npm": ">=8.x"
248245
},
249246
"prettier": {
250-
"overrides": [
251-
{
252-
"files": [
253-
".prettierrc",
254-
".eslintrc",
255-
".stylelintrc"
256-
],
257-
"options": {
258-
"parser": "json"
259-
}
260-
}
261-
],
262247
"singleQuote": true,
263248
"trailingComma": "es5"
264249
},
265250
"stylelint": {
266251
"extends": [
267252
"stylelint-config-standard"
268253
]
269-
},
270-
"husky": {}
254+
}
271255
}

src/main/index.ts

Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ export default class AppUpdater {
3737

3838
let mainWindow: BrowserWindow | null = null;
3939

40-
41-
4240
const installExtensions = async () => {
4341
const forceDownload = !!process.env.UPGRADE_EXTENSIONS;
4442
const sess = session.defaultSession;
@@ -47,7 +45,9 @@ const installExtensions = async () => {
4745
const loadExt = async (id: string) => {
4846
const extPath = path.join(extDir, id);
4947
if (!fs.existsSync(extPath)) return;
50-
const existing = sess.extensions.getAllExtensions().find((e) => e.id === id);
48+
const existing = sess.extensions
49+
.getAllExtensions()
50+
.find((e) => e.id === id);
5151
if (existing && !forceDownload) return;
5252
if (existing) {
5353
sess.removeExtension(id);
@@ -115,9 +115,7 @@ ipcMain.handle('shell:moveItemToTrash', (_event, fullPath) =>
115115
);
116116

117117
// Workspace management
118-
ipcMain.handle('fs:getWorkspaceDir', (_event, title) =>
119-
getWorkspaceDir(title)
120-
);
118+
ipcMain.handle('fs:getWorkspaceDir', (_event, title) => getWorkspaceDir(title));
121119

122120
ipcMain.handle('fs:createWorkspaceDir', (_event, title) => {
123121
mkdirPathSync(getWorkspaceDir(title));
@@ -173,7 +171,9 @@ ipcMain.handle('fs:restoreExperimentState', (_event, state: any) => {
173171

174172
ipcMain.handle('fs:readWorkspaceRawEEGData', (_event, title) => {
175173
try {
176-
const files = fs.readdirSync(getWorkspaceDir(title), { recursive: true }) as string[];
174+
const files = fs.readdirSync(getWorkspaceDir(title), {
175+
recursive: true,
176+
}) as string[];
177177
return files
178178
.filter((filepath) => filepath.slice(-7).includes('raw.csv'))
179179
.map((filepath) => {
@@ -188,7 +188,9 @@ ipcMain.handle('fs:readWorkspaceRawEEGData', (_event, title) => {
188188

189189
ipcMain.handle('fs:readWorkspaceCleanedEEGData', (_event, title) => {
190190
try {
191-
const files = fs.readdirSync(getWorkspaceDir(title), { recursive: true }) as string[];
191+
const files = fs.readdirSync(getWorkspaceDir(title), {
192+
recursive: true,
193+
}) as string[];
192194
return files
193195
.filter((filepath) => filepath.slice(-7).includes('epo.fif'))
194196
.map((filepath) => {
@@ -203,7 +205,9 @@ ipcMain.handle('fs:readWorkspaceCleanedEEGData', (_event, title) => {
203205

204206
ipcMain.handle('fs:readWorkspaceBehaviorData', (_event, title) => {
205207
try {
206-
const files = fs.readdirSync(getWorkspaceDir(title), { recursive: true }) as string[];
208+
const files = fs.readdirSync(getWorkspaceDir(title), {
209+
recursive: true,
210+
}) as string[];
207211
return files
208212
.filter((filepath) => filepath.slice(-12).includes('behavior.csv'))
209213
.map((filepath) => {
@@ -219,12 +223,7 @@ ipcMain.handle('fs:readWorkspaceBehaviorData', (_event, title) => {
219223
ipcMain.handle(
220224
'fs:storeBehavioralData',
221225
(_event, csv, title, subject, group, session) => {
222-
const dir = path.join(
223-
getWorkspaceDir(title),
224-
'Data',
225-
subject,
226-
'Behavior'
227-
);
226+
const dir = path.join(getWorkspaceDir(title), 'Data', subject, 'Behavior');
228227
const filename = `${subject}-${group}-${session}-behavior.csv`;
229228
mkdirPathSync(dir);
230229
return new Promise<void>((resolve, reject) => {
@@ -310,19 +309,16 @@ ipcMain.handle(
310309
}
311310
);
312311

313-
ipcMain.handle(
314-
'fs:checkFileExists',
315-
(_event, title, subject, filename) => {
316-
const file = path.join(
317-
getWorkspaceDir(title),
318-
'Data',
319-
subject,
320-
'Behavior',
321-
filename
322-
);
323-
return fs.existsSync(file);
324-
}
325-
);
312+
ipcMain.handle('fs:checkFileExists', (_event, title, subject, filename) => {
313+
const file = path.join(
314+
getWorkspaceDir(title),
315+
'Data',
316+
subject,
317+
'Behavior',
318+
filename
319+
);
320+
return fs.existsSync(file);
321+
});
326322

327323
ipcMain.handle('fs:readFiles', (_event, filePathsArray: string[]) => {
328324
return filePathsArray.map((filePath) => {
@@ -455,7 +451,6 @@ const createWindow = async () => {
455451
const menuBuilder = new MenuBuilder(mainWindow);
456452
menuBuilder.buildMenu();
457453

458-
// eslint-disable-next-line
459454
new AppUpdater();
460455
};
461456

src/preload/index.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,7 @@ contextBridge.exposeInMainWorld('electronAPI', {
143143
// ------------------------------------------------------------------
144144
// Misc
145145
// ------------------------------------------------------------------
146-
getResourcePath: (): Promise<string> =>
147-
ipcRenderer.invoke('getResourcePath'),
146+
getResourcePath: (): Promise<string> => ipcRenderer.invoke('getResourcePath'),
148147

149-
getViewerUrl: (): Promise<string> =>
150-
ipcRenderer.invoke('getViewerUrl'),
148+
getViewerUrl: (): Promise<string> => ipcRenderer.invoke('getViewerUrl'),
151149
});

src/preload/viewer.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ contextBridge.exposeInMainWorld('viewerAPI', {
2626
ipcRenderer.on('updateDomain', (_event, message) => callback(message)),
2727

2828
onUpdateDownsampling: (callback: (message: unknown) => void) =>
29-
ipcRenderer.on('updateDownsampling', (_event, message) => callback(message)),
29+
ipcRenderer.on('updateDownsampling', (_event, message) =>
30+
callback(message)
31+
),
3032

3133
onAutoScale: (callback: () => void) =>
3234
ipcRenderer.on('autoScale', () => callback()),

src/renderer/actions/deviceActions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,5 @@ export const DeviceActions = {
3737
} as const;
3838

3939
export type DeviceActionType = ActionType<
40-
typeof DeviceActions[keyof typeof DeviceActions]
40+
(typeof DeviceActions)[keyof typeof DeviceActions]
4141
>;

src/renderer/actions/experimentActions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,5 @@ export const ExperimentActions = {
4141
} as const;
4242

4343
export type ExperimentActionType = ActionType<
44-
typeof ExperimentActions[keyof typeof ExperimentActions]
44+
(typeof ExperimentActions)[keyof typeof ExperimentActions]
4545
>;

src/renderer/actions/pyodideActions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@ export const PyodideActions = {
3232
} as const;
3333

3434
export type PyodideActionType = ActionType<
35-
typeof PyodideActions[keyof typeof PyodideActions]
35+
(typeof PyodideActions)[keyof typeof PyodideActions]
3636
>;

0 commit comments

Comments
 (0)