From 4a565b929b058f992f24c892e4cbe6d50499681c 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:46 +0200 Subject: [PATCH 1/3] lint themes --- themes/V3/Blank/snippets/imageMask.gen.js | 20 ++++++++++---------- themes/codeMirror/darkbrewery.js | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/themes/V3/Blank/snippets/imageMask.gen.js b/themes/V3/Blank/snippets/imageMask.gen.js index 530ce01ac..833225b36 100644 --- a/themes/V3/Blank/snippets/imageMask.gen.js +++ b/themes/V3/Blank/snippets/imageMask.gen.js @@ -16,17 +16,17 @@ export default { edge : (side = 'bottom')=>{ const styles = ()=>{ switch (side) { - case 'bottom': - return `{width:100%,bottom:0%}` - break; - case 'top': - return `{width:100%,top:0%}` - break; - default: - return `{height:100%}` - break; + case 'bottom': + return `{width:100%,bottom:0%}`; + break; + case 'top': + return `{width:100%,top:0%}`; + break; + default: + return `{height:100%}`; + break; } - } + }; const rotation = { 'bottom' : 0, diff --git a/themes/codeMirror/darkbrewery.js b/themes/codeMirror/darkbrewery.js index fd010e6e0..202159715 100644 --- a/themes/codeMirror/darkbrewery.js +++ b/themes/codeMirror/darkbrewery.js @@ -93,7 +93,7 @@ export default EditorView.theme({ '.cm-strong' : { color: '#309dd2', fontWeight: 'bold' }, '.cm-em' : { fontStyle: 'italic' }, '.cm-keyword' : { color: '#fff' }, - '.cm-atom, .cm-value, .cm-color' : { color: '#c1939a' }, + '.cm-atom, .cm-value, .cm-color' : { color: '#c1939a' }, '.cm-number' : { color: '#2986cc' }, '.cm-def' : { color: '#2986cc' }, '.cm-list' : { color: '#3cbf30' }, 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 2/3] 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){ From 34b26107c6b661d78d17082fcce7e4cc897ef51d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Mon, 18 May 2026 16:22:03 +0200 Subject: [PATCH 3/3] lint server --- server/homebrew.api.js | 18 +++++++++--------- server/homebrew.model.js | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/server/homebrew.api.js b/server/homebrew.api.js index c47e3640e..ba8c97b16 100644 --- a/server/homebrew.api.js +++ b/server/homebrew.api.js @@ -32,20 +32,20 @@ const isStaticTheme = (renderer, themeName)=>{ // }; -const migrateSystemsToTags = (brew) => { - if (!('systems' in brew)) return brew; +const migrateSystemsToTags = (brew)=>{ + if(!('systems' in brew)) return brew; - if (!Array.isArray(brew.systems) || brew.systems.length === 0) { + if(!Array.isArray(brew.systems) || brew.systems.length === 0) { brew.systems = undefined; return brew; } const systemMap = { - '5e': 'system:D&D 5e', - '4e': 'system:D&D 4e', - '3.5e': 'system:D&D 3.5e', - 'Pathfinder': 'system:Pathfinder 2e' + '5e' : 'system:D&D 5e', + '4e' : 'system:D&D 4e', + '3.5e' : 'system:D&D 3.5e', + 'Pathfinder' : 'system:Pathfinder 2e' }; - const systemTags = brew.systems.map(s => systemMap[s]); + const systemTags = brew.systems.map((s)=>systemMap[s]); brew.tags = _.uniq([...(brew.tags || []), ...systemTags]); brew.systems = undefined; @@ -188,7 +188,7 @@ const api = { stub.renderer = stub.renderer || undefined; // Clear empty strings stub = _.defaults(stub, DEFAULT_BREW_LOAD); // Fill in blank fields - + const fixedStub = migrateSystemsToTags(stub); req.brew = fixedStub; diff --git a/server/homebrew.model.js b/server/homebrew.model.js index b3d7702ce..e923ac928 100644 --- a/server/homebrew.model.js +++ b/server/homebrew.model.js @@ -15,7 +15,7 @@ const HomebrewSchema = mongoose.Schema({ description : { type: String, default: '' }, tags : { type: [String], index: true }, - systems : { type: [String], default: undefined }, + systems : { type: [String], default: undefined }, lang : { type: String, default: 'en', index: true }, renderer : { type: String, default: '', index: true }, authors : { type: [String], index: true },