diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 94c6bcd9..d633b1d7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,19 +19,19 @@ repos: - id: django-upgrade args: [--target-version, "3.2"] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.6.4" + rev: "v0.6.7" hooks: - id: ruff args: [--unsafe-fixes] - id: ruff-format - repo: https://github.com/biomejs/pre-commit - rev: "v0.4.0" + rev: "v0.5.0" hooks: - id: biome-check - additional_dependencies: ["@biomejs/biome@1.8.3"] + additional_dependencies: ["@biomejs/biome@1.9.2"] args: [--unsafe] - repo: https://github.com/tox-dev/pyproject-fmt - rev: 2.2.3 + rev: 2.2.4 hooks: - id: pyproject-fmt - repo: https://github.com/abravalheri/validate-pyproject diff --git a/biome.json b/biome.json index b3c969eb..544719cb 100644 --- a/biome.json +++ b/biome.json @@ -1,5 +1,5 @@ { - "$schema": "https://biomejs.dev/schemas/1.8.3/schema.json", + "$schema": "https://biomejs.dev/schemas/1.9.2/schema.json", "organizeImports": { "enabled": false }, diff --git a/content_editor/static/content_editor/content_editor.js b/content_editor/static/content_editor/content_editor.js index 01390c44..26d3f86f 100644 --- a/content_editor/static/content_editor/content_editor.js +++ b/content_editor/static/content_editor/content_editor.js @@ -413,14 +413,16 @@ const select = document.createElement("select") let idx = 0 - if (title) select.options[idx++] = new Option(title, "", true) + if (title) { + select.options[idx++] = new Option(title, "", true) + } - for (let i = 0; i < contents.length; i++) { + for (const content of contents) { // Option _values_ may either be the prefix (for plugins) or keys (for // regions) select.options[idx++] = new Option( - contents[i].title, - contents[i].prefix || contents[i].key, + content.title, + content.prefix || content.key, ) } return select @@ -489,17 +491,14 @@ // Filter allowed regions const inlineType = getInlineType($inline) const regions = [] - for (let i = 0; i < ContentEditor.regions.length; i++) { + for (const region of ContentEditor.regions) { if ( (!inlineType || !pluginRegions[inlineType] || - $.inArray( - ContentEditor.regions[i].key, - pluginRegions[inlineType], - ) >= 0) && - !/^_unknown_/.test(ContentEditor.regions[i].key) + $.inArray(region.key, pluginRegions[inlineType]) >= 0) && + !/^_unknown_/.test(region.key) ) { - regions.push(ContentEditor.regions[i]) + regions.push(region) } } @@ -611,13 +610,11 @@ ) } - const pluginInlineGroups = (function selectPluginInlineGroups() { - const selector = [] - for (let i = 0; i < ContentEditor.plugins.length; i++) { - selector.push(`#${ContentEditor.plugins[i].prefix}-group`) - } - return $(selector.join(", ")) - })() + const pluginInlineGroups = $( + ContentEditor.plugins + .map((plugin) => `#${plugin.prefix}-group`) + .join(", "), + ) reorderInlines(pluginInlineGroups) pluginInlineGroups.hide() @@ -763,11 +760,11 @@ // Initialize tabs and currentRegion. ;(() => { const tabContainer = $(".tabs.regions") - for (let i = 0; i < ContentEditor.regions.length; i++) { + for (const region of ContentEditor.regions) { const t = document.createElement("h2") t.className = "tab" - t.textContent = ContentEditor.regions[i].title - t.setAttribute("data-region", ContentEditor.regions[i].key) + t.textContent = region.title + t.setAttribute("data-region", region.key) tabContainer.append(t) }