Skip to content

Commit 0a0f7f8

Browse files
committed
Back to biome
1 parent 49f8ea8 commit 0a0f7f8

File tree

6 files changed

+90
-674
lines changed

6 files changed

+90
-674
lines changed

.pre-commit-config.yaml

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,14 @@ repos:
2222
rev: "v0.6.4"
2323
hooks:
2424
- id: ruff
25+
args: [--unsafe-fixes]
2526
- id: ruff-format
27+
- repo: https://github.com/biomejs/pre-commit
28+
rev: "v0.4.0"
29+
hooks:
30+
- id: biome-check
31+
additional_dependencies: ["@biomejs/[email protected]"]
32+
args: [--unsafe]
2633
- repo: https://github.com/tox-dev/pyproject-fmt
2734
rev: 2.2.3
2835
hooks:
@@ -31,18 +38,3 @@ repos:
3138
rev: v0.19
3239
hooks:
3340
- id: validate-pyproject
34-
- repo: local
35-
hooks:
36-
- id: prettier
37-
name: prettier
38-
entry: npx [email protected] --no-semi --write
39-
language: system
40-
types_or: [css, scss]
41-
require_serial: true
42-
- id: eslint
43-
name: eslint
44-
entry: yarn eslint
45-
language: system
46-
types_or: [javascript]
47-
require_serial: true
48-
verbose: true

biome.json

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
3+
"organizeImports": {
4+
"enabled": false
5+
},
6+
"formatter": {
7+
"enabled": true,
8+
"indentStyle": "space",
9+
"indentWidth": 2
10+
},
11+
"linter": {
12+
"enabled": true,
13+
"rules": {
14+
"recommended": true,
15+
"a11y": {
16+
"noSvgWithoutTitle": "off"
17+
},
18+
"correctness": {
19+
"noUndeclaredVariables": "error",
20+
"noUnusedImports": "error",
21+
"noUnusedVariables": "error",
22+
"useArrayLiterals": "error",
23+
"useHookAtTopLevel": "error"
24+
},
25+
"security": {
26+
"noDangerouslySetInnerHtml": "warn"
27+
},
28+
"style": {
29+
"noParameterAssign": "off",
30+
"useForOf": "warn"
31+
},
32+
"suspicious": {
33+
"noArrayIndexKey": "warn",
34+
"noAssignInExpressions": "off"
35+
}
36+
}
37+
},
38+
"javascript": {
39+
"formatter": {
40+
"semicolons": "asNeeded"
41+
},
42+
"globals": ["django", "CKEDITOR"]
43+
},
44+
"css": {
45+
"formatter": {
46+
"enabled": true
47+
},
48+
"linter": {
49+
"enabled": true
50+
}
51+
},
52+
"json": {
53+
"formatter": {
54+
"enabled": false
55+
}
56+
}
57+
}

eslint.config.mjs

Lines changed: 0 additions & 17 deletions
This file was deleted.

imagefield/static/imagefield/ppoi.js

Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,41 +5,37 @@
55
point.style.top = `${img.clientHeight * y}px`
66
}
77

8-
Array.prototype.slice
9-
.call(document.querySelectorAll(".imagefield[data-ppoi-id]"))
10-
.forEach((field) => {
11-
if (!field.dataset.ppoiId) return
12-
const ppoiField = document.querySelector(`#${field.dataset.ppoiId}`)
13-
if (!ppoiField) return
8+
for (const field of document.querySelectorAll(
9+
".imagefield[data-ppoi-id]",
10+
)) {
11+
if (!field.dataset.ppoiId) return
12+
const ppoiField = document.querySelector(`#${field.dataset.ppoiId}`)
13+
if (!ppoiField) return
1414

15-
const point = document.createElement("div")
16-
const img = field.querySelector("img")
17-
point.className = "imagefield-point opaque"
18-
img.parentNode.appendChild(point)
15+
const point = document.createElement("div")
16+
const img = field.querySelector("img")
17+
point.className = "imagefield-point opaque"
18+
img.parentNode.appendChild(point)
1919

20-
setTimeout(() => {
21-
point.className = "imagefield-point"
22-
}, 1000)
20+
setTimeout(() => {
21+
point.className = "imagefield-point"
22+
}, 1000)
2323

24-
const matches = ppoiField.value.match(/^([.0-9]+)x([.0-9]+)$/)
25-
if (matches) {
26-
movePoint(
27-
point,
28-
img,
29-
Number.parseFloat(matches[1]),
30-
Number.parseFloat(matches[2]),
31-
)
32-
} else {
33-
movePoint(point, img, 0.5, 0.5)
34-
}
35-
})
24+
const matches = ppoiField.value.match(/^([.0-9]+)x([.0-9]+)$/)
25+
if (matches) {
26+
movePoint(
27+
point,
28+
img,
29+
Number.parseFloat(matches[1]),
30+
Number.parseFloat(matches[2]),
31+
)
32+
} else {
33+
movePoint(point, img, 0.5, 0.5)
34+
}
35+
}
3636

3737
document.body.addEventListener("click", (e) => {
38-
if (
39-
e.target &&
40-
e.target.matches &&
41-
e.target.matches("img.imagefield-preview-image")
42-
) {
38+
if (e.target?.matches?.("img.imagefield-preview-image")) {
4339
const field = e.target.closest(".imagefield[data-ppoi-id]")
4440
if (!field.dataset.ppoiId) return
4541
const ppoiField = document.querySelector(`#${field.dataset.ppoiId}`)

package.json

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)