Skip to content

Commit

Permalink
Revert "Back to ESLint and prettier, fix a few minor issues with the …
Browse files Browse the repository at this point in the history
…code"

This reverts commit b9e9ef4.
  • Loading branch information
matthiask committed Sep 12, 2024
1 parent b9e9ef4 commit b42f151
Show file tree
Hide file tree
Showing 18 changed files with 71 additions and 666 deletions.
29 changes: 10 additions & 19 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,35 +14,26 @@ repos:
- id: mixed-line-ending
- id: trailing-whitespace
- repo: https://github.com/adamchainz/django-upgrade
rev: 1.21.0
rev: 1.18.0
hooks:
- id: django-upgrade
args: [--target-version, "3.2"]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.6.4"
rev: "v0.4.9"
hooks:
- id: ruff
- 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
rev: 2.1.3
hooks:
- id: pyproject-fmt
- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.19
rev: v0.18
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
2 changes: 0 additions & 2 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ Next version
~~~~~~~~~~~~

- Updated the ProseMirror dependencies.
- Switched back to ESLint and prettier. Somehow biome didn't warn when
variables were unused or undefined.


0.8 (2024-08-26)
Expand Down
41 changes: 41 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.1/schema.json",
"organizeImports": {
"enabled": false
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 2
},
"javascript": {
"formatter": {
"semicolons": "asNeeded"
}
},
"css": {
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 2
},
"linter": {
"enabled": true
}
},
"linter": {
"enabled": true,
"rules": {
"complexity": {
"noForEach": "off",
"useOptionalChain": "off"
},
"style": {
"noParameterAssign": "off"
},
"suspicious": {
"noAssignInExpressions": "off"
}
}
}
}
2 changes: 1 addition & 1 deletion django_prose_editor/static/django_prose_editor/editor.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions esbuild.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/* globals process */
import * as esbuild from "esbuild"
import postcss from "esbuild-postcss"

const devMode = process.argv.includes("watch")
const ctx = await esbuild.context({
entryPoints: ["./src/overrides.css", "./src/editor.mjs"],
entryPoints: ["./src/overrides.css", "./src/editor.js"],
minify: true,
bundle: true,
target: "es6",
Expand Down
17 changes: 0 additions & 17 deletions eslint.config.mjs

This file was deleted.

5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@
"prosemirror-schema-list": "^1.4.1",
"prosemirror-state": "^1.4.3",
"prosemirror-transform": "^1.10.0",
"prosemirror-view": "^1.34.2",
"@eslint/js": "^9.10.0",
"eslint": "^9.10.0",
"globals": "^15.9.0"
"prosemirror-view": "^1.34.2"
},
"scripts": {
"dev": "node esbuild.mjs watch",
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions src/commands.mjs → src/commands.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getMarkRange } from "./extendMarkRange.mjs"
import { getHTML, parseHTML, trimmedRangeFromSelection } from "./utils.mjs"
import { getMarkRange } from "./extendMarkRange.js"
import { getHTML, parseHTML, trimmedRangeFromSelection } from "./utils.js"

const linkDialog = (attrs) => {
const { messages } = window.DjangoProseEditor
Expand Down
8 changes: 2 additions & 6 deletions src/editor.css
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,10 @@ label:empty:has(+ .prose-editor) {

.prose-editor-nbsp {
background: var(--_t);
box-shadow:
0 2px 0 0 var(--_t),
0 -2px 0 0 var(--_t);
box-shadow: 0 2px 0 0 var(--_t), 0 -2px 0 0 var(--_t);
}

.prose-editor-shy {
background: var(--_t);
box-shadow:
0 2px 0 1px var(--_t),
0 -2px 0 1px var(--_t);
box-shadow: 0 2px 0 1px var(--_t), 0 -2px 0 1px var(--_t);
}
12 changes: 6 additions & 6 deletions src/editor.mjs → src/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { addListNodes } from "prosemirror-schema-list"
import { EditorState } from "prosemirror-state"
import { EditorView } from "prosemirror-view"

import { buildKeymap, applyMarksKeymap } from "./keymap.mjs"
import { buildKeymap, applyMarksKeymap } from "./keymap.js"
import {
menuPlugin,
blockTypeMenuItems,
Expand All @@ -22,10 +22,10 @@ import {
historyMenuItems,
markMenuItems,
htmlMenuItem,
} from "./menu.mjs"
import { noSpellCheck } from "./nospellcheck.mjs"
import { typographicPlugin } from "./typographic.mjs"
import { crel, createDebouncedBackWriter, parseHTML } from "./utils.mjs"
} from "./menu.js"
import { noSpellCheck } from "./nospellcheck.js"
import { typographicPlugin } from "./typographic.js"
import { crel, createDebouncedBackWriter, parseHTML } from "./utils.js"

const underlineDOM = ["u", 0]
const strikethroughDOM = ["s", 0]
Expand Down Expand Up @@ -146,7 +146,7 @@ export function createEditor(textarea, config) {
editor.before(textarea)
try {
editorViewInstance.destroy()
} finally {
} catch (_err) {
/* Intentionally left empty */
}
editor.remove()
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/keymap.mjs → src/keymap.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
sinkListItem,
} from "prosemirror-schema-list"

import { addLink } from "./commands.mjs"
import { addLink } from "./commands.js"

const mac =
typeof navigator !== "undefined"
Expand Down
4 changes: 2 additions & 2 deletions src/menu.mjs → src/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import {
removeLink,
updateHTML,
insertHorizontalRule,
} from "./commands.mjs"
import { crel, markActive } from "./utils.mjs"
} from "./commands.js"
import { crel, markActive } from "./utils.js"

export function menuPlugin(items) {
return new Plugin({
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions src/typographic.mjs → src/typographic.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const typographicDecorationsForNode = (node, position) => {
const decorations = []
if (node.text) {
for (const match of node.text.matchAll(/(\u00A0|\u00AD)/g)) {
const array = Array.from(match)
const from = position + (match.index || 0)
decorations.push(
Decoration.inline(from, from + 1, {
Expand Down
File renamed without changes.
Loading

0 comments on commit b42f151

Please sign in to comment.