Skip to content

Commit

Permalink
Back to biome, now with an actually good configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiask committed Sep 12, 2024
1 parent 7a2b8c4 commit 4b7ec75
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 47 deletions.
21 changes: 6 additions & 15 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ repos:
- id: ruff
args: [--unsafe-fixes]
- id: ruff-format
- repo: https://github.com/biomejs/pre-commit
rev: "v0.4.0"
hooks:
- id: biome-check
additional_dependencies: ["@biomejs/[email protected]"]
args: [--unsafe]
- repo: https://github.com/tox-dev/pyproject-fmt
rev: 2.2.3
hooks:
Expand All @@ -32,18 +38,3 @@ repos:
rev: v0.19
hooks:
- id: validate-pyproject
- repo: local
hooks:
- id: prettier
name: prettier
entry: npx [email protected] --no-semi --write
language: system
types_or: [css, scss]
require_serial: true
- id: eslint
name: eslint
entry: yarn eslint
language: system
types_or: [javascript]
require_serial: true
verbose: true
57 changes: 57 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
"organizeImports": {
"enabled": false
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 2
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"a11y": {
"noSvgWithoutTitle": "off"
},
"correctness": {
"noUndeclaredVariables": "error",
"noUnusedImports": "error",
"noUnusedVariables": "error",
"useArrayLiterals": "error",
"useHookAtTopLevel": "error"
},
"security": {
"noDangerouslySetInnerHtml": "warn"
},
"style": {
"noParameterAssign": "off",
"useForOf": "warn"
},
"suspicious": {
"noArrayIndexKey": "warn",
"noAssignInExpressions": "off"
}
}
},
"javascript": {
"formatter": {
"semicolons": "asNeeded"
},
"globals": ["django", "CKEDITOR"]
},
"css": {
"formatter": {
"enabled": true
},
"linter": {
"enabled": true
}
},
"json": {
"formatter": {
"enabled": false
}
}
}
17 changes: 0 additions & 17 deletions eslint.config.mjs

This file was deleted.

3 changes: 0 additions & 3 deletions feincms3/inline_ckeditor.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import json

import django
from django import forms
from django.conf import settings
from django.core.checks import Warning
Expand Down Expand Up @@ -160,8 +159,6 @@ def __init__(self, *args, **kwargs):

attrs = kwargs.setdefault("attrs", {})
attrs["data-inline-cke"] = id(self.config)
if django.VERSION < (4, 2):
attrs["data-inline-cke-dj41"] = True
super().__init__(*args, **kwargs)

@property
Expand Down
9 changes: 5 additions & 4 deletions feincms3/static/feincms3/inline-ckeditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,23 @@
onReady(() => {
const configs = {}
const scripts = document.querySelectorAll("[data-inline-cke-config]")
scripts.forEach(function parseConfig(script) {
for (const script of scripts) {
configs[script.dataset.inlineCkeId] = JSON.parse(
script.dataset.inlineCkeConfig,
)
})
}

function initializeInlineCKE() {
document.querySelectorAll("textarea[data-inline-cke]").forEach((el) => {
const textareas = document.querySelectorAll("textarea[data-inline-cke]")
for (const el of textareas) {
if (
el.dataset.inlineCke !== "active" &&
!el.id.includes("__prefix__")
) {
CKEDITOR.replace(el, configs[el.dataset.inlineCke])
el.dataset.inlineCke = "active"
}
})
}
}

function addFormsetAddedHandler() {
Expand Down
8 changes: 0 additions & 8 deletions package.json

This file was deleted.

0 comments on commit 4b7ec75

Please sign in to comment.