From 15db3c9f664d70623327e37ad3cabf8c9536ce40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Mon, 18 May 2026 16:21:57 +0200 Subject: [PATCH] lint client --- .../components/codeEditor/customHighlight.js | 4 +- client/components/codeEditor/customKeyMaps.js | 46 +++++++++---------- .../homebrew/editor/snippetbar/snippetbar.jsx | 13 +++--- 3 files changed, 30 insertions(+), 33 deletions(-) diff --git a/client/components/codeEditor/customHighlight.js b/client/components/codeEditor/customHighlight.js index 09a9af18f..622f8a3bf 100644 --- a/client/components/codeEditor/customHighlight.js +++ b/client/components/codeEditor/customHighlight.js @@ -86,8 +86,8 @@ export function tokenizeCustomMarkdown(text) { if(/\~/.test(lineText)) { const strikethroughRegex = /~(?!\s)(.+?)(? { - const { from, to } = view.state.selection.main; +const insertTab = (view)=>{ + const { from, to } = view.state.selection.main; - view.dispatch({ - changes: { from, to, insert: ' ' }, - selection: { anchor: from + 2 } - }); + view.dispatch({ + changes : { from, to, insert: ' ' }, + selection : { anchor: from + 2 } + }); - return true; + return true; }; const indentLess = (view)=>{ @@ -28,20 +28,18 @@ const indentLess = (view)=>{ return true; }; -const wrapSelection = (prefix, suffix) => (view) => { +const wrapSelection = (prefix, suffix)=>(view)=>{ const changes = []; - for(const range of view.state.selection.ranges) { + for (const range of view.state.selection.ranges) { const { from, to } = range; const selected = view.state.doc.sliceString(from, to); let text; - if(from === to) { text = prefix + suffix } - else if(selected.startsWith(prefix) && selected.endsWith(suffix)) { + if(from === to) { text = prefix + suffix; } else if(selected.startsWith(prefix) && selected.endsWith(suffix)) { text = selected.slice(prefix.length, -suffix.length); - } - else {text = `${prefix}${selected}${suffix}`} + } else {text = `${prefix}${selected}${suffix}`;} changes.push({ from, to, insert: text }); } @@ -53,21 +51,21 @@ const wrapSelection = (prefix, suffix) => (view) => { return true; }; -const makeNbsp = (view) => { - const { from } = view.state.selection.main; +const makeNbsp = (view)=>{ + const { from } = view.state.selection.main; - const prev2 = from >= 2 - ? view.state.doc.sliceString(from - 2, from) - : ''; + const prev2 = from >= 2 + ? view.state.doc.sliceString(from - 2, from) + : ''; - const insert = (prev2 === ':>' || prev2 === '>>') ? '>' : ':>'; + const insert = (prev2 === ':>' || prev2 === '>>') ? '>' : ':>'; - view.dispatch({ - changes : { from, to: from, insert }, - selection : { anchor: from + insert.length }, - }); + view.dispatch({ + changes : { from, to: from, insert }, + selection : { anchor: from + insert.length }, + }); - return true; + return true; }; const makeSpace = (view)=>{ diff --git a/client/homebrew/editor/snippetbar/snippetbar.jsx b/client/homebrew/editor/snippetbar/snippetbar.jsx index 597a01045..ac9c7943a 100644 --- a/client/homebrew/editor/snippetbar/snippetbar.jsx +++ b/client/homebrew/editor/snippetbar/snippetbar.jsx @@ -30,18 +30,17 @@ import cm5Themes from 'codemirror-5-themes'; const themes = { default: defaultCM5Theme, ...cm5Themes, darkbrewery }; const themeNames = Object.entries(themes) - .filter(([name, value]) => - Array.isArray(value) && + .filter(([name, value])=>Array.isArray(value) && !name.endsWith('Init') && !name.endsWith('Style') ) - .map(([name]) => name); + .map(([name])=>name); const EditorThemes = [ - 'default', - ...themeNames - .filter(name => name !== 'default') - .sort((a, b) => a.localeCompare(b)) + 'default', + ...themeNames + .filter((name)=>name !== 'default') + .sort((a, b)=>a.localeCompare(b)) ]; const execute = function(val, props){