Skip to content

Commit 319a49f

Browse files
committed
Make biome slightly happier
1 parent 6afb254 commit 319a49f

File tree

3 files changed

+23
-26
lines changed

3 files changed

+23
-26
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,19 @@ repos:
1919
- id: django-upgrade
2020
args: [--target-version, "3.2"]
2121
- repo: https://github.com/astral-sh/ruff-pre-commit
22-
rev: "v0.6.4"
22+
rev: "v0.6.7"
2323
hooks:
2424
- id: ruff
2525
args: [--unsafe-fixes]
2626
- id: ruff-format
2727
- repo: https://github.com/biomejs/pre-commit
28-
rev: "v0.4.0"
28+
rev: "v0.5.0"
2929
hooks:
3030
- id: biome-check
31-
additional_dependencies: ["@biomejs/biome@1.8.3"]
31+
additional_dependencies: ["@biomejs/biome@1.9.2"]
3232
args: [--unsafe]
3333
- repo: https://github.com/tox-dev/pyproject-fmt
34-
rev: 2.2.3
34+
rev: 2.2.4
3535
hooks:
3636
- id: pyproject-fmt
3737
- repo: https://github.com/abravalheri/validate-pyproject

biome.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
2+
"$schema": "https://biomejs.dev/schemas/1.9.2/schema.json",
33
"organizeImports": {
44
"enabled": false
55
},

content_editor/static/content_editor/content_editor.js

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -413,14 +413,16 @@
413413
const select = document.createElement("select")
414414
let idx = 0
415415

416-
if (title) select.options[idx++] = new Option(title, "", true)
416+
if (title) {
417+
select.options[idx++] = new Option(title, "", true)
418+
}
417419

418-
for (let i = 0; i < contents.length; i++) {
420+
for (const content of contents) {
419421
// Option _values_ may either be the prefix (for plugins) or keys (for
420422
// regions)
421423
select.options[idx++] = new Option(
422-
contents[i].title,
423-
contents[i].prefix || contents[i].key,
424+
content.title,
425+
content.prefix || content.key,
424426
)
425427
}
426428
return select
@@ -489,17 +491,14 @@
489491
// Filter allowed regions
490492
const inlineType = getInlineType($inline)
491493
const regions = []
492-
for (let i = 0; i < ContentEditor.regions.length; i++) {
494+
for (const region of ContentEditor.regions) {
493495
if (
494496
(!inlineType ||
495497
!pluginRegions[inlineType] ||
496-
$.inArray(
497-
ContentEditor.regions[i].key,
498-
pluginRegions[inlineType],
499-
) >= 0) &&
500-
!/^_unknown_/.test(ContentEditor.regions[i].key)
498+
$.inArray(region.key, pluginRegions[inlineType]) >= 0) &&
499+
!/^_unknown_/.test(region.key)
501500
) {
502-
regions.push(ContentEditor.regions[i])
501+
regions.push(region)
503502
}
504503
}
505504

@@ -611,13 +610,11 @@
611610
)
612611
}
613612

614-
const pluginInlineGroups = (function selectPluginInlineGroups() {
615-
const selector = []
616-
for (let i = 0; i < ContentEditor.plugins.length; i++) {
617-
selector.push(`#${ContentEditor.plugins[i].prefix}-group`)
618-
}
619-
return $(selector.join(", "))
620-
})()
613+
const pluginInlineGroups = $(
614+
ContentEditor.plugins
615+
.map((plugin) => `#${plugin.prefix}-group`)
616+
.join(", "),
617+
)
621618

622619
reorderInlines(pluginInlineGroups)
623620
pluginInlineGroups.hide()
@@ -763,11 +760,11 @@
763760
// Initialize tabs and currentRegion.
764761
;(() => {
765762
const tabContainer = $(".tabs.regions")
766-
for (let i = 0; i < ContentEditor.regions.length; i++) {
763+
for (const region of ContentEditor.regions) {
767764
const t = document.createElement("h2")
768765
t.className = "tab"
769-
t.textContent = ContentEditor.regions[i].title
770-
t.setAttribute("data-region", ContentEditor.regions[i].key)
766+
t.textContent = region.title
767+
t.setAttribute("data-region", region.key)
771768
tabContainer.append(t)
772769
}
773770

0 commit comments

Comments
 (0)